//scriptname: respawnhigh /////////////////////////////////////// //Original Creator: AW_Olorin //Modified by Guile 8/02/08 /////////////////////////////////////// // //This script generates treasure and //respawns the chest automatically after //a set amount of time. (See below) ///////////////////////////////////////////////////// //NOTE: I this script is almost identical to the respawnmed script, however //the % chance of a high level item spawning should be much higher!! /////////////////////////////////////////////////////////////////////////////// //IMPORTANT SETTINGS: ////////////////////////////////////////////////////////////////////////////// //The # below represents a % chance of a High level item spawning //if the opener does not get this % they get a Medium level item instead. //Change the # below (default 40) to the % chance you want unique items spawned. const int nPercentChance = 40; //40% //Determine how many minutes you want to pass before the treasure chest respawn //Enter 10 for 10 minute or 30 for 30 minutes, etc.. const int nMinutes = 30; //Default = 30 minutes /////////////////////////////////////////////////////////////////////////////// //DO NOT TOUCH ANYTHING BELOW!! #include "NW_O2_CONINCLUDE" #include "x0_i0_treasure" 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); } void main() { //Prevents spam looting. if (GetLocalInt(OBJECT_SELF,"NW_DO_ONCE") != 0) { return; } object oLastOpener = GetLastOpener(); //GenerateLowTreasure(oLastOpener, OBJECT_SELF); SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1); ShoutDisturbed(); 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); //Note this only works for placeables //Creatures use a different script, which is in the OnDeath Event AssignCommand(GetArea(OBJECT_SELF), DelayCommand(fDelay, RespawnObject(sTag, iType, lLoc))); /////////////////////////////////////////////////////////// //Special treasure system.. ExecuteScript("gen_geg_treas", OBJECT_SELF); //////////////GENERATE GENERIC TREASURE//////////////////// //Do not touch this line below as it's necessary! if (!(CTG_GetIsTreasureGenerated(OBJECT_SELF))) { //Let's choose between one of 3 treasures, depending upon a % of the roll.. int bInt = d100(1); //Roll a d6 dice then determine which treasure table(s) to use.. //% Chance of the High level item spawning (set above!) if(bInt