HoS_PRC8/_mod/_module/nss/atsea_moving.nss
Jaysyn904 04165202c0 Initial upload
Initial upload
2024-11-25 19:36:07 -05:00

99 lines
3.2 KiB
Plaintext

///////////////////////////////////////////////////////////////////////////////
// Things Moving in the water
///////////////////////////////////////////////////////////////////////////////
void fnMonitor(object oArea,object oPC)
{
int nPort=GetLocalInt(oArea,"nPort");
int nStarboard=GetLocalInt(oArea,"nStarboard");
object oPort=GetLocalObject(oArea,"oPort");
object oStarboard=GetLocalObject(oArea,"oStarboard");
string sIce="x0_icefloe";
string sReed="x0_reeds";
string sDust="plc_dustplume";
string sRes;
object oWP;
int nR;
if (GetArea(oPC)==oArea) DelayCommand(5.0,fnMonitor(oArea,oPC));
if (oPort==OBJECT_INVALID)
{ // maybe create moving object
nR=d100();
if (nR<34)
{ // create
nR=d100();
if (nR<67) sRes=sIce;
else if (nR<91) sRes=sDust;
else { sRes=sReed; }
} // create
oWP=GetNearestObjectByTag("ASP1_1",oPC,1);
oPort=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP));
DelayCommand(10.0,DestroyObject(oPort));
SetLocalObject(oArea,"oPort",oPort);
SetLocalInt(oArea,"nPort",0);
} // maybe create moving object
if (oStarboard==OBJECT_INVALID)
{ // maybe create moving object
nR=d100();
if (nR<34)
{ // create
nR=d100();
if (nR<67) sRes=sIce;
else if (nR<91) sRes=sDust;
else { sRes=sReed; }
} // create
oWP=GetNearestObjectByTag("ASS1_1",oPC,1);
oStarboard=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP));
DelayCommand(10.0,DestroyObject(oStarboard));
SetLocalObject(oArea,"oStarboard",oStarboard);
SetLocalInt(oArea,"nStarboard",0);
} // maybe create moving object
if (oPort!=OBJECT_INVALID)
{ // move it
if (nPort==0)
{ // do nothing but, advance
SetLocalInt(oArea,"nPort",1);
} // do nothing but, advance
else
{ // next
nPort=nPort+1;
oWP=GetNearestObjectByTag("ASP1_"+IntToString(nPort),oPC,1);
sRes=GetResRef(oPort);
DestroyObject(oPort);
if (nPort!=6)
{ // create next - simulate movement
oPort=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP));
DelayCommand(10.0,DestroyObject(oPort));
SetLocalObject(oArea,"oPort",oPort);
SetLocalInt(oArea,"nPort",nPort);
} // create next - simulate movement
} // next
} // move it
if (oStarboard!=OBJECT_INVALID)
{ // move it
if (nStarboard==0)
{ // do nothing but, advance
SetLocalInt(oArea,"nStarboard",1);
} // do nothing but, advance
else
{ // next
nStarboard=nStarboard+1;
oWP=GetNearestObjectByTag("ASS1_"+IntToString(nStarboard),oPC,1);
sRes=GetResRef(oStarboard);
DestroyObject(oStarboard);
if (nStarboard!=6)
{ // create next - simulate movement
oStarboard=CreateObject(OBJECT_TYPE_PLACEABLE,sRes,GetLocation(oWP));
DelayCommand(10.0,DestroyObject(oStarboard));
SetLocalObject(oArea,"oStarboard",oStarboard);
SetLocalInt(oArea,"nStarboard",nStarboard);
} // create next - simulate movement
} // next
} // move it
}
void main()
{
object oArea=OBJECT_SELF;
object oPC=GetEnteringObject();
if (GetIsPC(oPC)==TRUE) fnMonitor(oArea,oPC);
}