/** 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))); } }