Fire Swamp
-
I'm trying to get a script that will simulate the fire swamp from Princess Bride. You know the place! While you're walking about, random points on the map burst forth in flame.
The script isn't working quite right. I know I have an error in the "while" statement and its late, so I'm too lazy to fix that.
However, the other bit is the initial VFX effect is not ceasing to fire when it should. I'm not sure what the problem is, but I suspect it has to do with trying to apply the effect to a WP and I need to rewrite to make it a placeable instead.
I'm just posting this up though in case anyone wants to do me a favor and fix the code while I'm falling asleep and busy all day tomorrow. I'm trying to get the code done for an event next weekend I want to start.
void main() { // Define needed variables and determine which waypoint will fire on heartbeat int iRandom = Random(3) + 1; string sRandom = IntToString(iRandom); object oBurstPoint = GetWaypointByTag("fire_swamp00" + sRandom); // Define Effects VFX and Damage effect eBurst = EffectVisualEffect(VFX_DUR_INFERNO, FALSE); effect eDamage = EffectDamage(d4(), DAMAGE_TYPE_FIRE, DAMAGE_POWER_NORMAL); // Apply Initial Burst Effect -- It is not ending for some reason why? ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eBurst, GetLocation(oBurstPoint), 3.0); // Now see if a PC is near enough to the Burst to receive damage. object oBurstTarget = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oBurstPoint, 1); float fDistance = GetDistanceBetween(oBurstPoint, oBurstTarget); if(fDistance <= 3.0) { oBurstTarget = GetFirstObjectInShape(SHAPE_SPHERE, 1.5, GetLocation(oBurstPoint), FALSE, OBJECT_TYPE_CREATURE); while(oBurstTarget != OBJECT_INVALID) ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oBurstTarget); ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBurst, oBurstTarget); oBurstTarget = GetNextObjectInShape(SHAPE_SPHERE, 1.5, GetLocation(oBurstPoint), FALSE, OBJECT_TYPE_CREATURE); } }
-
You forgot some brackets on your while loop and I made some other corections.
It might not fix everything, but you can give this script a shot!
void main() { // Define needed variables and determine which waypoint will fire on heartbeat string sWaypointTag = "fire_swamp00" + IntToString(d3(1)); object oBurstPoint = GetWaypointByTag(sWaypointTag); // Define Effects VFX and Damage effect eBurst = EffectVisualEffect(VFX_DUR_INFERNO, FALSE); effect eDamage = EffectDamage(d4(), DAMAGE_TYPE_FIRE, DAMAGE_POWER_NORMAL); // Apply Initial Burst Effect -- It is not ending for some reason why? ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eBurst, GetLocation(oBurstPoint), 3.0); // Now see if a PC is near enough to the Burst to receive damage. float fRadius = 1.5; object oBurstTarget = GetFirstObjectInShape(SHAPE_SPHERE, fRadius, GetLocation(oBurstPoint), FALSE, OBJECT_TYPE_CREATURE); while(oBurstTarget != OBJECT_INVALID) { //Saving Throw? { ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBurst, oBurstTarget, 3.0); ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oBurstTarget); } //Check for next target oBurstTarget = GetNextObjectInShape(SHAPE_SPHERE, fRadius, GetLocation(oBurstPoint), FALSE, OBJECT_TYPE_CREATURE); } }
-
Thanks, yes, I still needed to add in the saving throw and some other surprises–but I just wanted the skeleton working and it was too late to get to it all last night.