Aschbourne_PRC8/_module/nss/hb_battle.nss

20 lines
498 B
Plaintext
Raw Normal View History

2024-06-14 10:48:20 -04:00
/**
hb_battle
OnHeartbeat: Forces this NPC to stay close to a waypoint named DefensePoint
J.D. Robertson, 2002
*/
#include "i_battle"
void main()
{
// If too far from your defense point, run back to it
if (InBattle() &&
TooFarFrom("DefensePoint"))
{
object waypoint = GetNearestObjectByTag("DefensePoint");
ActionDoCommand(ActionForceMoveToObject(waypoint, TRUE, IntToFloat(d6())));
ActionDoCommand(SetFacing(GetFacing(waypoint)));
}
}