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=12679)

nyghtGT 09-23-2001 07:31 PM

triggeraction
 
will someone please help me to comprende' the triggeraction params cause i just dont have a really good idea bout em ....

IceHawk 09-23-2001 09:12 PM

[PENCHOO]
triggeraction is the easiest yet most advanced command I know..

so I say..

"triggeraction, making newbie scripters look good"

BocoC 09-24-2001 01:01 AM

Re: triggeraction
 
Quote:

Originally posted by nyghtGT
will someone please help me to comprende' the triggeraction params cause i just dont have a really good idea bout em ....
triggeraction x,y,action,params;

Take this example:
NPC Code:

if (weaponfired) {
triggeraction playerx+1.5+vecx(playerdir)*2,playery+2+vecy(playe rdir)*2,myaction,#a;
}


That will trigger an action at the specified X and Y coordinates. The action name is myaction. There is 1 parameter, which is the account name of the player.
NPC Code:

if (actionmyaction) {
message #p(0);
}


If this npc gets activated by the weapon triggeraction, it displays the first parameter as it's message.

#p(n) is a string value which holds the nth action. n is any number between 0 and whatever Stefan made the maximum value be, which I think is 4.

SSRobgeta 09-24-2001 05:30 AM

:D I don't even care! :spam:

nyghtGT 09-25-2001 11:08 AM

ok so ...
 
ok so if i did ....

if (weaponfred) {triggeraction 24,34,my action,#a;
}

if (my action) {
putexplosion3,x,y;
}

That would put an explosion there right ? (at 24,34)

BocoC 09-25-2001 11:44 AM

Re: ok so ...
 
Quote:

Originally posted by nyghtGT
ok so if i did ....

if (weaponfred) {triggeraction 24,34,my action,#a;
}

if (my action) {
putexplosion3,x,y;
}

That would put an explosion there right ? (at 24,34)

No.

triggeraction x,y,action,param;

X and Y are the coordinates of the triggeraction event. Action is the action. Param are the parameters.

NPC Code:

if (weaponfired) {
this.x=24;
this.y=34;
triggeraction playerx+1.5+vecx(playerdir),playery+2+vecy(playerd ir),explosion,#v(this.x),#v(this.y);
}

if (actionexplosion) {
this.explosionX=strtofloat(#p(0));
this.explosionY=strtofloat(#p(1));
putexplosion 3,this.explosionX,this.explosionY;
}


In this code, it sends a triggeraction with the parameters 24 and 34. 24 is saved in the string #p(0) and 34 in the string #p(1). Once the NPC which holds the action is activated, it sets the values of #p(0) and #p(1) into the variables this.explosionX and this.explosionY. It then uses those variables to create the explosion.

nyghtGT 09-25-2001 12:17 PM

Re: Re: ok so ...
 
Quote:

Originally posted by BocoC

NPC Code:

if (weaponfired) {
this.x=24;
this.y=34;

triggeraction playerx+1.5+vecx(playerdir),playery+2+vecy(playerd ir),explosion,#v(this.x),#v(this.y);
}

if (actionexplosion) {
this.explosionX=strtofloat(#p(0));
this.explosionY=strtofloat(#p(1));
putexplosion 3,this.explosionX,this.explosionY;
}



Please explain the 'vecx(playerdir),playery+2+vecy(playerdir)
what does the vecx and vecy stand for ? (vecinity ??)

SSRobgeta 09-26-2001 04:02 AM

Quote:

Originally posted by SSRobgeta
:D I don't even care! :spam:
WHAT A *****!

entravial 09-26-2001 04:08 AM

~AlphaFlame~

*zips in to beat Boco*

Quote:

Please explain the 'vecx(playerdir),playery+2+vecy(playerdir)
As stated in commands.doc:
Quote:

vecx( dir ) vertical movement vector (0,-1,0,1)

vecy( dir ) horizontal movement vector (-1,0,1,0)
If you know arrays, you'll know that it will call one of those four numbers based on the players direction.

And that's the best I'm explaining ^_^;

nyghtGT 09-26-2001 08:45 AM

ok
 
i think i have a somewhat ok understanding now ...


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

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