I have a room where I want to monitor the party's facing. So I set up a party hook to check the party.facing whenever they move or turn. The problem that I have is simple, the onTurn() and onMove() check the position and performs any functions before the actual move/turn take place whereas I need it to check after the move/turn occurs.
I read the description of onTurn() and believe I can still make this work (albeit doubling my work load
Right now I have
onTurn() = function(self)
moveScript.checkPosition()
end,
and then a script entity with
function checkPosition()
if party.facing == 0 then
<severely abuse party here>
end
end
but that works when the party is already facing north and tries to turn east or west. What I need is when the party is facing east or west and tries to turn north.
Code: Select all
onTurn: a hook which is called when the party turns. The function gets two parameters: the party itself and the direction it is turning, -1 for counterclockwise and 1 for clockwise turn. If the function returns false, the turn is cancelled.
function checkPosition(direction)
if party.x == 1 and direction == -1 then
<punish party>
elseif party.x == 3 and direction == 1 then
<insult party>
end
end
or would it be checkPosition(self,direction)?
I think a nice tutorial on using hooks, especially with an emphasis on using the various parameters would be an awesome addition to the superthread.
Thanks in advance.
