View Single Post
  #13  
Old 03-03-2009, 11:00 PM
Codein Codein is offline
jwd
Codein's Avatar
Join Date: Oct 2005
Location: Greater Manchester
Posts: 2,423
Codein has a spectacular aura aboutCodein has a spectacular aura about
Send a message via AIM to Codein Send a message via MSN to Codein
Quote:
Originally Posted by cbk1994 View Post
"on" is used when you use a trigger.

PHP Code:
npc.trigger("PlayerAttack"player.accountdmg); // calls "onPlayerAttack"
npc.playerAttack(player.accountdmg); // 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
Reply With Quote