Quote:
Originally Posted by Tyhm
Might do that, the players already join a class; would that trigger function on doDamage(){, function onDoDamage(){, function doDamage(){, ? The "on"s always throw me.
|
"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.