Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-15-2007, 07:03 PM
pig132 pig132 is offline
professional troll
Join Date: May 2006
Posts: 260
pig132 will become famous soon enough
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
Reply With Quote
  #2  
Old 05-15-2007, 07:27 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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
__________________

Last edited by Chompy; 05-15-2007 at 08:24 PM..
Reply With Quote
  #3  
Old 05-15-2007, 07:51 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #4  
Old 05-15-2007, 10:24 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
I didn't think you needed to use "gui" in a triggerclient? I've always done
triggerclient(this.name, "action", params);
Reply With Quote
  #5  
Old 05-15-2007, 10:27 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
"gui" or "weapon", as Stefan said.
Reply With Quote
  #6  
Old 05-15-2007, 10:27 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Quote:
Originally Posted by Twinny View Post
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)
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #7  
Old 05-15-2007, 11:41 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
"gui" is easier for me, I'm used to it.

Also, use clientr.hammerstr; client.hammerstr would be hacked easily.
__________________
Reply With Quote
  #8  
Old 05-15-2007, 11:45 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
T'was an example :P
Reply With Quote
  #9  
Old 05-15-2007, 11:54 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by xXziroXx View Post
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? .
Reply With Quote
  #10  
Old 05-15-2007, 11:59 PM
Deadly_Killer Deadly_Killer is offline
Registered User
Join Date: Feb 2002
Posts: 227
Deadly_Killer is on a distinguished road
Quote:
Originally Posted by cbkbud View Post
"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
__________________
- Zidane / Zidaya
Reply With Quote
  #11  
Old 05-16-2007, 01:48 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #12  
Old 05-16-2007, 02:45 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Deadly_Killer View Post
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.
__________________
Do it with a DON!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:22 PM.


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