Graal Forums

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

pig132 05-15-2007 07:03 PM

Triggeraction
 
I've used it before, never really understood it. Can someone please explain to me what its used for, how to use it properly, and an example? And, please, in detail?
Thanks

Chompy 05-15-2007 07:27 PM

triggeraction(x, y, action, name, param0, param1, etc..);

if x and y is NULL/0, it will send a trigger to the action in the wnpc called 'name' else it will trigger any objects at x and y, then call the action on the object

PHP Code:

function onActionServerside()
{
  if (
parmas[0] == "foo")
    echo(
"bar");
}
//#CLIENTSIDE
function onCreated()
  
triggeraction(00"Serverside"this.name"foo"); 

there are other functions like triggeraction but specified to serverside or clientside

triggerserver(gui, this.name, param0, param1, etc..);
triggerclient(gui, this.name, param0, param1, etc..);

those functions is often used to get from client to server or vice versa

I hope this helps alittle :)

DustyPorViva 05-15-2007 07:51 PM

PHP Code:

triggeraction(x,y,"name",param0,param1,...); 

Triggeraction is used to interact between NPCs, by... triggering them, at the x/y coordinate given.

Say you have a weapon called a Hammer:
PHP Code:

function onWeaponfired() {
triggeraction(player.x+vecx(player.dir)*2,player.y+vecx(player.dir)*2,"Hammer",client.hammerstr);


That weapon sends a trigger at the coordinates in front of the player's current direction. The trigger is given the name "Hammer", sent with the parameter of the players hammer strength(if defined of course). Multiple parameters can be given. Then you have... let's say, a rock:

PHP Code:

function onactionHammer() {
  
this.chat="Your hammer is level" params[0] @ "!";


The rock will tell you what level your hammer is when it's hit. So in order to grab the trigger being sent, you use onactionTRIGGERNAME(), and you can do with it and the parameters as you wish.

Triggeraction can also communicate between the clientside and serverside, but I recommend triggerserver/triggerclient. Mainly because they're made specifically for that, and triggeraction was only used because it was the only available method. They do the same thing anyways, and since you're now learning, it's not like you're going to have to break the habit.

Twinny 05-15-2007 10:24 PM

I didn't think you needed to use "gui" in a triggerclient? I've always done
triggerclient(this.name, "action", params);

DustyPorViva 05-15-2007 10:27 PM

"gui" or "weapon", as Stefan said.

xXziroXx 05-15-2007 10:27 PM

Quote:

Originally Posted by Twinny (Post 1308137)
I didn't think you needed to use "gui" in a triggerclient? I've always done
triggerclient(this.name, "action", params);

It should be either "gui" or "weapon", preferable "gui" (from the big guy himself)

cbk1994 05-15-2007 11:41 PM

"gui" is easier for me, I'm used to it.

Also, use clientr.hammerstr; client.hammerstr would be hacked easily.

DustyPorViva 05-15-2007 11:45 PM

T'was an example :P

Twinny 05-15-2007 11:54 PM

Quote:

Originally Posted by xXziroXx (Post 1308142)
It should be either "gui" or "weapon", preferable "gui" (from the big guy himself)

I use "gui" in triggerserver("gui", this.name, params); but I have never used it in triggerclient(). It works without it so why use it? x_x.

Deadly_Killer 05-15-2007 11:59 PM

Quote:

Originally Posted by cbkbud (Post 1308185)
"gui" is easier for me, I'm used to it.

Also, use clientr.hammerstr; client.hammerstr would be hacked easily.

I bet you, I can make a client.variable that you could never 'hack'.

Would be an integer, percent, 0-100

DustyPorViva 05-16-2007 01:48 AM

Just because you don't have to use it, doesn't mean it's the most efficient. Just because I can use 50 loops inside each other doesn't mean I shouldn't just do something the way it's supposed to be done. If it's meant to be included, you should do it in good practice.

zokemon 05-16-2007 02:45 PM

Quote:

Originally Posted by Deadly_Killer (Post 1308195)
I bet you, I can make a client.variable that you could never 'hack'.

Would be an integer, percent, 0-100

Oh?
You fail to understand how a memory editor works then.


All times are GMT +2. The time now is 01:42 PM.

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