View Single Post
  #11  
Old 03-03-2009, 10:54 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Tyhm View Post
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.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.
__________________
Reply With Quote