REO-EE/_module/nss/dungeonheart4.nss
Jaysyn904 f82740bbbd Initial commit
Initial commit
2024-02-22 13:22:03 -05:00

570 lines
9.0 KiB
Plaintext

//Script made by Drakaden
object oPC;
object oPC2;
object oPC3;
object oObjectInArea1;
object oNPC = OBJECT_SELF;
object oChests;
object oGear;
object oSpawnTarget1;
object oMonsters;
object oObject1;
location lLocation;
location lWarp;
vector vVector1;
int iIdentification1;
int iIdentification2;
int iIdentification3;
int iIdentification4;
int iRoll1;
int iRoll2;
int iNumber;
int iSpawnPoints1;
int iHighestPlayerInArea1;
int iNameType1;
string sTemplate;
string sTemplate2;
void SpawnMonster1()
{
iSpawnPoints1 = 0;
iHighestPlayerInArea1 = 0;
iNumber = 3; //Add 1 because it goes from 0 to (# -1)
iRoll1 = Random(iNumber);
while (iRoll1 == 0 ||
iRoll1 >= iNumber)
{
iRoll1 = Random(iNumber);
}
switch (iRoll1)
{
case 1:
sTemplate = "nw_zombie01";
break;
case 2:
sTemplate = "nw_zombie01";
break;
/*
case 3:
sTemplate = "bountyhunter001";
break;
case 4:
sTemplate = "bountyhunter002";
break;
case 5:
sTemplate = "bountyhunter003";
break;
case 6:
sTemplate = "bountyhunter004";
break;
case 7:
sTemplate = "catburglar1";
break;
case 8:
sTemplate = "catburglar2";
break;
case 9:
sTemplate = "catburglartra001";
break;
case 10:
sTemplate = "catburglartra002";
break;
case 11:
sTemplate = "huntwolf001";
break;
case 12:
sTemplate = "huntbear001";
break;
case 13:
sTemplate = "huntpolarbear001";
break;
case 14:
sTemplate = "cavespider001";
break;
case 15:
sTemplate = "zombie002";
break;
case 16:
sTemplate = "goblinmounted001";
break;
case 17:
sTemplate = "zombie001";
break;
case 18:
sTemplate = "agreenlizardfolk";
break;
case 19:
sTemplate = "aredlizardfol001";
break;
case 20:
sTemplate = "frenziedwolf001";
break;
case 21:
sTemplate = "orc002";
break;
case 22:
sTemplate = "vampirebat001";
break;
case 23:
sTemplate = "goblin002";
break;
case 24:
sTemplate = "goblin003";
break;
case 25:
sTemplate = "goblin004";
break;
case 26:
sTemplate = "goblin005";
break;
case 27:
sTemplate = "goblin1";
break;
case 28:
sTemplate = "kobold001";
break;
case 29:
sTemplate = "kobold002";
break;
case 30:
sTemplate = "kobold003";
break;
case 31:
sTemplate = "kobold004";
break;
case 32:
sTemplate = "kobold005";
break;
case 33:
sTemplate = "aronkon001";
break;
case 34:
sTemplate = "frenziedwolf002";
break;
case 35:
sTemplate = "zombie003";
break;
case 36:
sTemplate = "agreenlizardf001";
break;
case 37:
sTemplate = "aredlizardfol002";
break;
case 38:
sTemplate = "koboldbomber001";
break;
case 39:
sTemplate = "anevilcultist002";
break;
case 40:
sTemplate = "anevilcultist1";
break;
case 41:
sTemplate = "undeadpaladin001";
break;
case 42:
sTemplate = "ahunter002";
break;
case 43:
sTemplate = "ahunter1";
break;
case 44:
sTemplate = "orc007";
break;
case 45:
sTemplate = "orc001";
break;
case 46:
sTemplate = "orc003";
break;
case 47:
sTemplate = "orc004";
break;
case 48:
sTemplate = "orc013";
break;
case 49:
sTemplate = "orc014";
break;
case 50:
sTemplate = "troll001";
break;
case 51:
sTemplate = "hobgoblin001";
break;
case 52:
sTemplate = "apokolin001";
break;
case 53:
sTemplate = "agreenlizardf002";
break;
case 54:
sTemplate = "ogre002";
break;
case 55:
sTemplate = "ogre001";
break;
case 56:
sTemplate = "aredlizardfol004";
break;
case 57:
sTemplate = "slaver001";
break;
case 58:
sTemplate = "slaver002";
break;
case 59:
sTemplate = "lavafish1";
break;
case 60:
sTemplate = "pirate1";
break;
case 61:
sTemplate = "pirate2";
break;
case 62:
sTemplate = "ogre001";
break;
case 63:
sTemplate = "ogre002";
break;
case 64:
sTemplate = "ogre004";
break;
case 65:
sTemplate = "aredlizardfol003";
break;
case 66:
sTemplate = "undeadcat1";
break;
case 67:
sTemplate = "agreenlizardf004";
break;
case 68:
sTemplate = "agreenlizardf005";
break;
case 69:
sTemplate = "aredlizardfol006";
break;
case 70:
sTemplate = "aredlizardfol005";
break;
case 71:
sTemplate = "darkknight002";
break;
case 72:
sTemplate = "darkknight1";
break;
*/
}
oObjectInArea1 = GetFirstObjectInArea(oNPC);
while (GetIsObjectValid(oObjectInArea1))
{
if (GetIsPC(oObjectInArea1) &&
!GetIsDM(oObjectInArea1))
{
if (iHighestPlayerInArea1 < GetHitDice(oObjectInArea1))
{
iHighestPlayerInArea1 = GetHitDice(oObjectInArea1);
}
oPC = oObjectInArea1;
}
if (FindSubString(GetTag(oObjectInArea1), "quest1_monsterspawnpoint") != -1)
{
iSpawnPoints1 = (iSpawnPoints1 + 1);
}
oObjectInArea1 = GetNextObjectInArea(oNPC);
}
iRoll2 = (Random(iSpawnPoints1) + 1);
lLocation = GetLocation(GetNearestObjectByTag("quest1_monsterspawnpoint" + IntToString(iRoll2) + "", oPC));
oMonsters = GetFirstObjectInArea(oNPC);
SetLocalInt(oNPC, "NumberOfMonsters1", 0);
while (GetIsObjectValid(oMonsters))
{
if (GetObjectType(oMonsters) == OBJECT_TYPE_CREATURE &&
!GetIsPC(oMonsters) &&
!GetIsDM(oMonsters) &&
GetMaster(oMonsters) == OBJECT_INVALID)
{
SetLocalInt(oNPC, "NumberOfMonsters1", GetLocalInt(oNPC, "NumberOfMonsters1") + 1);
}
oMonsters = GetNextObjectInArea(oNPC);
}
if (GetLocalInt(oNPC, "NumberOfMonsters1") < 15)
{
//SendMessageToAllDMs("SpawnMonster1 activated, (Max of spawns) NumberOfMonsters1 = " + IntToString(GetLocalInt(oNPC, "NumberOfMonsters1")) + ".");
oSpawnTarget1 = CreateObject(OBJECT_TYPE_CREATURE, sTemplate, lLocation, TRUE);
SetLocalInt(oSpawnTarget1, "Quest1RandomMonster1", 1);
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_DWARF &&
GetGender(oSpawnTarget1) == GENDER_FEMALE)
{
iNameType1 = NAME_FIRST_DWARF_FEMALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_DWARF &&
GetGender(oSpawnTarget1) == GENDER_MALE)
{
iNameType1 = NAME_FIRST_DWARF_MALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_ELF &&
GetGender(oSpawnTarget1) == GENDER_FEMALE)
{
iNameType1 = NAME_FIRST_ELF_FEMALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_ELF &&
GetGender(oSpawnTarget1) == GENDER_MALE)
{
iNameType1 = NAME_FIRST_ELF_MALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_GNOME &&
GetGender(oSpawnTarget1) == GENDER_FEMALE)
{
iNameType1 = NAME_FIRST_GNOME_FEMALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_GNOME &&
GetGender(oSpawnTarget1) == GENDER_MALE)
{
iNameType1 = NAME_FIRST_GNOME_MALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HALFELF &&
GetGender(oSpawnTarget1) == GENDER_FEMALE)
{
iNameType1 = NAME_FIRST_HALFELF_FEMALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HALFELF &&
GetGender(oSpawnTarget1) == GENDER_MALE)
{
iNameType1 = NAME_FIRST_HALFELF_MALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HALFLING &&
GetGender(oSpawnTarget1) == GENDER_FEMALE)
{
iNameType1 = NAME_FIRST_HALFLING_FEMALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HALFLING &&
GetGender(oSpawnTarget1) == GENDER_MALE)
{
iNameType1 = NAME_FIRST_HALFLING_MALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HALFORC &&
GetGender(oSpawnTarget1) == GENDER_FEMALE)
{
iNameType1 = NAME_FIRST_HALFORC_FEMALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HALFORC &&
GetGender(oSpawnTarget1) == GENDER_MALE)
{
iNameType1 = NAME_FIRST_HALFORC_MALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HUMAN &&
GetGender(oSpawnTarget1) == GENDER_FEMALE)
{
iNameType1 = NAME_FIRST_HUMAN_FEMALE;
}
else
if (GetRacialType(oSpawnTarget1) == RACIAL_TYPE_HUMAN &&
GetGender(oSpawnTarget1) == GENDER_MALE)
{
iNameType1 = NAME_FIRST_HUMAN_MALE;
}
else
{
iNameType1 = NAME_FIRST_GENERIC_MALE;
}
SetName(oSpawnTarget1, RandomName(iNameType1));
ChangeToStandardFaction(oSpawnTarget1, STANDARD_FACTION_HOSTILE);
/*
if ((GetHitDice(oSpawnTarget1) + 2) > iHighestPlayerInArea1 &&
iHighestPlayerInArea1 >= 1 ||
iHighestPlayerInArea1 - (GetHitDice(oSpawnTarget1)) >= 5 &&
iHighestPlayerInArea1 >= 1)
{
SetImmortal(oSpawnTarget1, FALSE);
SetPlotFlag(oSpawnTarget1, FALSE);
AssignCommand(oSpawnTarget1, SetIsDestroyable(TRUE, FALSE, FALSE));
DestroyObject(oSpawnTarget1, 0.1);
SpawnMonster1();
}
*/
}
}
void main()
{
oPC = GetFirstPC();
SetLocalInt(oNPC, "NumberOfPlayersInArea1", 0);
iRoll1 = -1;
while (GetIsObjectValid(oPC))
{
if (GetArea(oPC) == oNPC &&
!GetIsDM(oPC))
{
SetLocalInt(oNPC, "NumberOfPlayersInArea1", GetLocalInt(oNPC, "NumberOfPlayersInArea1") + 1);
}
oPC = GetNextPC();
}
if (GetLocalInt(oNPC, "NumberOfPlayersInArea1") >= 1)
{
SpawnMonster1();
}
else
if (GetLocalInt(oNPC, "NumberOfPlayersInArea1") <= 0)
{
//SendMessageToAllDMs("Must REMOVE creatures portals and chests...");
oChests = GetFirstObjectInArea(oNPC);
while (GetIsObjectValid(oChests))
{
//SendMessageToAllDMs("Examining while there 0 players in the area... " + GetName(oChests) + ".");
if (GetObjectType(oChests) == OBJECT_TYPE_PLACEABLE &&
GetName(oChests) == "Remains")
{
oObject1 = GetFirstItemInInventory(oChests);
while (GetIsObjectValid(oObject1))
{
DelayCommand(0.1f, DestroyObject(oObject1));
oObject1 = GetNextItemInInventory(oChests);
}
DestroyObject(oChests);
}
if (GetObjectType(oChests) == OBJECT_TYPE_CREATURE &&
!GetIsPC(oChests) &&
!GetIsDM(oChests))
{
SetImmortal(oChests, FALSE);
SetPlotFlag(oChests, FALSE);
AssignCommand(oChests, SetIsDestroyable(TRUE, FALSE, FALSE));
DestroyObject(oChests);
//SendMessageToAllDMs("Deleting creature... " + GetName(oChests) + ".");
}
oChests = GetNextObjectInArea(oNPC);
}
}
}