42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
/************************************************************************
|
|
* script name : eE_OnAreaEnter
|
|
* created by : eyesolated
|
|
* date : 2011/6/1
|
|
*
|
|
* description : eE's OnAreaEnter Script keeps track of current players
|
|
* in the Area.
|
|
*
|
|
* changes : 2010/6/1 - eyesolated - Initial creation
|
|
************************************************************************/
|
|
#include "ee_inc"
|
|
|
|
void main()
|
|
{
|
|
object oArea = OBJECT_SELF;
|
|
object oPC = GetEnteringObject();
|
|
|
|
// If not a valid PC, exit!
|
|
if (!eE_GetIsPC(oPC))
|
|
return;
|
|
|
|
// Remember that the player entered this area
|
|
SetLocalObject(oPC, eE_VAR_PC_CURRENT_AREA, oArea);
|
|
|
|
int n = 1;
|
|
object oEncounter = GetNearestObject(OBJECT_TYPE_STORE, oPC, n);
|
|
|
|
// Increase player count for this area
|
|
SetLocalInt(oArea, eE_VAR_AREA_PLAYERCOUNT, GetLocalInt(oArea, eE_VAR_AREA_PLAYERCOUNT) + 1);
|
|
|
|
while (GetIsObjectValid(oEncounter))
|
|
{
|
|
if (GetLocalInt(oEncounter, eE_VAR_ENCOUNTER_AUTOINI) == eE_ENCOUNTER_AUTOINI_ENABLED)
|
|
{
|
|
// Initialize this Encounter
|
|
ExecuteScript(eE_SCRIPT_ENCOUNTER_INITIALIZE, oEncounter);
|
|
}
|
|
n++;
|
|
oEncounter = GetNearestObject(OBJECT_TYPE_STORE, oPC, n);
|
|
}
|
|
}
|