Jaysyn904 ee1dc35889 Initial Commit
Initial Commit
2025-04-03 10:29:41 -04:00

58 lines
1.7 KiB
Plaintext

// requires a waypoint with the tag wp_ followed by the area name at
// the entry and one with tag wp_ followed by area name & an e at exit
void Spawn(string ref, object wp)
{
int dcnt;
object creat;
//SpeakString("ref = " + ref, TALKVOLUME_SHOUT);
creat = CreateObject(OBJECT_TYPE_CREATURE, ref, GetLocation(wp), FALSE, "monster");
}
void main()
{
object oPC = GetEnteringObject();
int pcnt = 0;
int cnt;
object wp;
float delay = 0.5;
string tag, ref;
if (GetIsPC(oPC) != TRUE) return;
string atag = GetTag(OBJECT_SELF);
object tst = GetFirstPC();
while(tst != OBJECT_INVALID) {
if (atag == GetTag(GetArea(tst))) pcnt++;
tst = GetNextPC();
}
object mon = GetNearestObjectByTag("monster", oPC, cnt);
//SpeakString(GetName(mon) + " - " + IntToString(pcnt), TALKVOLUME_SHOUT);
if (pcnt == 1 && mon == OBJECT_INVALID) {
cnt = 1;
wp = GetNearestObject(OBJECT_TYPE_WAYPOINT, oPC, cnt);
while(wp != OBJECT_INVALID) {
tag = GetTag(wp);
//SpeakString("tag = " + tag, TALKVOLUME_SHOUT);
if (GetStringLeft(tag, 2) == "m_") {
ref = GetSubString(tag, 2, 20);
DelayCommand(delay, Spawn(ref, wp));
delay += 0.2;
}
cnt++;
wp = GetNearestObject(OBJECT_TYPE_WAYPOINT, oPC, cnt);
}
cnt = 1;
object door = GetNearestObject(OBJECT_TYPE_DOOR, oPC, cnt);
while(door != OBJECT_INVALID) {
tag = GetTag(door);
//SpeakString("tag = " + tag, TALKVOLUME_SHOUT);
if (tag == "killdoor") {
SetLocked(door, TRUE);
}
cnt++;
door = GetNearestObject(OBJECT_TYPE_DOOR, oPC, cnt);
}
}
}