Get the person who triggered the trap
#1
Posté 19 juin 2011 - 10:20
I'm trying to find the proper Accessor method to return the person who last triggered a trap. i.e., someone is attempting to disarm a trap, but they fail and it goes off. also, is that the same as if someone just happens to walk over it?
#2
Posté 19 juin 2011 - 12:33
Tiggers.no.tail wrote...
Greetings!
I'm trying to find the proper Accessor method to return the person who last triggered a trap. i.e., someone is attempting to disarm a trap, but they fail and it goes off. also, is that the same as if someone just happens to walk over it?
Yes it is.
When a trap activates to [attempt to] cause harm to a victim, for any reason, always a very specific script is executed.
If you open your Traps.2da file you can see a complete list of scripts run for each trap in game.
Also, all the stock bioware trap scripts have _t1_ in their filename. It will be quick to find them with the script editor.
Anyway... from inside the trap script you can easily learn who is the trap activator (the victim to take its brunt).
From there you do what you want.
Keep in mind that, within those scripts, OBJECT_SELF is always the very Trap object.
A trap object is always one of three possible things: a Door object, a Placeable object, or a Trigger object.
Post questions if you require more help.
-fox
#3
Posté 21 juin 2011 - 04:45
If the trap is on a placeable then there is a method called OnTrapTriggered in the dialog box where you can put the script to call GetEnteringObject().
If it is a trigger, then the OnTrapTriggered appears in the trigger dialog.
Modifié par Mudeye, 21 juin 2011 - 04:47 .
#4
Posté 21 juin 2011 - 05:37
Mudeye wrote...
From the Lexicon there is an event called OnTrapTriggered that fires when a trap is triggered. If you handle that event and call GetEnteringObject() it returns whoever just triggered the trap.
If the trap is on a placeable then there is a method called OnTrapTriggered in the dialog box where you can put the script to call GetEnteringObject().
If it is a trigger, then the OnTrapTriggered appears in the trigger dialog.
Using this event replaces the default action for a trap. So if you utilize this method, you need to either execute the default script from there as well or include your own custom outcomes for triggering the traps.
#5
Posté 21 juin 2011 - 07:47
#6
Posté 22 juin 2011 - 12:51
Purpose of OnTrapTriggered is to allow builders to implement custom traps without having to modify the standard ones.
The event is only available for traps pre-placed via Toolset, and its setting is per-Object (as opposed to the universality of trap scripts, which work for traps laid down by characters as well).
Also, if traps become important for a module to the point that the builder wishes to do non-standard stuff with them, chances are the builder will modify the stock scripts to at least fix the numerous bugs in them.
While I ignore his exact goals, I believe that the OP is going to modify all trap scripts regardless.
-fox
Modifié par the.gray.fox, 22 juin 2011 - 12:56 .
#7
Posté 22 juin 2011 - 01:43





Retour en haut






