Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-12-2008, 06:37 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
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;

Reply With Quote
  #2  
Old 05-12-2008, 06:50 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
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;

__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #3  
Old 05-12-2008, 08:23 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
I did exactly those, and it doesnt work at all. -_-

Ill play around with the script a bit.
Reply With Quote
  #4  
Old 05-12-2008, 08:33 AM
Tigairius Tigairius is offline
The Cat
Tigairius's Avatar
Join Date: Jan 2007
Location: Missouri, USA
Posts: 4,240
Tigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant futureTigairius has a brilliant future
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.
__________________


“Shoot for the moon. Even if you miss, you'll land among the stars.”
Reply With Quote
  #5  
Old 05-12-2008, 11:11 AM
Dan Dan is offline
Daniel
Join Date: Oct 2007
Posts: 383
Dan is an unknown quantity at this point
Send a message via MSN to Dan
Quote:
Originally Posted by Tigairius View Post
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.
__________________

Last edited by Dan; 05-12-2008 at 11:34 AM..
Reply With Quote
  #6  
Old 05-13-2008, 06:59 AM
wild8900 wild8900 is offline
Mr. Brightside
wild8900's Avatar
Join Date: Dec 2005
Posts: 418
wild8900 is an unknown quantity at this point
Send a message via MSN to wild8900
Thanks guys, forgot to say it worked after some tweaking.
Reply With Quote
Reply


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 08:58 PM.


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