Thread: TriggerAction
View Single Post
  #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