LoD_PRC8/_module/nss/onent_beamon.nss
Jaysyn904 94990edc60 Initial Upload
Initial Upload
2023-09-21 21:20:34 -04:00

76 lines
3.1 KiB
Plaintext

void main()
{
object oPC = GetEnteringObject();
if (GetIsPC(oPC) && !GetIsDM(oPC)) {
string sTag = GetTag(OBJECT_SELF);
string sBeam;
if (GetStringLength(sTag) == 13) {
// We turn on one matching beam
sBeam = GetStringRight(sTag, 6);
object oBeamSource = GetNearestObjectByTag("BeamSource_" + sBeam);
if (!GetLocalInt(oBeamSource, "BeamSetToOn")) {
SetLocalInt(oBeamSource, "BeamSetToOn", TRUE);
SetLocalInt(oBeamSource, "DoOnce", TRUE);
ExecuteScript("ud_beamtarget", oBeamSource);
}
} else if (GetStringLength(sTag) == 11) {
// We turn on all beams of same type
int nCountNum = 0;
string sCount;
string sType = GetStringRight(sTag, 4);
object oBeamSource= GetNearestObjectByTag("BeamSource_00" + sType);
while (GetIsObjectValid(oBeamSource)) {
if (!GetLocalInt(oBeamSource, "BeamSetToOn")) {
SetLocalInt(oBeamSource, "BeamSetToOn", TRUE);
SetLocalInt(oBeamSource, "DoOnce", TRUE);
ExecuteScript("ud_beamtarget", oBeamSource);
}
nCountNum++;
string sCount = IntToString(nCountNum);
if (nCountNum < 10) {
sCount = "0" + sCount;
}
oBeamSource = GetNearestObjectByTag("BeamSource_" + sCount + sType);
}
} else if (GetStringLength(sTag) == 10) {
// We turn on all beams in the area
int nCountNum = 1;
int nForCount;
string sCount;
object oBeamSource;
string sType;
for (nForCount = 0; nForCount <= 6; nForCount++) {
if (nForCount == 0) {
sType = "Cold";
} else if (nForCount == 1) {
sType = "Elec";
} else if (nForCount == 2) {
sType = "Evil";
} else if (nForCount == 3) {
sType = "Fire";
} else if (nForCount == 4) {
sType = "Holy";
} else if (nForCount == 5) {
sType = "Lash";
} else if (nForCount == 6) {
sType = "Mind";
}
oBeamSource = GetNearestObjectByTag("BeamSource_00" + sType);
while (GetIsObjectValid(oBeamSource)) {
if (!GetLocalInt(oBeamSource, "BeamSetToOn")) {
SetLocalInt(oBeamSource, "BeamSetToOn", TRUE);
SetLocalInt(oBeamSource, "DoOnce", TRUE);
ExecuteScript("ud_beamtarget", oBeamSource);
}
nCountNum++;
string sCount = IntToString(nCountNum);
if (nCountNum < 10) {
sCount = "0" + sCount;
}
oBeamSource = GetNearestObjectByTag("BeamSource_" + sCount + sType);
}
}
}
}
}