PDA

View Full Version : Triggeraction: Class NPC to Level NPC


wild8900
05-12-2008, 06:37 AM
Im having problems with this trigger action. Im making a script that places a block and when this block is on top of another npc (a floor switch), it triggers the switch. For some reason the RC says there arent enough params when I test it. Its strange...

Heres the block's trigger action (in an onCreated function)

//#CLIENTSIDE
function onCreated() {
triggeraction(player.x+vecx(player.dir)*2,player.y +vecx(player.dir)*2,"Block",0);
}

And here's the switch's action (Inside the level).

//#CLIENTSIDE
function onactionBlock() {
this.on=1;
setimg buttonpressed.png;
}

Tigairius
05-12-2008, 06:50 AM
triggeraction(player.x+1.5+vecx(player.dir)*2,play er.y+2+vecx(player.dir)*2,"Block",0);




//#CLIENTSIDE
function onCreated() {
setshape(1, 32, 32);
}

function onActionBlock() {
this.on=1;
setimg buttonpressed.png;
}

wild8900
05-12-2008, 08:23 AM
I did exactly those, and it doesnt work at all. -_-

Ill play around with the script a bit.

Tigairius
05-12-2008, 08:33 AM
You should use gscript2 for your setimg.
setimg("buttonpressed.png");

Make sure you're standing right next to the switch when you apply the script because that's the only way you'll really be able to test it... I suggest using onWeaponFired instead of onCreated.

Dan
05-12-2008, 11:11 AM
Make sure you're standing right next to the switch when you apply the script because that's the only way you'll really be able to test it... I suggest using onWeaponFired instead of onCreated.

If I'm correct you'll need to stand 10 tiles or less away from it for it to work. This will be removed in the new Graal version though. Also support for triggeraction from server- to clientside is going to be added for such NPC's (joined classes too).

Edit: Oh wait I thought you were using just some x and y, but I notice the 'player.x + vecx...' stuff is why he had to stand right next to it.

wild8900
05-13-2008, 06:59 AM
Thanks guys, forgot to say it worked after some tweaking.