Skip to content

KAI_MoveAway()

inkoalawetrust edited this page Sep 15, 2023 · 5 revisions

KAI_MoveAway (Actor Other[, Int Attempts = 32, Double RunRad = 128, Int MaxSteps = 32, Double DetourFactor = 1.0, Double AngleLimit = 10, Int ChaseFlags = 0, Int Flags = 0])

Parameters:

  • Other: The actor to run away from.
  • Attempts: How many positions to try per next position picked. Default is 32.
  • RunRad: The radius around which to find a viable position to run away to. Default is 128 map units.
  • MaxSteps: How many steps the actor is allowed to take before having to find a new position to move away to. Default is 32.
  • DetourFactor, AngleLimit, ChaseFlags, Flags: These parameters work the same as in KAI_MoveTowards()
  • KMAFlags: Passes flags exclusive to this function like
    • KMA_STRAIGHT: The NPC will move away from Other in a straight line instead of picking a random position furthest away from Other.
    • KMA_USECORNERS: In addition to moving away from Other, the NPC will also try and run behind corners where Other has no line of sight to the NPC.

Return type(s):

  • None

Function:

Makes the NPC run away from the Other actor, similar to how A_Chase()/NewChaseDir() makes the NPC move away from their target if the target is scary or they are scared. Except this is a separate function, and more sophisticated too. Picking positions away from Other to actually move to, instead of just inverting the movement direction. Actors reach the position they are supposed to run away to once they are within MeleeRange of it, similar to ZDoom patrol points.

See also

Clone this wiki locally