//Script Name: invroom_exit ////////////////////////////////////////// //Created By: Genisys (Guile) //Created On: 8/05/08 ///////////////////////////////////////// /* This script goes in the OnUsed Event of a portal which must be in the Area Inventory Room. It will teleport the PC to where they were before they entered the Inventory room. */ //////////////////////////////////////// //Main Script void main() { object oTarget; object oTarget2; location lTarget; location lTarget2; object oPC = GetLastUsedBy(); lTarget = GetLocalLocation(oPC, "inv_loc"); //If they dont' have a stored location, then send them home! if (GetAreaFromLocation(lTarget)==OBJECT_INVALID) { oTarget2 = GetObjectByTag("home"); lTarget2 = GetLocation(oTarget2); int nInt; oTarget = oPC; nInt = GetObjectType(oTarget); if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oTarget); else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget)); AssignCommand(oPC, ClearAllActions()); DelayCommand(3.1, AssignCommand(oPC, ActionJumpToLocation(lTarget2))); } else { oTarget = oPC; int nInt; nInt = GetObjectType(oTarget); if (nInt != OBJECT_TYPE_WAYPOINT) ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), oTarget); else ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_UNSUMMON), GetLocation(oTarget)); AssignCommand(oPC, ClearAllActions()); DelayCommand(3.0, AssignCommand(oPC, ActionJumpToLocation(lTarget))); } }