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.