#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"); 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")&&(oTag!="katanakey")) { 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, "star_chest1", 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, "star_chest1", 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!="pearl")&&(oTag!="katanakey")) { 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, "star_chest1", 1); SetLocalInt(oMod, "chest_here", 0); } oItem = GetFirstItemInInventory(OBJECT_SELF); while (GetIsObjectValid(oItem)) { oTag = GetTag(oItem); if ((oTag!="pearl")&&(oTag!="katanakey")) { DestroyObject(oItem); } oItem = GetNextItemInInventory(OBJECT_SELF); } }