EN4_PRC8/_module/nss/al1_portals.nss

62 lines
1.8 KiB
Plaintext
Raw Permalink Normal View History

void main()
{
int iRandom;
string sPortal1;
string sPortal2;
string sPortal3;
string sPortal4;
string sTag;
object oBoss;
location lLoc;
if (GetLocalInt(GetModule(),"ALPortals") == 0)
{
iRandom = Random(2) + 1;
if (iRandom == 1)
{
sPortal1 = "AL1_Teleport1";
SetLocalString(GetModule(),"ALPortal1",sPortal1);
sPortal2 = "AL1_Teleport2";
SetLocalString(GetModule(),"ALPortal2",sPortal2);
} else {
sPortal1 = "AL1_Teleport2";
SetLocalString(GetModule(),"ALPortal1",sPortal1);
sPortal2 = "AL1_Teleport1";
SetLocalString(GetModule(),"ALPortal2",sPortal2);
}
iRandom = Random(2) + 1;
if (iRandom == 1)
{
sPortal3 = "AL1_Teleport3";
SetLocalString(GetModule(),"ALPortal3",sPortal3);
sPortal4 = "AL1_Entrance";
SetLocalString(GetModule(),"ALPortal4",sPortal4);
} else {
sPortal3 = "AL1_Entrance";
SetLocalString(GetModule(),"ALPortal3",sPortal3);
sPortal4 = "AL1_Teleport3";
SetLocalString(GetModule(),"ALPortal4",sPortal4);
}
SetLocalInt(GetModule(),"ALPortals",1);
} else {
sPortal1 = GetLocalString(GetModule(),"ALPortal1");
sPortal2 = GetLocalString(GetModule(),"ALPortal2");
sPortal3 = GetLocalString(GetModule(),"ALPortal3");
sPortal4 = GetLocalString(GetModule(),"ALPortal4");
}
sTag = "AL1_C" + GetTag(OBJECT_SELF) + "_Boss_S";
//SendMessageToPC(GetEnteringObject(),"Boss Check: " + sTag);
oBoss = GetObjectByTag(sTag);
if (!GetIsObjectValid(oBoss))
{
sTag = GetLocalString(GetModule(),"ALPortal" + GetTag(OBJECT_SELF));
lLoc = GetLocation(GetObjectByTag(sTag));
//SendMessageToPC(GetEnteringObject(),"Jump to " + sTag);
AssignCommand(GetEnteringObject(),JumpToLocation(lLoc));
}
}