MMD_PRC8/_module/nss/spawn.nss
Jaysyn904 adeff59f82 Initial commit
Initial commit.
2024-08-02 23:18:00 -04:00

128 lines
5.8 KiB
Plaintext

void main()
{
object oPC = GetEnteringObject();
int iLevel = GetHitDice(oPC);
if (iLevel>20) iLevel=20;
string sLevel = IntToString(iLevel);
string sMytag;
int iType;
location lMyloc;
int iNum;
string sNum;
string sPtag;
int iSix;
string sSix;
if (GetIsPC(oPC) != TRUE) return;
object oSpawn = GetFirstObjectInArea(OBJECT_SELF);
//SendMessageToPC(oPC,"get first wp");
int iSpawn = GetLocalInt(oSpawn,"done");
int iKind = GetObjectType(oSpawn);
while (oSpawn != OBJECT_INVALID)
{
int iKind = GetObjectType(oSpawn);
if (iSpawn != 1 && iKind == OBJECT_TYPE_WAYPOINT)
{
string sWTF = GetTag(oSpawn);
//SendMessageToPC(oPC,"tag is "+sWTF);
SetLocalInt(oSpawn,"done",1);
//SendMessageToPC(oPC,"spawning stuff");
sMytag = GetTag(oSpawn)+sLevel;
sPtag = GetTag(oSpawn);
iType = StringToInt(GetStringLeft(sMytag,1));
lMyloc = GetLocation(oSpawn);
iNum = d10(1);
sNum = IntToString(Random(40)+1);
iSix = d6();
sSix = IntToString(iSix);
switch (iType)
{
case 1:
switch (iNum)
{
case 1:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"m",lMyloc);
break;
case 2:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"m",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"m",lMyloc);
break;
case 3:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"m",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"m",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"m",lMyloc);
break;
case 4:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
break;
case 5:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
break;
case 6:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
break;
case 7:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
break;
case 8:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
break;
case 9:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
break;
case 10:
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"h_alt",lMyloc);
CreateObject(OBJECT_TYPE_CREATURE,sMytag+"b",lMyloc);
break;
}
//CreateObject(OBJECT_TYPE_CREATURE,sMytag,lMyloc);
break;
case 2:
CreateObject(OBJECT_TYPE_PLACEABLE,sPtag+sNum,lMyloc);//interactive placeables
break;
case 3:
CreateObject(OBJECT_TYPE_PLACEABLE,sPtag+sNum,lMyloc);//mundane placeables
break;
case 4:
CreateObject(OBJECT_TYPE_ITEM,sMytag+"_"+sSix,lMyloc);//loose items
break;
case 5:
CreateObject(OBJECT_TYPE_CREATURE,sPtag+sNum,lMyloc);//special encounters
break;
case 6:
CreateObject(OBJECT_TYPE_PLACEABLE,sMytag,lMyloc);//treasure chests
break;
}
}
oSpawn = GetNextObjectInArea(OBJECT_SELF);
iSpawn = GetLocalInt(oSpawn,"done");
//SendMessageToPC(oPC,"get next wp");
}
}