void main() { object oObject=GetInventoryDisturbItem(); object oPC=GetLastDisturbed(); object oPedestal=GetNearestObjectByTag("trito_pedestal", OBJECT_SELF, 1); object oInv; location lLoc=GetLocation(GetWaypointByTag("trito_creaturespawn_wp")); object oObject2=GetFirstItemInInventory(oPedestal); // Run this when something is added to the inventory if (GetInventoryDisturbType()==INVENTORY_DISTURB_TYPE_ADDED) { // The Item placed in it is NOT the right object // .. so tells the PC, and zaps them with an electric shock, and destroys whatever was put in if ((GetTag(oObject)!="trito_gem_tag")) { ActionSpeakString("This is NOT the right gem"); ActionCastSpellAtObject(SPELL_ELECTRIC_JOLT,oPC,METAMAGIC_ANY,TRUE); DestroyObject(oObject); } else { // The item placed in the inventory IS the right gem if ((GetTag(oObject)=="trito_gem_tag")) { //ApplyEffectAtLocation(DURATION_TYPE_INSTANT,EffectVisualEffect(VFX_IMP_KNOCK),GetLocation(OBJECT_SELF)); SetLocalInt(OBJECT_SELF, "trito_has_gem", 1); if ((GetLocalInt(oPedestal, "trito_has_gem")==1) && (GetLocalInt(OBJECT_SELF, "trito_has_gem")==1)) { CreateObject(OBJECT_TYPE_CREATURE, "tri_undeadc", lLoc, FALSE, "tri_undeadc"); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_2), lLoc); ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SCREEN_SHAKE), lLoc); DestroyObject(oObject); DestroyObject(oObject2); DeleteLocalInt(OBJECT_SELF, "trito_has_gem"); DeleteLocalInt(oPedestal, "trito_has_gem"); } } } } if (GetInventoryDisturbType()==INVENTORY_DISTURB_TYPE_REMOVED) { if ((GetTag(oObject) == "trito_gem_tag")) { DeleteLocalInt(OBJECT_SELF, "trito_has_gem"); } } }