Graal Forums

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

wild8900 05-12-2008 06:37 AM

Triggeraction: Class NPC to Level NPC
 
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)
PHP Code:

//#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).
PHP Code:

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



Tigairius 05-12-2008 06:50 AM

PHP Code:

triggeraction(player.x+1.5+vecx(player.dir)*2,player.y+2+vecx(player.dir)*2,"Block",0); 


PHP Code:

//#CLIENTSIDE
function onCreated() {
  
setshape(13232);
}

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

Quote:

Originally Posted by Tigairius (Post 1390368)
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.


All times are GMT +2. The time now is 08:56 AM.

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