Files
HeroesStone_PRC8/_module/nss/areaload.nss
Jaysyn904 1eefc84201 Initial Commit
Initial Commit.
2025-09-14 15:40:46 -04:00

118 lines
4.3 KiB
Plaintext

#include "rl_include"
void main()
{
object oEntering=GetEnteringObject();
if(GetIsPC(oEntering))
{
if(!GetLocalInt(OBJECT_SELF,"Activated"))
{
//debugging
//int nDebug=0;
//while(nDebug<10)
//{
int nCurrentTime=TimeStamp();
object oTemp;
//Update the Factions that are used in this area
int nTemp=1;
while(GetLocalString(OBJECT_SELF,"DynamicFaction"+IntToString(nTemp))!="")
{
oTemp=GetObjectByTag(GetLocalString(OBJECT_SELF,"DynamicFaction"+IntToString(nTemp)));
/*if(GetLocalInt(oTemp,"LastTimeCheck")+1<nCurrentTime)
{
SetLocalInt(oTemp,"LastTimeCheck",nCurrentTime);
if(!GetIsDynamicFactionActive(oTemp))
{
ExecuteScript("dynfactionupdate",oTemp);
//DelayCommand(0.0,ExecuteScript("dynfactionupdate",oTemp));
//UpdateDynamicFaction(oTemp);
}
}*/
DynamicFactionGainPower(oTemp);
nTemp++;
}
SetLocalInt(OBJECT_SELF,"Activated",1);
float fDelayInterval=0.25;
float fDelay=fDelayInterval;
oTemp=GetFirstObjectInArea(OBJECT_SELF);
//Initialize placeables
while(oTemp!=OBJECT_INVALID)
{
if(GetLocalInt(oTemp,"Init"))
{
if(GetTag(oTemp)=="DynamicFactionSpawn")
//if(GetObjectType(oTemp)==OBJECT_TYPE_WAYPOINT)
{
if(GetLocalString(oTemp,"Trigger")!="")
{
DeleteLocalInt(oTemp,"Triggered");
}
else
{
DelayCommand(fDelay,ExecuteScript("dynfactionspawn",oTemp));
fDelay+=fDelayInterval;
}
}
else
{
if(GetLocalInt(oTemp,"AutoLock"))
{
SetLocked(oTemp,TRUE);
}
else if(GetLocalInt(oTemp,"AutoUnlock"))
{
SetLocked(oTemp,FALSE);
}
if(GetLocalInt(oTemp,"AutoClose"))
{
if(GetObjectType(oTemp)==OBJECT_TYPE_DOOR)
{
DoorClose(oTemp);
}
else
{
PlaceableClose(oTemp);
}
}
if(GetLocalInt(oTemp,"AutoOpen"))
{
if(GetObjectType(oTemp)==OBJECT_TYPE_DOOR)
{
DoorOpen(oTemp);
}
else
{
PlaceableOpen(oTemp);
}
}
if(GetLocalInt(oTemp,"AutoActivate"))
{
SetLocalInt(oTemp,"Activated",1);
}
else if(GetLocalInt(oTemp,"AutoDeactivate"))
{
SetLocalInt(oTemp,"Activated",0);
}
if(GetLocalInt(oTemp,"ConstantEffectVFX"))
{
DelayCommand(0.0,ConstantEffectOn(oTemp));
}
if(GetLocalInt(oTemp,"OnOff"))
{
if(GetLocalInt(oTemp,"Activated"))
{
DelayCommand(0.0,PlaceableActivate(oTemp));
}
}
}
}
oTemp=GetNextObjectInArea(OBJECT_SELF);
}
}
//Debug
//nDebug++;
//}
}
}