Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #17  
Old 09-10-2011, 07:09 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
You should handle damage entirely on serverside without triggers like that anyway.
__________________
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:06 AM.


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