Aller au contenu

Photo

Get the person who triggered the trap


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Tiggers.no.tail

Tiggers.no.tail
  • Members
  • 41 messages
 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?

#2
the.gray.fox

the.gray.fox
  • Members
  • 127 messages

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
Mudeye

Mudeye
  • Members
  • 126 messages
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.

Modifié par Mudeye, 21 juin 2011 - 04:47 .


#4
kalbaern

kalbaern
  • Members
  • 824 messages

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
Mudeye

Mudeye
  • Members
  • 126 messages
I was looking on the toolset manual and it appears that the OnTrapTriggered script in the dialogs is something in addition to the trap behavior and by default the dialog field is blank. The manual says that you set the field in the dialog to a script to add additional functionality to the trap.

#6
the.gray.fox

the.gray.fox
  • Members
  • 127 messages
Hello.

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
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
http://social.biowar...6006615#6024125