EN4_PRC8/_module/nss/htca_enter.nss
Jaysyn904 b464d8da05 Initial Commit
Initial Commit [v1.32PRC8]
2025-04-03 13:38:45 -04:00

113 lines
2.3 KiB
Plaintext

#include "rd_questinc"
void ArenaLevelUp(object oCreature, int iLevelUp);
void CleanArena();
void RemoveLootFromRemains(object oContainer);
void main()
{
object oPC;
object oCreature;
int iLevel;
int iRandom;
int iLevelUp;
location lLoc;
string sTag;
CleanArena();
oPC = GetPCSpeaker();
iLevel = Random(3) + GetHitDice(oPC) - 1;
SetPartyInt(oPC,"HTCArena",1);
iRandom = Random(3)+1;
sTag = "HTCA_Spawn" + IntToString(iRandom);
lLoc = GetLocation(GetObjectByTag(sTag));
iRandom = Random(6)+1;
iLevelUp = TRUE;
switch (iRandom)
{
case 1: sTag = "en4_hostilefig2"; break;
case 2: sTag = "en4_hostilemonk2"; break;
case 3: sTag = "en4_hostileclr2"; break;
case 4: sTag = "en4_hostilewiz2"; break;
case 5: sTag = "en4_hostilefig2"; break;
case 6: sTag = "en4_hostilemonk2"; break;
}
oCreature=CreateObject(OBJECT_TYPE_CREATURE,sTag,lLoc,FALSE);
if (iLevelUp == TRUE && iLevel-1 >1)
ArenaLevelUp(oCreature,iLevel-1);
lLoc = GetLocation(GetObjectByTag("HTCA_Enter"));
AssignCommand(oPC,JumpToLocation(lLoc));
}
void ArenaLevelUp(object oCreature, int iLevelUp)
{
object oItem;
LevelMob(oCreature,iLevelUp);
EquipMob(oCreature);
oItem = GetFirstItemInInventory(oCreature);
while (GetIsObjectValid(oItem))
{
SetDroppableFlag(oItem,FALSE);
oItem = GetNextItemInInventory(oCreature);
}
}
void CleanArena()
{
object oCreature;
object oArea;
string sTag;
sTag = "HTCA_Spawn1";
oArea = GetArea(GetObjectByTag(sTag));
oCreature = GetFirstObjectInArea(oArea);
while (GetIsObjectValid(oCreature))
{
if (GetObjectType(oCreature) == OBJECT_TYPE_CREATURE && !GetIsPC(oCreature) && !GetIsPC(GetMaster(oCreature)))
{
//SendMessageToPC(GetFirstPC(),"Trying to Destroy " + GetName(oCreature));
AssignCommand(oCreature,SetIsDestroyable(TRUE));
DestroyObject(oCreature,0.1f);
}
if (GetName(oCreature) == "Remains")
{
RemoveLootFromRemains(oCreature);
DestroyObject(oCreature);
}
oCreature = GetNextObjectInArea(oArea);
}
}
void RemoveLootFromRemains(object oContainer)
{
object oItem;
object oLastItem;
int iFlag;
int iDeleteFlag;
iFlag = 0;
oItem = GetFirstItemInInventory(oContainer);
while (iFlag == 0)
{
DestroyObject(oItem);
oLastItem = oItem;
oItem = GetNextItemInInventory(oContainer);
if (oLastItem == oItem)
iFlag = 1;
}
}