View Single Post
  #9  
Old 07-16-2011, 01:49 AM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
I'm curious as to whether this is supposed to be something happening with every baddy of that type, or just one specific baddy.

If it's a one-off baddy then within the class script it might be a good idea to do something like:

PHP Code:
function onWasH1t(){
  
this.hearts -= player.swordpower; //or whatever would be relevant damage/function name for the attack, I personally approach this in a much more sophisticated way
  
if(this.hearts <= 0){
    
this.trigger("BaddyKilled", player);
  }
} 
And then within the level NPC script which is joining the class:

PHP Code:
function onBaddyKilled(temp.killer){
  
temp.killer.addweapon("nameofweapon");
} 
Reply With Quote