generated from Jaysyn/ModuleTemplate
Initial upload
Initial upload.
This commit is contained in:
68
_module/nss/area_clean_inc.nss
Normal file
68
_module/nss/area_clean_inc.nss
Normal file
@@ -0,0 +1,68 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Area_Clean_Inc
|
||||
//:: Copyright (c) 2004 Indigo-Red
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
Designed to clean the area when no players are present.
|
||||
Functions/scripts contained here are used as follows for the Area:
|
||||
|
||||
OnEnter: [CheckForPC()]
|
||||
- Keeps track of the number of players in the area
|
||||
OnExit: [TimerCheck()]
|
||||
- Checks to see if any players remain in the area
|
||||
- Starts cleanup process when no PC is present
|
||||
* In addition the following script is needed:
|
||||
OnUserDefined: "area_clean_usr"
|
||||
- Performs the actual clearing of the area
|
||||
|
||||
NOTE: The first two are presented as functions so that they can
|
||||
be easily incorporated with any existing area scripts.
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//:: Created By: Johnnie "Nekyia" Casiano
|
||||
//:: Created On: 20040208
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
// **** FUNCTION DECLARATIONS
|
||||
|
||||
// Function is used to keep track of the number of players present in the area
|
||||
// Ex: (As part of the Area's OnEnter) CheckForPC(GetEnteringObject());
|
||||
void CheckForPC(object PC, object Area=OBJECT_SELF);
|
||||
|
||||
// Function makes sure no PCs are left in the area before starting the clean timer
|
||||
// Ex: (As part of the Area's OnExit) TimerCheck(GetExitingObject());
|
||||
void TimerCheck(object PC, object Area=OBJECT_SELF);
|
||||
|
||||
|
||||
// **** CUSTOM FUNCTIONS
|
||||
void CheckForPC(object PC, object Area=OBJECT_SELF)
|
||||
{
|
||||
if(!GetIsPC(PC)||GetIsDM(PC)){return;}
|
||||
|
||||
object Last=GetLocalObject(PC,"Area");
|
||||
//SendMessageToPC(PC,"Last Area: "+GetName(Last));
|
||||
if(Last==Area){
|
||||
int Count=GetLocalInt(Area,"PCCount");
|
||||
//SendMessageToPC(PC,"Last Area Same. Count: "+IntToString(Count));
|
||||
return;
|
||||
}
|
||||
int Count=GetLocalInt(Area,"PCCount")+1;
|
||||
SetLocalInt(Area,"PCCount",Count);
|
||||
SetLocalObject(PC,"Area",Area);
|
||||
//SendMessageToPC(PC,"Area Set To: "+GetName(GetLocalObject(PC,"Area")));
|
||||
//SendMessageToPC(PC,GetName(Area)+" Count: "+IntToString(GetLocalInt(Area,"PCCount")));
|
||||
}
|
||||
|
||||
void TimerCheck(object PC, object Area=OBJECT_SELF)
|
||||
{
|
||||
if(!GetIsPC(PC)||GetIsDM(PC)){return;}
|
||||
int Count=GetLocalInt(Area,"PCCount")-1;
|
||||
int Timer=GetLocalInt(Area,"Timer");
|
||||
if(Count==0 && Timer==0){
|
||||
SetLocalInt(Area,"Timer",1);
|
||||
SignalEvent(Area,EventUserDefined(69));
|
||||
//SendMessageToPC(PC,"Cleanup check signal sent for "+GetName(Area));
|
||||
}
|
||||
SetLocalInt(Area,"PCCount",Count);
|
||||
//SendMessageToPC(PC,GetName(Area)+"PC Count: "+IntToString(Count));
|
||||
}
|
||||
Reference in New Issue
Block a user