Initial upload
Initial upload
This commit is contained in:
67
_module/nss/autorespawn.nss
Normal file
67
_module/nss/autorespawn.nss
Normal file
@@ -0,0 +1,67 @@
|
||||
//scriptname: autorespawn
|
||||
///////////////////////////////////////////
|
||||
//Created by: AW_Olorin (POA)
|
||||
//Modified by: Genisys
|
||||
///////////////////////////////////////////
|
||||
//Created On 8/02/08
|
||||
///////////////////////////////////////////
|
||||
//This script only respawns a placeable object
|
||||
//This goes in the On Death Event
|
||||
//This also goes in the OnOpen event if the
|
||||
//object has an inventory, if not
|
||||
//then this script goes in the On Used Event
|
||||
//
|
||||
//IMPORTANT:
|
||||
//The tagname of the placeable must be the
|
||||
//same as the resref name (not casesensitive)
|
||||
////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//IMPORTANT SETTING:
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//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
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Includes
|
||||
#include "NW_O2_CONINCLUDE"
|
||||
|
||||
//PROTOTYPE FUNCTION DEFINED
|
||||
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();
|
||||
//Always generate a low level treasure no matter what.
|
||||
GenerateLowTreasure(oLastOpener, OBJECT_SELF);
|
||||
SetLocalInt(OBJECT_SELF,"NW_DO_ONCE",1);
|
||||
|
||||
|
||||
//Note this only works for placeables
|
||||
location lLoc = GetLocation(OBJECT_SELF);
|
||||
string sTag = GetTag(OBJECT_SELF);
|
||||
int iType = GetObjectType(OBJECT_SELF);
|
||||
float fDelay = 60.0 * IntToFloat(nMinutes); // 30 Minute delay
|
||||
|
||||
AssignCommand(GetArea(OBJECT_SELF), DelayCommand(fDelay, RespawnObject(sTag, iType, lLoc)));
|
||||
|
||||
//very small delay to ensure the above command has time to function
|
||||
SetPlotFlag(OBJECT_SELF, FALSE);
|
||||
DestroyObject(OBJECT_SELF, 0.1f);
|
||||
|
||||
//End Script
|
||||
}
|
Reference in New Issue
Block a user