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 06-30-2001, 11:52 AM
BocoC BocoC is offline
Registered User
BocoC's Avatar
Join Date: Jun 2001
Location: Washington State, USA
Posts: 980
BocoC is on a distinguished road
Send a message via AIM to BocoC Send a message via Yahoo to BocoC
Cool TriggerAction

Can someone demonstrate an effective way to pass variables with triggeraction? For some reason I am not apprehending how to correctly pass a variable...
__________________
-Boco

FLKJH$TRFG*$(&%>FMG >REN<>F ;.kjsd
Reply With Quote
  #2  
Old 06-30-2001, 11:58 AM
T-Squad T-Squad is offline
Banned
T-Squad's Avatar
Join Date: Mar 2001
Location: United States of America
Posts: 1,733
T-Squad is on a distinguished road
....ok...right....for trigger action just use this simple stuff....

vecx(dir)
vecy(dir)

oh...and...i missed the main thing...but bah im lazy
thats all im telling :-)
Reply With Quote
  #3  
Old 06-30-2001, 12:30 PM
WhoopA WhoopA is offline
Registered User
Join Date: May 2001
Location: Wherever I may roam
Posts: 86
WhoopA is on a distinguished road
I haven't used the parameters of triggeraction yet, but I think this is how they would work. Let's say you want to pass a damage qand type value with this. You would call triggeraction similar to this:

NPC Code:

triggeraction x,y,damaged,damage,type;



triggeraction, in this case, has 2 parameters. (Parameters are anything after the action type, in this case "damaged". It's a standard programming term, look it up if you're still confused.)All parameters are strings, and however many parameters are passed determines the strings. If triggeraction passes 5 parameters you'd have variables from #p(0) to #p(4). If it passed 10, you'd have from #p(0) to #p(9). In this case we're passing 2, so there's #p(0) and #p(1). You must always pass 1 parameter, or your script will not run! Of course this paramater may be empty, as in triggeraction x,y,action,; (notice nothing between the comma and semicolon.)

In this case, the parameter #p(0) contains the damage amount, and #p(1) contains the type of weapon (ie freezing, burning, shocking, normal, whatever). Here's how the recieving NPC uses this:

NPC Code:

if (actiondamaged) {
hearts -= strtofloat(#p(0));
}



If an NPC was weak to freezing weapons, it could have this:

NPC Code:

if (actiondamaged) {
if (strequals(#p(1),freezing) {
hearts -= 2*strtofloat(#p(0));
} else {
hearts -= srtofloat(#p(0));
}
}



And so on. Hope this helped.

[Edit: Added some code tags to make the script snippets look a little better.]
__________________
WhoopA, the Official Kicker of Butts

--- No images. No clutter. Just pure, simple text.
"Thank you, thank you. Please, ladies, put your clothes back on... Not you Samus..." - Link from the BOTVGH
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.

Last edited by WhoopA; 06-30-2001 at 12:32 PM..
Reply With Quote
  #4  
Old 07-02-2001, 04:32 AM
Warcaptain Warcaptain is offline
Banned
Warcaptain's Avatar
Join Date: Jun 2001
Location: Virginia, USA
Posts: 2,086
Warcaptain is on a distinguished road
Send a message via ICQ to Warcaptain Send a message via AIM to Warcaptain Send a message via Yahoo to Warcaptain
Farming Example

Here is an example from my farming script im making:


//Water Can by Warcaptain
if (playertouchsme) toweapons Water Can;
if (weaponfired) {
triggeraction playerx+1.5+vecx(playerdir)*2,
playery+2+vecy(playerdir)*2,iswatered,;
this.water--;
}


// Plant by Warcaptain
if (actioniswatered) {
this.life--;
sleep 1;
}

It baisicly triggers the given action on the given X Y

Of course thats a simple version of my script

Im not giving you all of it, or it wouldnt be mine anymore
Reply With Quote
  #5  
Old 07-03-2001, 12:17 AM
WhoopA WhoopA is offline
Registered User
Join Date: May 2001
Location: Wherever I may roam
Posts: 86
WhoopA is on a distinguished road
Bleh. Read through and noticed "passing variables"... Use the message commands to pass variables in a parameter.

triggeraction x,y,damage,#v(damagevalue),#s(damagetype);
__________________
WhoopA, the Official Kicker of Butts

--- No images. No clutter. Just pure, simple text.
"Thank you, thank you. Please, ladies, put your clothes back on... Not you Samus..." - Link from the BOTVGH
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.
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 07:30 AM.


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