I want to turn a trap off then on after a delay, from a convo. I have the script below. the trap switches off but not back on.
Does the function SetTrapDisabled destroy the trigger?
void main()
{
object oPC = GetPCSpeaker();
object oTarget;
object oTrap;
oTarget = GetObjectByTag("2005_dd_start_arc");
oTrap = GetObjectByTag("2005_dd_electrical_trap");
RemoveSEFFromObject(oTarget,"sp_lightning_ray");
SetTrapDisabled(oTrap);
object oPC1 = GetFirstPC(FALSE);
object oBeamStart = GetNearestObjectByTag("2005_dd_start_arc", oPC1, 1);
object oBeamEnd = GetNearestObjectByTag("2005_dd_end_arc", oPC1, 1);
effect eBeam1 = EffectNWN2SpecialEffectFile("sp_lightning_ray", oBeamEnd);
DelayCommand(10.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBeam1, oBeamStart, 3.0f));
SetTrapActive(oTrap,1);
}
Thanks,
PJ
Trap script
Débuté par
PJ156
, juin 28 2011 06:01
#1
Posté 28 juin 2011 - 06:01
#2
Posté 28 juin 2011 - 06:50
in your trigger for you trap use a custom condition with a local int
If (GetLocalInt()== FALSE/TRUE){
return;
}
And instead of using SetTrapActive use SetLocalInt in your script
If (GetLocalInt()== FALSE/TRUE){
return;
}
And instead of using SetTrapActive use SetLocalInt in your script
#3
Posté 28 juin 2011 - 10:59
Depending on what shape it is, you could just create a new trap afterwards.
#4
Posté 28 juin 2011 - 12:06
SetTrapDisabled() does destroy the trap as if someone had used the Disable Trap feat (and it fires off the OnDisarm script event if the trap trigger has one).
You can use SetTrapActive(oTrap, FALSE) to make it inactive and not be destroyed. Then SetTrapActive(oTrap, TRUE) to have it active again. Note though that this only works for trigger traps (not doors, chests, etc.) and the trap will still be visable, just won't do anything when walked over. So you might have to do some added VFX or something to show that the trap is no longer activated.
Spawned traps will only appear in a square shape of the size noted in its function parameters.
You can use SetTrapActive(oTrap, FALSE) to make it inactive and not be destroyed. Then SetTrapActive(oTrap, TRUE) to have it active again. Note though that this only works for trigger traps (not doors, chests, etc.) and the trap will still be visable, just won't do anything when walked over. So you might have to do some added VFX or something to show that the trap is no longer activated.
Spawned traps will only appear in a square shape of the size noted in its function parameters.
Modifié par _Knightmare_, 28 juin 2011 - 12:17 .
#5
Posté 28 juin 2011 - 07:22
That's great, I think I have enough to work this out, for this and future projects
Thanks _KM_ with that piece of advice you have just about written the whole script for me
It is a trigger so I am good to go.
Thank you for all the responses,
PJ
Thanks _KM_ with that piece of advice you have just about written the whole script for me
It is a trigger so I am good to go.
Thank you for all the responses,
PJ
#6
Posté 28 juin 2011 - 07:31
First, you spawn a monkey at the desired location. Then you fire a light ing bolt at it. Once you shock the monkey, you're all set!
#7
Posté 28 juin 2011 - 10:25
Monkey .. got it.
Looked for a monkey but can't find one. Will a spider do?
PJ
Looked for a monkey but can't find one. Will a spider do?
PJ





Retour en haut







