Skip to content

KAI_MoveAway()

inkoalawetrust edited this page Nov 30, 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.
  • TargPos: If this vector isn't empty, it will be used in place of running away from Other, useful for making the actor run away from a position instead of an actor. Like for running away from hazards. NaN by default. Requires Other to be null as well to work properly.

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