Aller au contenu

Photo

Trap script


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

#1
PJ156

PJ156
  • Members
  • 2 988 messages
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

#2
Shallina

Shallina
  • Members
  • 1 012 messages
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

#3
The Fred

The Fred
  • Members
  • 2 516 messages
Depending on what shape it is, you could just create a new trap afterwards.

#4
_Knightmare_

_Knightmare_
  • Members
  • 643 messages
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.

Modifié par _Knightmare_, 28 juin 2011 - 12:17 .


#5
PJ156

PJ156
  • Members
  • 2 988 messages
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

#6
kamal_

kamal_
  • Members
  • 5 260 messages
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
PJ156

PJ156
  • Members
  • 2 988 messages
Monkey .. got it.

Looked for a monkey but can't find one. Will a spider do?

PJ