Skip to content

ActionBehaviors

An ActionBehaviors is an enum type that represents a behavior which has some logic to perform on the active main section of Update. It only applies to all NPCType except Object.

There are 2 ActionBehaviors defined in NPCControl data with the first one being the default one and the second one being only used when inrange is true. Each comes with an actionfrequency field that has a different meaning depending on the behavior.

The actual execution of the behavior is done by DoBehavior called by Update which receives the appropriate frequency, but only on the main active section. This means that it is only called when the NPCControl is considered active and a main update occurs (which excludes the special cases of an Enemy when it is dizzy, about to be unfrozen or frozen).

Enum table

The following is a table of the different enum values (NOT REFERENCED means the game never reference the value meaning it has not logic backing it, UNUSED means the behavior has logic, but it is either dead or not practically used under normal gameplay):

Value Name Summary
0 None Stops any force move on the entity.
1 FacePlayer Stops any force move on the entity and causes the entity to face towards the player if it is present.
2 ChasePlayer Approach the player as close as possible within the radiuslimit or until there is no more ground to move in the direction of the player.
3 FleeFromPlayer Stops any force move on the entity and have it move towards the opposide direction from the player.
4 TurnRandomly Stops any force move on the entity and periodically causes the entity.flip to toggle which turns the entity using a somewhat random time interval.
5 Wander Periodically performs a MoveTowards call after a random amount of time passed on the entity to a random position or the closest possible before unable to move further towards it. The range of movement, maximum time period to wait between wanders and the max distance to move to between wanders are all configurable.
6 FaceAwayFromPlayer Stops any force move on the entity and causes the entity.flip to be set such that the sprite faces the opposite direction of the player horizontally.
7 TurnFixedInterval Stops any force move on the entity and periodically causes the entity.flip to toggle which turns the entity using a fixed time interval.
8 Disguise A behavior where the map entity has a special disguiseobj that will replace its normal entity.sprite appearence until the behavior is switched away from which reveals the entity.sprite (usually by going into the inrange one). After coming back to this behavior (usually by going out of inrange), the entity will move back to its startpos and put its disguise on again.
9 DisguiseOnce The same than Disguise, but if it's the default behavior, it becomes Wander whenever the player gets inrange and the disguiseobj is destroyed.
10 FollowPlayer NOT REFERENCED
11 WalkAwayFromPlayer UNUSED, This is an alias of FleeFromPlayer
12 FaceAhead Stops any force move on the entity and causes the entity to face towards the right vector of this entity (towards their x axis facing direction).
13 FaceBehind Stops any force move on the entity and causes the entity to face towards the left vector of this entity (the opposite direction of their x axis direction)
14 FaceUp Stops any force move on the entity and causes the entity to face towards the forward vector of this entity (usually away from the camera).
15 FaceDown Stops any force move on the entity and causes the entity to face towards the backward vector of this entity (usually towards the camera).
16 SetPath Periodically performs MoveTowards calls on the entity using a fixed configurable interval between moves and the path being made of position nodes defined in vectordata.
17 ChargeAtPlayer Charges at the player with attacking set to true during the movement towards the player (this will allow an Enemy to initiate a battle with the advantage if it collides with the player and all conditions are met to start a battle with the advantage).
18 ChargeAtPlayerFlipSprite The same then ChargeAtPlayer, but right after the MoveTowards call on the entity, the entity.sprite has its angles set to (0.0, the y angles facing the player + 90.0, 0.0) with an overrideonlyflip which locks the entity.sprite facing direction until the charge part of the coroutine is over.
19 ShootProjectile Attacks the player by shooting an OverworldProjectile which can, under the right conditions, start a battle with advantage. The specifics of the projectile logic is dependant on the animid and only a few have a logic defined for this behavior.
20 ShootProjectilePredict UNUSED, An alias of ShootProjectile.
21 ChargeAndAttack The same than ChasePlayer, but also attacks the player (with attacking set to true during the attack) where the actions depends on the AnimID when getting closer than a configurable threshold. Only a few animIds have an attack logic defined for this behavior.
22 AlwaysWander UNUSED, A very cut down version of wander where the entity will always, when it can, move somewhere on the next DoBehavior cycle even if it is in the process of moving already.
23 Unmoveable Prevents an Enemy with this behavior (either default or inrange) to not move during the Dizzy process. This doesn't have any logic, its presence is what affects the NPCControl.
24 ChargeAttackUnderground The same than ChargeAndAttack, but the behavior always makes the entity digging when not attacking and it can only attack after 30.0 frames of digtime.
25 WanderUnderground The same than Wander, but the entity immediately starts digging underground before actually wandering.
26 StealthAI Gives the ability of the NPCControl to spot the player if it enters its field of vision (represented by 2 trigger colliders) which has the effect of triggering an event. The event id and the wideness of the field of vision are configurable as well as an option to set the entity.animstate to Sleep at the start of the DoBehavior cycle.
27 SetPathJump Similar than SetPath, but after the MoveTowards call, the entity forcejump is set to true which makes it jump during its FixedUpdate when moving to the next node if possible.
28 DisguiseOnceJumpForward UNUSED, A semi functional and likely unfinished behavior similar to Disguise that is recognised as a disguise behavior alongside Disguise and DisguiseOnce, but it doesn't have any DoBehavior logic.
29 ChangeSpriteInRandius When the player is present, the entity.animstate is set to actionfrequency[0] when the distance between this and the player is less than the wanderradius, it is set to actionfrequency[1] otherwise.
30 ChaseWhenAnim Perform the same logic than ChasePlayer when the entity.animstate is Chase. Otherwise, if the entity.animstate isn't the frequency, entity.animstate is set to it with a 20.0 frames behaviorcooldown (prevents a WalkWhenAnim doing a Wander DoBehavior cycle to process for 20.0 frames when entity.animstate is Idle) and a StopForceMove call on the entity.
31 WalkWhenAnim Perform Wander when the entity animstate is Walk (or Idle if the behaviorcooldown expired) or change it to the frequency when it's not with a behaviorcooldown of 20.0 frames (prevents another Wander cycle to process for 20.0 frames when entity.animstate is Idle).
32 WanderOffscreen The same than Wander, but movements are allowed when inactive or paused.
33 WanderNoWarp The same than Wander, but the warp branch logic is disabled. This means even if maxtries reaches 20 or that the distance between this position and the entity.startpos gets higher than radiuslimit, the entity will not warp and continue as normal.
34 WanderOnWater The same than WanderNoWarp, but the y position is adjusted according to the map.waterfloat if one exists.
35 ChaseOnWater The same than ChasePlayer, but the y position is adjusted according to the map.waterfloat if one exists.