Re: some scripting tricks I've come across
Posted: Tue Nov 27, 2012 4:27 pm
Excellent post cromcrom. Thanks.
Also I've just updated my original post with the following:
Add multiple tests to the same hook
With so many spells and effects using party, monster or other hooks, it can happen that you need to run two different scripts as part of the same hook. This can be done by evaluating each script as a variable and then returning both.here we first evaluate the checkHeld() function which will run a script and output either true or false. then we evaluate the checkTurn() function which will run another script and again output either true of false. Finally we return the AND of the outputs.. so if either (or both) output is false the overall output will be false and the monster will not execute its turn. If both are true, the monster turns.
Also I've just updated my original post with the following:
Add multiple tests to the same hook
With so many spells and effects using party, monster or other hooks, it can happen that you need to run two different scripts as part of the same hook. This can be done by evaluating each script as a variable and then returning both.
Code: Select all
onTurn = function(monster,turn_dir)
local hold_test = grimwold_spell_script.checkHeld(monster)
local turn_test = grimwold_spell_script.checkTurn(monster,turn_dir)
return hold_test and turn_test
end,