//:://///////////////////////////////////////////////// //:: X0_O2_WEAPUNIQ.NSS //:: OnOpened/OnDeath script for a treasure container. //:: Treasure type: Any kind of weapon //:: Treasure level: TREASURE_TYPE_UNIQUE //:: //:: Copyright (c) 2002 Floodgate Entertainment //:: Created By: Naomi Novik //:: Created On: 11/21/2002 //:://///////////////////////////////////////////////// #include "x0_i0_treasure" int iLocked =GetLocalInt(OBJECT_SELF, "iLocked"); int iLockDC =GetLocalInt(OBJECT_SELF, "iLockDC"); int iLockUnlockDC =GetLocalInt(OBJECT_SELF, "iLockUnlockDC"); int iLockKeyRequired =GetLocalInt(OBJECT_SELF, "iLockKeyRequired"); int iLockLockable=GetLocalInt(OBJECT_SELF, "iLockLockable"); string sLockKeyTag =GetLocalString(OBJECT_SELF, "sLockKeyTag"); int iIsTrapped = GetLocalInt(OBJECT_SELF, "iIsTrapped"); int iTrapActive = GetLocalInt(OBJECT_SELF, "iTrapActive"); int iTrapBaseType = GetLocalInt(OBJECT_SELF, "iTrapBaseType"); int iTrapDetectable = GetLocalInt(OBJECT_SELF, "iTrapDetectable"); int iTrapDetectDC = GetLocalInt(OBJECT_SELF, "iTrapDetectDC"); int iTrapDisarmable = GetLocalInt(OBJECT_SELF, "iTrapDisarmable"); int iTrapDisarmDC = GetLocalInt(OBJECT_SELF, "iTrapDisarmDC"); string sTrapKeyTag = GetLocalString(OBJECT_SELF, "sTrapKeyTag"); int iTrapOneShot = GetLocalInt(OBJECT_SELF, "iTrapOneShot"); int iTrapRecoverable = GetLocalInt(OBJECT_SELF, "iTrapRecoverable"); void ResetLockTrapInfo(object oObject) { SetLocked(oObject, iLocked); SetLockLockDC(oObject, iLockDC); SetLockUnlockDC(oObject, iLockUnlockDC); SetLockKeyRequired(oObject, iLockKeyRequired); SetLockKeyTag(oObject, sLockKeyTag); SetLockLockable(oObject, iLockLockable); if (iIsTrapped = TRUE)CreateTrapOnObject(iTrapBaseType, oObject); SetTrapActive(oObject, iTrapActive); SetTrapDetectable(oObject, iTrapDetectable); SetTrapDetectDC(oObject, iTrapDetectDC); SetTrapDetectDC(oObject, iTrapDetectDC); SetTrapDisarmable(oObject, iTrapDisarmable); SetTrapDisarmDC(oObject, iTrapDisarmDC); SetTrapKeyTag(oObject, sTrapKeyTag); SetTrapOneShot(oObject, iTrapOneShot); SetTrapRecoverable(oObject, iTrapRecoverable); } void RespawnPLC(string sResRef, location lLocation, float fdelay) { object oObject = CreateObject(OBJECT_TYPE_PLACEABLE, sResRef, lLocation); ResetLockTrapInfo(oObject); ExecuteScript("ethsetuplocktrap", oObject); SetLocalFloat(oObject, "fRespawnRate", fdelay); return; } void main() { object oObject = OBJECT_SELF; location lObject = GetLocation(OBJECT_SELF); string sResRefObject = GetResRef(OBJECT_SELF); string sTagObject = GetTag(OBJECT_SELF); float fdelay = GetLocalFloat(OBJECT_SELF, "fRespawnRate"); if (FloatToInt(fdelay) == 0) fdelay = 3600.0; if (GetCurrentHitPoints(OBJECT_SELF) > 0) { if (!GetLocalInt(OBJECT_SELF, "ntimecheck") == 1) { DelayCommand(fdelay, CTG_SetIsTreasureGenerated(OBJECT_SELF, FALSE)); SetLocalInt(OBJECT_SELF, "ntimecheck", 1); DelayCommand(fdelay, SetLocalInt(OBJECT_SELF, "ntimecheck", 0)); DelayCommand(fdelay, ResetLockTrapInfo(OBJECT_SELF)); } } else { AssignCommand(GetArea(OBJECT_SELF), DelayCommand(fdelay, RespawnPLC(sResRefObject, lObject, fdelay))); } CTG_CreateSpecificBaseTypeTreasure(TREASURE_TYPE_UNIQUE, GetLastOpener(), OBJECT_SELF, TREASURE_BASE_TYPE_WEAPON); }