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

61 lines
1.5 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(4) == 0)
{
SendMessageToPC(oPC,"You hear a twig snap...");
iLevel = GetHitDice(oPC);
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 ) );
if (iLevel>25)
sTag = "fiend";
else if (iLevel>10)
sTag = "merc";
else
sTag = "bandit";
GetRaceCreatures(sTag,lLoc,iLevel,3);
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 ) );
GetRaceCreatures(sTag,lLoc,iLevel,3);
}
}
//This is to make the ambush spot a try-once-only spot
SetLocalInt(OBJECT_SELF,"Triggered",1);
}
}