#include "spawner" void main() { object oPC = GetLastOpenedBy(); object oMod = GetModule(); object oItem = GetFirstItemInInventory(OBJECT_SELF); int oCount2 = GetLocalInt(oPC, "ch_count"); int oCountdown = GetLocalInt(oMod, "countdown"); int oChest1 = GetLocalInt(oMod, "chest1"); int oChest2 = GetLocalInt(oMod, "chest2"); int oChest3 = GetLocalInt(oMod, "chest3"); int oChest4 = GetLocalInt(oMod, "chest4"); int oComplete2 = GetLocalInt(oMod, "d2_complete"); int oComplete2a = GetLocalInt(oMod, "d2a_complete"); int oComplete5 = GetLocalInt(oMod, "d5_complete"); string oTag; if (oCountdown!=1) { while (GetIsObjectValid(oItem)) { ++oCount2; oTag = GetTag(oItem); if (oTag=="pearl") { SetLocalInt(oMod, "pearl_there", 1); } oItem = GetNextItemInInventory(OBJECT_SELF); } int oThere = GetLocalInt(oMod, "pearl_there"); if (oThere==0) { oItem = GetFirstItemInInventory(OBJECT_SELF); while (GetIsObjectValid(oItem)) { oTag = GetTag(oItem); if (oTag!="pearl") { DestroyObject(oItem); } oItem = GetNextItemInInventory(OBJECT_SELF); } location iLocation = GetLocation(OBJECT_SELF); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION), GetLocation(OBJECT_SELF)); DestroyObject(OBJECT_SELF, 0.0); SetLocalInt(oMod, "chest1", 1); if (oComplete2==1) {SetLocalInt(oMod, "chest2", 1);} if (oComplete2a==1) {SetLocalInt(oMod, "chest3", 1);} if (oComplete5==1) {SetLocalInt(oMod, "chest4", 1);} SetLocalInt(oMod, "chest_here", 0); return; } if (oCount2==0) { ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION), GetLocation(OBJECT_SELF)); DestroyObject(OBJECT_SELF, 0.0); SetLocalInt(oMod, "chest_here", 0); SetLocalInt(oMod, "chest1", 1); if (oComplete2==1) {SetLocalInt(oMod, "chest2", 1);} if (oComplete2a==1) {SetLocalInt(oMod, "chest3", 1);} if (oComplete5==1) {SetLocalInt(oMod, "chest4", 1);} return; } SetLocalInt(oMod, "countdown", 1); Message(0.0, "You have 10 seconds to take the Token", oPC); Message(1.0, "You have 9 seconds to take the Token", oPC); Message(2.0, "You have 8 seconds to take the Token", oPC); Message(3.0, "You have 7 seconds to take the Token", oPC); Message(4.0, "You have 6 seconds to take the Token", oPC); Message(5.0, "You have 5 seconds to take the Token", oPC); Message(6.0, "You have 4 seconds to take the Token", oPC); Message(7.0, "You have 3 seconds to take the Token", oPC); Message(8.0, "You have 2 seconds to take the Token", oPC); Message(9.0, "You have 1 seconds to take the Token", oPC); oItem = GetFirstItemInInventory(OBJECT_SELF); while (GetIsObjectValid(oItem)) { oTag = GetTag(oItem); if (oTag!="coin1") { DestroyObject(oItem); } oItem = GetNextItemInInventory(OBJECT_SELF); } DelayCommand(10.0, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_MYSTICAL_EXPLOSION), GetLocation(OBJECT_SELF))); DestroyObject(OBJECT_SELF, 10.5); SetLocalInt(oMod, "chest1", 1); if (oComplete2==1) {SetLocalInt(oMod, "chest2", 1);} if (oComplete2a==1) {SetLocalInt(oMod, "chest3", 1);} if (oComplete5==1) {SetLocalInt(oMod, "chest4", 1);} SetLocalInt(oMod, "chest_here", 0); } oItem = GetFirstItemInInventory(OBJECT_SELF); while (GetIsObjectValid(oItem)) { oTag = GetTag(oItem); if (oTag!="pearl") { DestroyObject(oItem); } oItem = GetNextItemInInventory(OBJECT_SELF); } }