location lTarget;
object oTarget;
/*   Script generated by
Lilac Soul's NWN Script Generator, v. 1.6

For download info, please visit:
http://www.lilacsoul.revility.com    */

//Put this OnEnter
void main()
{

object oPC = GetEnteringObject();

if (!GetIsPC(oPC)) return;

int nInt;
nInt=GetLocalInt(oPC, "c11Flood");

if (!(nInt == 2))
   return;

effect eEffect;
eEffect = EffectDamage(1, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_NORMAL);

ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC);

if (ReflexSave(oPC, 14, SAVING_THROW_TYPE_ALL ))
   {
   FloatingTextStringOnCreature("You manage to grab hold of the second corner and save yourself from the surging water.", oPC);

   }
else
   {
   FloatingTextStringOnCreature("You try to grab hold, but the water continues to push you down the passage.", oPC);

   oTarget = GetWaypointByTag("c12_Corner3");

   lTarget = GetLocation(oTarget);

//only do the jump if the location is valid.
//though not flawless, we just check if it is in a valid area.
//the script will stop if the location isn't valid - meaning that
//nothing put after the teleport will fire either.
//the current location won't be stored, either

   if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) return;

   AssignCommand(oPC, ClearAllActions());

   AssignCommand(oPC, ActionJumpToLocation(lTarget));

   }

}
