Author Sticky: Post Working Scripts Here
Haelix Posted: Monday, 22 July 10:47AM
Script Name: Spike Corridor v0.9 By: Haelix

What it Does: Creates a Spiked Corridor with timed spikes popping up in sequence..."if" you can run through them when they are down goody, "else" you get spiked, hehe. Adds a little old school, run through the timed spikes, D&D style action. Requires actual hand-eye timing, not based on a pc dex stat.
I am going out of town for a week and i figured i should contribute something, considering how much info i have kiefed from these boards..heh. This is straight out of a small portion of my Mod, The Siege of Avondale. Laters....

Requires: 1 invisible object, 3 triggers, 3 waypoints, these 4 scripts. (more details about use in the timer script)

sc_timer script to go into the onheartbeat of the invis. object:
NWScript:
////////////////////////////////////////////////////////

//

//   Spike Corridor v0.9 (Indiana Jones Style, Old School)

//    By: Haelix   7/18/02

//

//Requires: 1 invisible plot marked object ("it_timer")

//          3 Triggers (no spec. tag required)

//          3 waypoints ("wp_st_01. wp_st_02, wp_st_03")

//          4 scripts: timer script for the invis. obj.

//                     +1 script per trigger

//Directions: Create and place the invis obj. somehwhere

//  in the trap area, making sure to tag it "it_timer" and

//  set it to plot.

//  Place 3 thin triggers crossing the corridor(about the

//  thickness of a waypoint).

//  Place the 3 waypoints on top of the three triggers.

//  Naming them "wp_st_01, wp_st_02,wp_st_03". On the

//  trigger under wp#1 place the first trigger script on

//  the onenter of it, second trigger script under wp#2, etc.

//  Place the timer script on the heartbeat of the invis obj.

//  Fire her up and enjoy the only timed spike corridor I

//  have seen or heard of that works well.

//

////////////////////////////////////////////////////////

void main()

{

//Sets timing variable and switches every 2 seconds

DelayCommand(1.0f,SetLocalInt(OBJECT_SELF, "nTimer", 1));

DelayCommand(3.0f,SetLocalInt(OBJECT_SELF, "nTimer", 2));

DelayCommand(5.0f,SetLocalInt(OBJECT_SELF, "nTimer", 3));

//Displays the spike effect to coincide with the timing variable

DelayCommand(1.0f,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_IMP_SPIKE_TRAP), GetLocation(GetWaypointByTag("wp_st_01")), 2.0f));

DelayCommand(3.0f,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_IMP_SPIKE_TRAP), GetLocation(GetWaypointByTag("wp_st_02")), 2.0f));

DelayCommand(5.0f,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, EffectVisualEffect(VFX_IMP_SPIKE_TRAP), GetLocation(GetWaypointByTag("wp_st_03")), 2.0f));

}



Script to be placed in the onenter of the first trigger:

NWScript:
void main()

//Sets Variables:

{

object oTime = GetObjectByTag("it_timer");

int nTime = GetLocalInt(oTime, "nTimer");//Gets the current count on the timer

object oPc = GetEnteringObject();

if (GetIsPC (oPc))

  {

//Determines whether or not to apply damage(checks if the spikes are up)

  if(nTime==1)

    {

      int nDamageAmmount = 50;

      effect eEffectDamage = EffectDamage(50, DAMAGE_TYPE_PIERCING, DAMAGE_POWER_NORMAL);

      ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffectDamage, oPc, 1.0f);

    }

  }

}


Script to be placed in the onenter of the second trigger:

NWScript:
void main()

//Sets Variables:

{

object oTime = GetObjectByTag("it_timer");

int nTime = GetLocalInt(oTime, "nTimer");//Gets the current count on the timer

object oPc = GetEnteringObject();

if (GetIsPC (oPc))

  {

//Determines whether or not to apply damage(checks if the spikes are up)

  if(nTime==2)

    {

      int nDamageAmmount = 50;

      effect eEffectDamage = EffectDamage(50, DAMAGE_TYPE_PIERCING, DAMAGE_POWER_NORMAL);

      ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffectDamage, oPc, 1.0f);

    }

  }

}


Script to be placed on the onenter of the third trigger:

NWScript:
void main()

//Sets Variables:

{

object oTime = GetObjectByTag("it_timer");

int nTime = GetLocalInt(oTime, "nTimer");//Gets the current count on the timer

object oPc = GetEnteringObject();

if (GetIsPC (oPc))

  {

//Determines whether or not to apply damage(checks if the spikes are up)

  if(nTime==3)

    {

      int nDamageAmmount = 50;

      effect eEffectDamage = EffectDamage(50, DAMAGE_TYPE_PIERCING, DAMAGE_POWER_NORMAL);

      ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffectDamage, oPc, 1.0f);

    }

  }

}


Final Notes: The invisible object creates the spike effect and sets the timing variable. The triggers check the timing variable to determine if you walk over them when the spikes are up, if so they apply 50 spike damage(easily changeable).
The only real bug with it so far that i need to iron out for the next release of it is the fact that the triggers only check if the spikes are up onenter, so you could move over the trigger when they are down and then just kinda stand there..next time they come up you wont get hurt...however it is a minor bug and overall the effect is quite convincing..anyone with an idea of how to have it check if your still standing there when the spikes come up again post it..i will work it in, i'll be working on that myself.
Also I am using the spike trap vfx cause i cant for the life of me find the vfx that nwn uses for the blade wall spell thingy..so you need to place the spike traps in a narrow corridor area to get the proper visual effect.