PoA_PRC8/_module/nss/trap_respawner01.nss
Jaysyn904 bfbbd2f1ac Major update
Added several new undead models & facelifted overrides for other models.  Added dozens of new undead creatures from Libris Mortis & the monster manuals.  Added CODI Core AI.  Added NESS spawner system.  Added randomized respawning trap system.  Added undead feeding system.  Greatly revamped Catacombs & Halls of the Dead.  Updated nimtools.  Full compile.  Updated release archive.
2024-04-07 01:06:57 -04:00

51 lines
1.3 KiB
Plaintext

//An example OnHB script for an invisible placeable to spawn a ground trap
#include "prc_alterations"
#include "prgt_inc"
void main()
{
//:: Declare major variables
int nTotalPCs;
int nTotalPCLevel;
int nAveragePCLevel;
object oArea = GetArea(OBJECT_SELF);
//:: Cycle through PCs in Area
object oPC = GetFirstObjectInArea(oArea);
while (oPC != OBJECT_INVALID)
{
if (GetIsPC(oPC) == TRUE || GetIsPC(GetMaster(oPC)) == TRUE) //:: Summons & henchmen should count towards this.
{
nTotalPCs++;
nTotalPCLevel = nTotalPCLevel + GetHitDice(oPC);
}
oPC = GetNextObjectInArea(oArea);
}
if (nTotalPCs > 0)
{
nAveragePCLevel = nTotalPCLevel / nTotalPCs;
}
else
{
nAveragePCLevel = 3;
}
struct trap tTrap;
//add code in here to change things if you want to
//for example, to set the detect DC to be 23 use:
//tTrap.nDetectDC = 23;
//tTrap.nDisarmDC = 27;
tTrap.nCR = nAveragePCLevel + 5;
tTrap.nRespawnSeconds = 600; //will respawn after 10 minutes
tTrap.nRespawnRandomCR = tTrap.nCR ; //will rerandomize the trap each time its respawned
tTrap.sDisarmScript = "ema_xp4trap_dis";
//:: This will use tTrap.nCR as the CR for the trap
tTrap = CreateRandomTrap(tTrap.nCR);
PRGT_CreateTrapAtLocation(GetLocation(OBJECT_SELF), tTrap);
DestroyObject(OBJECT_SELF);
}