Author Topic: Get the person who triggered the trap  (Read 480 times)

Legacy_Tiggers.no.tail

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +0/-0
Get the person who triggered the trap
« on: June 19, 2011, 11:20:17 am »


                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?
               
               

               
            

Legacy_the.gray.fox

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Get the person who triggered the trap
« Reply #1 on: June 19, 2011, 01:33:59 pm »


               

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
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
Get the person who triggered the trap
« Reply #2 on: June 21, 2011, 05:45:27 pm »


               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 .
                     
                  


            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Get the person who triggered the trap
« Reply #3 on: June 21, 2011, 06:37:36 pm »


               

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.
               
               

               
            

Legacy_Mudeye

  • Full Member
  • ***
  • Posts: 238
  • Karma: +0/-0
Get the person who triggered the trap
« Reply #4 on: June 21, 2011, 08:47:26 pm »


               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.
               
               

               
            

Legacy_the.gray.fox

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
Get the person who triggered the trap
« Reply #5 on: June 22, 2011, 01:51:20 am »


               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 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Get the person who triggered the trap
« Reply #6 on: June 22, 2011, 02:43:59 am »


               http://social.biowar...6006615#6024125