/* This is a modified version of Niffty's original Zombie Grave Crawl script. Rewritten by The Amethyst Dragon 2/26/2008. Includes original functionality, with fixes to address original issues of holes remaining on battlefield. Also includes option to pick undead rising based on local string on the trigger. */ #include "nw_i0_generic" void main() { // Determine if this should work yet (based on possible delay if (GetLocalInt(OBJECT_SELF, "REPEAT_DELAYED") == 1) { return; } object oPC = GetEnteringObject(); if (!GetIsPC(oPC)) return; // only triggers for PCs // Load variables from the trigger string sUndeadResref = GetLocalString(OBJECT_SELF, "BLUEPRINT"); // defines the type of undead that appears float fRepeatDelay = GetLocalFloat(OBJECT_SELF, "REPEATDELAY"); // the number of seconds between possible spawns int nRepeating = 1; // no actual variable for this one on trigger // Fill in defaults if variables not found on trigger if (sUndeadResref == "") { sUndeadResref = "nw_zombie02"; } if (fRepeatDelay == 0.0) { nRepeating = 0; } // Create the hole location lHole = GetLocation(oPC); object oHole = CreateObject(OBJECT_TYPE_PLACEABLE, "x2_plc_hole_b", lHole); DestroyObject(oHole, 5.0); // Hole vanishes 5 seconds later // Add burst of stone visual effect effect eBurst = EffectVisualEffect(VFX_COM_CHUNK_STONE_MEDIUM); DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eBurst, lHole)); // Bring up the undead! object oUndead = CreateObject(OBJECT_TYPE_CREATURE, sUndeadResref, lHole); SetIsTemporaryEnemy(oPC, oUndead); AssignCommand(oUndead, ActionAttack(oPC)); string sUndeadName = GetName(oUndead); string sWarning = "The ground near you opens and a " + sUndeadName + " crawls out!"; FloatingTextStringOnCreature(sWarning, oPC); // If not repeating, the trigger destroys itself after the 1st activation if (nRepeating == 0) { DestroyObject(OBJECT_SELF); } // If there is a variable delay of more than 0.0 seconds, deactivate for the delay time else { SetLocalInt(OBJECT_SELF, "REPEAT_DELAYED", 1); DelayCommand(fRepeatDelay, DeleteLocalInt(OBJECT_SELF, "REPEAT_DELAYED")); } }