Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   how would i subtract a flag serverside (https://forums.graalonline.com/forums/showthread.php?t=84357)

GULTHEX 02-22-2009 09:47 PM

how would i subtract a flag serverside
 
how would i do that

so this is clientside clientr.hp -= 20;

what is serverside

oh yea and im getting better at scripting :)

this is part of my hp sys made all bye myself

thankyou people that told me to go to wiki.graal.net thankyou very much

cbk1994 02-22-2009 09:51 PM

You need to trigger the serverside portion of a script so it can change the flag.

The command you'll use is called "triggerserver". There's an explanation on this page:

http://graal.net/index.php/Creation/Dev/Script/Client

(look for the 'triggerserver' command)

GULTHEX 02-22-2009 10:04 PM

can you give me an example of minusing it

fragman85 03-17-2009 10:23 PM

Well, I think this Thread is not too old yet.

And I'm not sure if Gulthex got help, so let's give him a small Example =P:

PHP Code:

// This function gets triggered by triggerserver();
function onActionServerSide() {
  if (
params[0] == "HP") {
    
clientr.hp -= 20;
  }
}
//#CLIENTSIDE
function onWeaponFired() {
// this.name is the Name of the Weapon that's getting triggered, you can let it stay this.name if you're the same weapon. HP is a parameter, if you use triggerserver more than once, you can check for different params..

  
triggerserver("gui"this.name"HP");


Hope it helped a little, I know, I suck at commenting =P
Everytime you fire your Weapon now, you'd lose 20HP...

Novice 03-22-2009 06:21 AM

Quote:

Originally Posted by cbk1994 (Post 1468696)
You need to trigger the serverside portion of a script so it can change the flag.

The command you'll use is called "triggerserver". There's an explanation on this page:

http://graal.net/index.php/Creation/Dev/Script/Client

(look for the 'triggerserver' command)

PHP Code:

triggerServer(type,name,param0,param1,param2,...); 

"name" refers to the name of the weapon. "type" is pretty much "weapon" or "gui", either work for anything.

Alternatively you can use triggerAction(), which is almost the same.
PHP Code:

triggerAction(x,y,name,param0,param1,param2,...); 

"name" refers to the part after "onAction" on the serverside, so if you used "HealthSubtract" then the trigger will be sent to "onActionHealthSubtract" in the serverside. "x" and "y" are usually 0.

cbk1994 03-22-2009 06:53 AM

Quote:

Originally Posted by Novice (Post 1476581)
Alternatively you can use triggerAction(), which is almost the same.
PHP Code:

triggerAction(x,y,name,param0,param1,param2,...); 

"name" refers to the part after "onAction" on the serverside, so if you used "HealthSubtract" then the trigger will be sent to "onActionHealthSubtract" in the serverside. "x" and "y" are usually 0.

That actually won't work.

Your trigger has to start with "Server" for it to go to that weapon serverside. Otherwise, it's triggering at that location.

fragman85 03-22-2009 01:10 PM

Quote:

Originally Posted by cbk1994 (Post 1476594)
That actually won't work.

Your trigger has to start with "Server" for it to go to that weapon serverside. Otherwise, it's triggering at that location.

It doesn't make any sense anyway.


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

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