![]() |
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...
:confused: |
....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 :D thats all im telling :-) |
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, 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 an NPC was weak to freezing weapons, it could have this: NPC Code: And so on. Hope this helped. [Edit: Added some code tags to make the script snippets look a little better.] |
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 ;) |
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); |
| All times are GMT +2. The time now is 09:47 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.