/*
t_ent_trap_wrapr
A script to use as a wrapper for permanent traps, enabling them to be disabled
for a set period of time, then turned back on, so multiple entries by PC's
don't spam trap triggering. Implementation is create trap that is NOT Disarmable,
NOT detectable, and NOT single shot. Draw a generic trigger (with this script in
the on_enter handle) closely around the trap trigger. Make sure that the closest
(trap) trigger is the one you are trying to control (e.g. watch your spacing).
A default time of 10 minutes (600 seconds) is preprogrammed into the script.
To change the delay setting, set a LocalFloat named "Delay" to whatever value you wish.
The net effect is to have individually re-spawning traps. :)
*/
// Put this script OnEnter.
void main()
{
// Get the creature who triggered this event.
object oPC = GetEnteringObject();
object oTrap = GetNearestObject(OBJECT_TYPE_TRIGGER);
// Only fire for (real) PCs.
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
return;
// If the wrapper has not been entered yet, set a varaible on the wrapper to
// keep subsequent entries from triggerig the trap
if (GetLocalInt(OBJECT_SELF, "TRAP_ACTIVE") == 0)//0 means yes, it is active
{
if (GetLocalFloat(OBJECT_SELF, "Delay") == 0.0)
{
SetLocalFloat(OBJECT_SELF, "Delay", 600.0);
}
SetLocalInt(OBJECT_SELF, "TRAP_ACTIVE", 1);
DelayCommand(GetLocalFloat(OBJECT_SELF, "Delay"), SetLocalInt(OBJECT_SELF, "TRAP_ACTIVE", 0));
}
else
{
// Set it to inactive
SetTrapActive (oTrap, FALSE);
DelayCommand (GetLocalFloat(OBJECT_SELF, "Delay"), SetTrapActive (oTrap, TRUE));
}
}
Simple Respawning Traps
#1
Posté 16 février 2013 - 07:04
#2
Posté 16 février 2013 - 07:19
Your solution suffers with many issues:
- when the trap is set to inactive its still visible for players, setting the trap to active itself does not make the trap visible, nor detectable
- if the trap is nondisarmable it will not be possible to disarm so whats the point
I suggest to look into my script where I solved all issues and makke it work with one-shot and recoverable as well.
#3
Posté 16 février 2013 - 03:00
ShaDoOoW wrote...
You used similar technique as I did with my respawning traps with the same shape.
Your solution suffers with many issues:
- when the trap is set to inactive its still visible for players, setting the trap to active itself does not make the trap visible, nor detectable
- if the trap is nondisarmable it will not be possible to disarm so whats the point
I suggest to look into my script where I solved all issues and makke it work with one-shot and recoverable as well.
So, setting the trap to un-detectable still results in a visible trap?
And the point is I wanted a trap that the first entry triggers the trap, but not immediate subsequent entries. However, 10 minutes goes by and the trap is active again.
And, in our case, I am using the trap to signify another event, such as where the PC is stepping, and the placeable they walked through is something to avoid. It is not representing a classic trap being placed per se.
Modifié par WoC_Builder, 16 février 2013 - 05:14 .
#4
Posté 16 février 2013 - 03:12
http://nwvault.ign.c...d=51805&id=3870
Modifié par ffbj, 16 février 2013 - 03:14 .
#5
Posté 17 février 2013 - 08:40
Eh, no sorry. Undetectable trap is not visible. The issue I pointed is that when the trap is detectedd once by the PC, the only way to hide it again is by settrapvisible but the trap will still behave as detected for that PC so he wont reinitiate search check later.WoC_Builder wrote...
So, setting the trap to un-detectable still results in a visible trap?
I see, well you didnt told this to us. I thought that this trap should be visible, if this works only with placeable then I guess its working. Though its a bit weird there is no way to find out the trap is active by the PC.And, in our case, I am using the trap to signify another event, such as where the PC is stepping, and the placeable they walked through is something to avoid. It is not representing a classic trap being placed per se.
Modifié par ShaDoOoW, 17 février 2013 - 08:43 .
#6
Posté 17 février 2013 - 03:12
Modifié par ffbj, 17 février 2013 - 03:13 .
#7
Posté 17 février 2013 - 05:09
I don't want the pc to have any other visual clue that the guano is something to be avoided, other than the placeable itself.
Does this make more sense?
lol...I just put this out there in case anyone else wanted to use it. I didn't think I would have to justify why I wrote the code I did. My bad.
#8
Posté 17 février 2013 - 05:18
Sorry but you presented this as a simple respawning trap script while you actually using a trigger. Yes you do use trap, but for a purpose that a generic trigger would handle the same way.WoC_Builder wrote...
lol...I just put this out there in case anyone else wanted to use it. I didn't think I would have to justify why I wrote the code I did. My bad.
A generic builder had no chance to figure out the purpose of your script and how to use, until you clarified it now.
Modifié par ShaDoOoW, 17 février 2013 - 05:21 .
#9
Posté 17 février 2013 - 07:43
Perhaps my definition is off, calling this a respawning trap. But to me that is what the trigger did, respawned a trap that was encapsulated by the trigger. But I am a simple scripter, so forgive me.
I'm done here.
Modifié par WoC_Builder, 17 février 2013 - 08:12 .
#10
Posté 17 février 2013 - 11:49





Retour en haut






