Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Npc Trigger (https://forums.graalonline.com/forums/showthread.php?t=134264514)

ffcmike 09-10-2011 04:21 PM

Quote:

Originally Posted by blackbeltben (Post 1667702)
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);



cbk1994 09-10-2011 07:09 PM

You should handle damage entirely on serverside without triggers like that anyway.


All times are GMT +2. The time now is 03:26 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.