Battledale_PRC8/_module/nss/hc_track_start.nss
Jaysyn904 7b9e44ebbb Initial upload
Initial upload.  PRC8 has been added.  Module compiles, PRC's default AI & treasure scripts have been integrated.  Started work on top hak for SLA / Ability / Scripting modifications.
2024-03-11 23:44:08 -04:00

52 lines
1.5 KiB
Plaintext

// hc_track_start
// Starts tracking of creatures
// Archaegeo 17 Aug, 2002
#include "hc_inc_track"
#include "hc_text_track"
void main()
{
int nDC;
object oTracker=OBJECT_SELF;
//object oTrackPlc=GetNearestObjectByTag("Tracker");
//if(GetIsObjectValid(oTrackPlc))
nDC=10;
//if(!nDC || !GetIsObjectValid(oTrackPlc))
// {
// SendMessageToPC(oTracker,NOTPOSSIBLE);
// return;
// }
object oCritter;
object oArea=GetArea(oTracker);
int nLevel=GetLevelByClass(CLASS_TYPE_RANGER, oTracker);
int nCnt=1;
float fDistance;
int nDCAdj;
int nDCbyHD;
vector vCritter;
oCritter=GetNearestObject(OBJECT_TYPE_CREATURE, oTracker, nCnt);
while(GetIsObjectValid(oCritter) &&
GetArea(oCritter)==oArea)
{
fDistance=GetDistanceBetween(oCritter, oTracker);
nDCAdj=FloatToInt(fDistance/10.0);
nDCbyHD=GetHitDice(oCritter);
if((d20()+nLevel) > (nDC+nDCAdj+nDCbyHD) &&
(!GetLocalInt(oCritter,"NOTRACK") &&
!GetHasFeat(FEAT_TRACKLESS_STEP, oCritter)))
{
vCritter=GetPosition(oCritter);
AssignCommand(oTracker,SetFacingPoint (vCritter));
AssignCommand(oTracker,GetDirection(GetFacing(oTracker),oTracker,
oCritter));
}
nCnt++;
oCritter=GetNearestObject(OBJECT_TYPE_CREATURE, oTracker, nCnt);
}
/////Witch Wake: Added feedback to completion in case no creatures were found.
DelayCommand(0.5, SendMessageToPC(oTracker, "Tracking Completed."));
return;
}