Lindworm, LUA question
Posted: Wed Jun 01, 2016 8:54 pm
Hey all,
I actually work on the Lindworm Fight for an extended LoG 2 main campaign. Just for fun and learn how the editor and LUA work. Who knows maybe the mode is even finished.
The Lindworm Brain with his basic attack and his ranged attack works fine and also the special actions like knockback, charge, ...
But now I’m stuck on a simple problem to spawn minions.
In his Brainscript he try to reach one of 2 Points on the map (done with triggers, just for testing) and then he perform the summon action. At this point he calls a delayed function in his Brain. This function does the spawn of the minions dependent of the stage. ... so far so good ...
Unfortunately, it is not possible for me to spawn monsters in this function. Lines with spawn("...", ...) are ignored and returned nil. When I use spawner
Objects, I become a bad self error.
I can do all the thinks in this function e.g. decrement a counter or start a timer to activate a spawner. But not directly call spawn() or activate Spawners. I also can call another function in another script to spawn monsters with spawn(..).
And here is the second thing I don’t understand. If I call a function from another function with arguments, then the first argument is a Table.
I must write the function like
to use the variables.
What is this Table and which reason has it? And have anyone a more elegant solution or must I go detour. Brain > Function > function for spawn
I actually work on the Lindworm Fight for an extended LoG 2 main campaign. Just for fun and learn how the editor and LUA work. Who knows maybe the mode is even finished.
The Lindworm Brain with his basic attack and his ranged attack works fine and also the special actions like knockback, charge, ...
But now I’m stuck on a simple problem to spawn minions.
In his Brainscript he try to reach one of 2 Points on the map (done with triggers, just for testing) and then he perform the summon action. At this point he calls a delayed function in his Brain. This function does the spawn of the minions dependent of the stage. ... so far so good ...
Unfortunately, it is not possible for me to spawn monsters in this function. Lines with spawn("...", ...) are ignored and returned nil. When I use spawner
Objects, I become a bad self error.
I can do all the thinks in this function e.g. decrement a counter or start a timer to activate a spawner. But not directly call spawn() or activate Spawners. I also can call another function in another script to spawn monsters with spawn(..).
And here is the second thing I don’t understand. If I call a function from another function with arguments, then the first argument is a Table.
I must write the function like
Code: Select all
function spawnHelper(dummyTable, obj, level, x, y, facing, elevation)
spawn(obj, level, x, y, facing, elevation)
end
What is this Table and which reason has it? And have anyone a more elegant solution or must I go detour. Brain > Function > function for spawn