-
Notifications
You must be signed in to change notification settings - Fork 0
AI functions
This page covers all the non-movement AI-related functions that are shared by all KAI NPCs.
- Other: The actor to check the melee range to.
- Range: The range of the check. Default is -1, which means that the actors' MeleeRange is used instead.
- Flags: The flags to use for the check.
- CMR_NOHITFRIEND: Do not run HitFriend() during the check.
- CMR_3DDISTANCE: Use Distance3D() instead of Distance2D() for the range check. This flag is also used by KAI_CheckMissileRange().
- CMR_INVERTDIST: used by KAI_CheckMissileRange(). This flag inverts the distance formula the function uses to decide if the NPC should attack, meaning that the actor is MORE likely to attack the further Other is, instead of less likely. THIS FLAG ALTERS HOW THE AGGRESSIONMULTIPLIER WORKS !
- Returns true if Other is in Range of the caller, false otherwise.
This function is a ZScript version of CheckMissileRange().
- Other: The actor to check the missile range to.
- Flags: The flags to use for the check. Uses, the same flags as KAI_CheckMeleeRange().
- Returns true if Other is in range of the target, the chance of returning true scales with the distance to the target, like CheckMissileRange().
This function is a ZScript version of CheckMissileRange(), besides supporting 3D distance checks, it also supports the AggressionMultiplier property.
- Flags, MinSeeDist, MaxSeeDist, MaxHearDist, FOV, Label: These parameters are the exact same as their A_LookEx() counterparts.
- ExtraFlags: Extra flags used by KAI_Look() itself, as opposed to A_LookEx's own flags.
- KAIL_CHASETARGET: If the caller already has a target, then make the actor go to the specified sight state. Useful for when A_LookEx itself doesn't do this.
- KAIL_NOTEMPSTAND: The caller won't temporarily enable +STANDSTILL if it isn't already enabled, when called by friendly monsters. If this isn't on, then friendly monsters will not begin moving when they hear the player.
- None
This is a generic wrapper for A_LookEx(), that includes a fix for monsters not going to their See state when they already have a target, and also makes friendly monsters not begin moving when they hear a player by default.
For more information, click here.
For more information, click here.
For more information, click here.
For more information, click here.
- TargetPos: The position to check if the caller has a valid path to.
- DistCutoff: The amount of map units to trim off the distance between the callers' pos and TargetPos. Useful for subtracting the radius of another actor, so that if you are checking if a position to another actor can be reached, the check doesn't return false because the actor itself is in the way.
- Spacing: Determines how far apart the position checks from the callers' position to TargetPos are. Default is 0, which makes the spacing be the diameter of the callers' hitbox.
- IgnoreActors: Makes the check ignore any blocking actors in the way by temporarily enabling +THRUACTORS.
- Returns true if the caller can move up to TargetPos.
Checks if the caller can move from their current position towards TargetPos without hitting any obstacles along the way. The Spacing parameter can be used to patch up holes in the path check, such as corners being considered possible to cross.
The function will sometimes return true for positions that are behind drops too tall for the caller. It also doesn't seem to account properly for static portals. The former bug I have no idea how to fix, the latter bug I may be able to fix.
- Range: The range to look for enemies within, if it's 0 or less, no search is performed. Default is 256 map units.
- Returns a pointer to the enemy that is closest to the caller, if any.
Finds the nearest enemy NPC in Range of the caller that is alive, can be targeted, and is visible. And returns a pointer to them. Used by KAI_LandVehicleChase() to make vehicles stay away from enemies instead of charging headfirst like normal Doom monsters.
- Other: The actor to get the proper aim position to.
- Offsets: The Vector3 offsets relative to the caller to fire the line of sight checks from. Default is (0,0,0).
Returns which part of the Other actor the calling NPC can shoot at. Using the A_Face() flags. By default, it returns FAF_MIDDLE, but if the middle of the Other actor is covered, it will return FAF_TOP, and if that is blocked too, it will return FAF_BOTTOM. If the whole actor is blocked, it falls back to FAF_MIDDLE. Used by KAI_TurretRefire() and KAI_TurretCheckLOF.
This is how KAI_TurretRefire() uses the function after every attack to update what part of the target the turret should aim at: `TurretAimPos = GetFAFAimPos(Target);
- Returns true if the NPC used a line.
Makes the NPC use any pushable and usable lines it touches, similar to the native line using code of monsters. Used by KAI_MoveTowards()
- Returns the callers' friendplayer.
Gets the calling NPCs' friendplayer, without running into VM aborts. In most cases, this should be used in place of plainly calling Players[FriendPlayer]
.
- Returns true if the NPC is in any particular attack state.
This function checks if the caller is in any of the states defined in the AttackStates[] array, but first checks if they are within their MissileState or MeleeState states currently.
- Hazard: The hazard to check.
- Returns true if the NPC is in range of the specified hazard.
Checks if the calling actor is in the range of the specified hazard, or in the case of HAZ_SECTOR hazards, if the actor is within the same sector that can be found at the hazards' Position vector.
- Home
- Features
- Classes
- Functions
- Guides