Quote:
Originally Posted by cbk1994
"on" is used when you use a trigger.
PHP Code:
npc.trigger("PlayerAttack", player.account, dmg); // calls "onPlayerAttack" npc.playerAttack(player.account, dmg); // calls "playerAttack"
The main benefits of using triggers are: - They don't interrupt your code (your code continues without waiting for the function to finish)
- You can trigger any NPC for any function, and even if it doesn't exist, it won't give an error, unlike directly calling the function.
|
I, personally, would have liked a trigger to be used for this situation but unfortunately, it didn't work. I don't know if I did something wrong though. However, what I've done to work around the situation works almost as well
