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

56 lines
1.4 KiB
Plaintext

#include "rd_spawnzones"
void main()
{
object oPC;
vector vPC;
vector vNew;
location lLoc;
int iRndX;
int iRndY;
int iLevel;
string sTag;
oPC = GetEnteringObject();
if (GetIsPC(oPC))
{
if (GetLocalInt(OBJECT_SELF,"Triggered") == 0)
{
if (Random(20) == 0)
{
SendMessageToPC(oPC,"You hear a twig snap...");
iLevel = GetHitDice(oPC);
iLevel = ZoneLevel(GetArea(oPC),iLevel);
SetLocalInt(OBJECT_SELF,"Triggered",1);
vPC = GetPosition(oPC);
iRndX = Random(6) + 4;
iRndY = Random(6) + 4;
if (Random(2) == 1) iRndX=iRndX * -1;
if (Random(2) == 1) iRndY=iRndY * -1;
vNew = vPC + Vector( iRndX/1.0, iRndY/1.0, 0.0 );
lLoc = Location(GetArea(oPC), vNew, VectorToAngle( -1.0 * vNew ) );
sTag = "EN4_BSCORP";
CreateObject(OBJECT_TYPE_CREATURE,sTag,lLoc);
CreateObject(OBJECT_TYPE_CREATURE,sTag,lLoc);
vPC = GetPosition(oPC);
iRndX = Random(6) + 4;
iRndY = Random(6) + 4;
if (Random(2) == 1) iRndX=iRndX * -1;
if (Random(2) == 1) iRndY=iRndY * -1;
vNew = vPC + Vector( iRndX/1.0, iRndY/1.0, 0.0 );
lLoc = Location(GetArea(oPC), vNew, VectorToAngle( -1.0 * vNew ) );
CreateObject(OBJECT_TYPE_CREATURE,sTag,lLoc);
}
}
}
}