Aller au contenu

Photo

How to put a friendly persistent trap on a useable door?


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

#1
BCH

BCH
  • Members
  • 86 messages
I'm trying to place a door that is trapped such that PCs can use the door normally, but the trap remains and will affect any hostile creature that tries to use the door.  (This is in a virtual pen and paper game, so NPCs may be trying to use that door when no PCs are around.)

When trying to use the Trap tab of the door properties, setting the trap to a faction like Defender seems to do everything I want it to except that when a PC tries to use the door, their receive the message "you triggered a trap" - thankfully the trap does not affect them - and the trap vanishes.  Then they an click again to open the door.

If I uncheck the "single shot" box in the door > Properties > Trap tab, then the trap does not vanish when a PC triggers it, and this does not allow the PC to open the door.  Every time they click, they just get "you triggered a trap" but nothing else happens.  The door cannot be accessed while the trap is in place.

I can get around this by putting the trap on the ground in front of the door - then it works the way I want it to - but I'm curious if I'm doing something wrong with that door's properties.

Any ideas?

#2
TSMDude

TSMDude
  • Members
  • 865 messages
No your not as the only way I know to do it like you want is putting it in front of the door as well.

#3
Shadooow

Shadooow
  • Members
  • 4 470 messages
You can make your own trap triggered script where you will open the door if the triggerer is PC or execute original trap script if not. Not totally clean, but should work.

#4
BCH

BCH
  • Members
  • 86 messages
Thanks, both!



ShaDoOoW, I've read that when a script is put in the OnTrapTriggered event, the default trap trigger script is overridden. Do you mean you can execute the original script from within the overriding script? If so, please tell me how, as I've never done this before.

#5
Shadooow

Shadooow
  • Members
  • 4 470 messages
Its not so easy, I mean there is not function "RunOriginalTrapScript", but the trap script names are known so everything you need to do is to get the trap script name and then use ExecuteScript function on OBJECT_SELF

#6
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

BCH wrote...

Thanks, both!

ShaDoOoW, I've read that when a script is put in the OnTrapTriggered event, the default trap trigger script is overridden. Do you mean you can execute the original script from within the overriding script? If so, please tell me how, as I've never done this before.


Here is what I use.


...
    string sImpactScript = GetLocalString(oTrap,"ImpactScript");
    if(sImpactScript == "")
    {
        sImpactScript=Get2DAString("traps","TrapScript",GetTrapBaseType(oTrap));
        SetLocalString( oTrap,"ImpactScript",sImpactScript);
    }
    ExecuteScript(sImpactScript,oTrap);
...



#7
BCH

BCH
  • Members
  • 86 messages
Excellent, thank you! I was glad to hear that the trap script names are known, but I was hesitant to ask where I can find them.



Lightfoot8, your reply could have been as short as "look in traps.2da" but the code snippet was helpful above and beyond. :-)