//scriptname: respawnuniqchest /////////////////////////////////////////// //Created by Guile //Some functions are from: AW_Olorin (POA) /////////////////////////////////////////// //Created On 8/02/08 /////////////////////////////////////////// //This script generates treasure and //respawns the chest automatically after //a set amount of time. (See below) //////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// //IMPORTANT SETTINGS: ////////////////////////////////////////////////////////////////////////////// //The # below represents a % chance of a unique item spawning //if the opener does not get this % they get a high level item instead. //Change the # below (default 20) to the % chance you want unique items spawned. const int nPercentChance = 20; //Determine how many minutes you want to pass before the treasure chest respawn //Enter 10 for 10 minute 30 for 30 minutes etc.. const int nMinutes = 30; //Default = 30 /////////////////////////////////////////////////////////////////////////////// //DO NOT TOUCH ANYTHING BELOW!! #include "NW_O2_CONINCLUDE" #include "x0_i0_treasure" //PROTOTYPE void RespawnObject(string sTag, int iType, location lLoc) { // ResRef Name must be derivable from Tag Name string sResRef = GetStringLowerCase(GetStringLeft(sTag, 16)); CreateObject(iType, sResRef, lLoc); } //Main script void main() { //Prevents spam looting. if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0) { return; } object oLastOpener = GetLastOpener(); SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1); ShoutDisturbed(); //Note this only works for placeables //Creatures use a different script, which is in the OnDeath Event //Do not touch this! float fMultiplier = 60.0 * IntToFloat(nMinutes); location lLoc = GetLocation(OBJECT_SELF); string sTag = GetTag(OBJECT_SELF); int iType = GetObjectType(OBJECT_SELF); float fDelay = fMultiplier; // 30 Minute delay //A fancy sunbeam effect OnOpen. ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_SUNBEAM), OBJECT_SELF); SetPlotFlag(OBJECT_SELF, FALSE); DestroyObject(OBJECT_SELF, 0.0); AssignCommand(GetArea(OBJECT_SELF), DelayCommand(fDelay, RespawnObject(sTag, iType, lLoc))); ///////////////Generic Treasure Generated On Open///////////// //Note this is the script for the unique treasure chest in the module //it was carefully configured due to too much treasure being handed out //The chest will only generate one Legendary item only, and a large sum of gold. //It will generate one high item as well, and if the PC is lucky 2 medium items if (!(CTG_GetIsTreasureGenerated(OBJECT_SELF))) { //Always generate Gold into the chest! //Always spawn gold into the chest.. //ADJUST This to your likings.. int nInt = d20(5);// 5-100 (The Multiplier of nXGp) int nXtra = nInt * 10; // 50 - 1,000 int nXGp = nInt * 200; // 1,000 - 20,000 Gold int nGP = nXGp + nXtra; //1,050 - 21,000 + 5-100 (Random #) //Gold Range CreateItemOnObject("nw_it_gold001", OBJECT_SELF, nGP); //Let's choose between one of 3 treasures, depending upon a % of the roll.. int bInt = d100(1); if(bInt