void main() { object oUser = GetLastUsedBy(); string sLeadsTo=GetLocalString(OBJECT_SELF, "sLeadsTo"); object oLeadsTo=GetWaypointByTag(sLeadsTo); int nIdx; object oAssociate; // Allow for traps and locks if (GetIsTrapped(OBJECT_SELF)) {return;} if (GetLocked(OBJECT_SELF)) { // See if we have the key and unlock if so string sKey = GetTrapKeyTag(OBJECT_SELF); object oKey = GetItemPossessedBy(oUser, sKey); if (sKey != "" && GetIsObjectValid(oKey)) { SendMessageToPC(oUser, GetStringByStrRef(7945)); SetLocked(OBJECT_SELF, FALSE); } else { // Print '*locked*' message and play sound DelayCommand(0.1, PlaySound("as_dr_locked2")); FloatingTextStringOnCreature("*" + GetStringByStrRef(8307) + "*", oUser); SendMessageToPC(oUser, GetStringByStrRef(8296)); return; } } string sTag=GetTag(OBJECT_SELF); int nAnim; // Handle opening/closing if (GetLocalInt(OBJECT_SELF,"isopen")!=TRUE) { if (sTag=="jw_secret_wd_dr"||sTag=="jw_secret_me_dr"||sTag=="jw_secret_st_dr") { nAnim=ANIMATION_LOOPING_GET_MID; } else { nAnim=ANIMATION_LOOPING_GET_LOW; } // play animation of user opening it AssignCommand(oUser, ActionPlayAnimation(nAnim)); PlayAnimation(ANIMATION_PLACEABLE_OPEN); SetLocalInt(OBJECT_SELF,"isopen",TRUE); } else // it is open so go through { for (nIdx=1;nIdx<=5;nIdx++) { oAssociate=GetAssociate(nIdx,oUser); if (GetIsObjectValid(oAssociate)) { AssignCommand(oAssociate, JumpToObject(oLeadsTo)); } } AssignCommand(oUser, JumpToObject(oLeadsTo)); } }