KAI_LandVehicleChase() - inkoalawetrust/KAI GitHub Wiki

KAI_LandVehicleChase ([StateLabel WaitState = Null, Int Flags = 0, Int ChaseFlags = 0, Double TurnRadius = 10, Double FollowDist = 384, KAIMoveParams Params = Null, Int MinHazard = HazardInfo.HAZARD_HARMLESS])

Parameters

Function:

This is the chase function used by vehicles. It has the following unique features, in addition to most normal A_Chase behavior.

KAIMoveParams:

The function can also have a reference passed to a KAIMoveParams struct, which passes detailed parameters to KAI_MoveTowards() and KAI_MoveAway(). Allowing you to fine tune how your vehicle moves exactly. The struct has the following passable parameters that KAI_LandVehicleChase() uses:

  • RunRad: The radius around which the vehicle will try to find new points to move away to when calling KAI_MoveAway(). Default is 256.
  • DetourFactor: The detour factor to use when calling KAI_MoveTowards(), this does not affect the detour factor of vehicles driving away. Default is 0.5 for driving away, and 1.0 for driving towards something.
  • Attempts: How many random positions to check for the vehicle to drive away to when calling KAI_MoveAway(). Default is 32.
  • StepThreshold: How many steps will the vehicle take when driving away to a certain position, before giving up and generating a new one. Default is 32. Note: AngleLimit is not passable through this struct, it's handled by TurnRadius instead.

Example:

Here is an example of a _KAI_LandVehicleChase() call in a vehicles' See state. With detailed parameters passed to fine tune the movement.

				KAIMoveParams Params;
				Params.DetourFactor = 0.8;
				Params.Attempts = 32;
				Params.StepThreshold = 32;
				Params.RunRad = 384;
				
				KAI_LandVehicleChase ("Spawn",LVC_ATTACKWHENSCARED,turnradius:8,384,Params);

And here is a more straightforward call to the function:

				KAI_LandVehicleChase (chaseflags:CHF_DONTIDLE,followdist:256);

See also