Thread: Npc Trigger
View Single Post
  #16  
Old 09-10-2011, 04:21 PM
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
Quote:
Originally Posted by blackbeltben View Post
Im using when it triggers serverside from the attack, i tried to use SetTimer(), scheduleEvent(), Trigger, all that stuff. I dont know what the proplem is. What would you use?
I've explained 3 different possible methods you could use several posts previous, and I've explained the advantages/disadvantages of them where different scripters will have different ideals as to how to do it.

Neither of those 3 functions are intended from communicating between Clientside and Serverside.

To elaborate on my previous post, a triggeraction would work like this:

PHP Code:
function onCreated(){
  
this.setshape(13232);
}

function 
onActionDamage(temp.power){
  
this.hp max(0this.hp temp.power);
}

//#CLIENTSIDE
function onWasDmg(temp.power) { 
  
triggeraction(this.1this.1"Damage"temp.power);

Whereas a basic serverside area trigger could be accomplished like this within a weapon script:

PHP Code:

function onActionServerside(temp.commandtemp.xtemp.y){
  switch(
temp.command){
    case 
"attack":
      
temp.tnpcs findareanpcs(temp.xtemp.y22);  
      for(
temp.temp.tnpcs){  
        
temp.n.trigger("WasDmg"player.clientr.power);  
      }
    break;
  }
}


//#CLIENTSIDE
function onAttack() { 
  
temp.player.0.5 + (vecx(player.dir) * 2);  
  
temp.player.+ (vecy(player.dir) * 2);
  
triggerserver("gui"this.name"attack"temp.xtemp.y);

Reply With Quote