Animations

Animations are predefined sequences of frames played with timing to produce the illusion of motion or action. OpenBOR uses animations as the basic framework of a model. Most in game actions are part of or require an animation.

Syntax

Unless otherwise noted defining an animation always consists of anim followed by the animation name. Individual frames are defined with the frame command followed by path to an image file. Offset controls the image placement in relation to entity position for a frame, and delay determines how long (in centiseconds) a frame stays on-screen. See the following example:

anim idle

     offset 100 200

     delay 10

     frame data/chars/some_guy/idle_0.png
     frame data/chars/some_guy/idle_1.png
     frame data/chars/some_guy/idle_2.png

Tip: You can use a different offset for each frame, but you should avoid doing so. OpenBOR auto trims images on load, so it’s beneficial to select a uniform image size and use one offset. Don’t ever use offsets to simulate movement, there are specific functions and settings for that elsewhere.

From this foundation, OpenBOR supports dozens of properties and commands to manipulate the behavior of a given animation, determine when it will play, and so on. One example might be an attack box to hit and damage other entities, and a body box that detects the incoming hits.

Script Access

IDs

Each animation has a unique identifier acessible through openborconstant(). Unless noted otherwise, the animation constant is always ANI_<ANIMATION_NAME>. See the following example script:

int current_animation = get_entity_property("animation_id");

if(current_animation == openborconstant("ANI_JUMP"))
{
     log("\n I'm jumping!");
}

Properties

Animation properties are attributes possessed by animations, such as number of frames, collision boxes, cancel points, and so on. Animation properties are accessible through the get_animation_property() and set_animation_property() functions.

Animations Vs. Frames: It would be logical to assume each animation has a set of frames with associated frame properties, but in actuality there is no such thing as a distinct frame collection in OpenBOR. Instead, any animation property specific to individual frames has an array of its own.

Use Cases

Get a property value. Properties and their behavior can vary wildly – see the property list for details.

 mixed x = get_animation_property(void <animation handle>, char <identifier>);

Modify a property value. Some properties are read only – see the property list for details.

mixed x = <value>

set_animation_property(void <animation handle>, char <identifier>, x);

List

  • Name: The identifier used to access property through script.
  • Type: The property value’s variable type.
  • Description: A short description of what the property is and does.
NameTypeRead OnlyDescription
attack_oneBinaryWhen TRUE, attack boxes only act on the first detected collision. Default TRUE for grab attacks, FALSE for all others.
bounce_factorFloatWhen entity lands from knockdown effect, its falling Y velocity is divided by this value, then applied as a new Y velocity to give a bounce effect. Default is openborconstant("ANIMATION_BOUNCE_FACTOR_DEFAULT") (4 as of 2019-11-18).
cancelIntegerEnable canceling the animation with a special command. This flag is only modified by the engine as a model loads, so you can freely use it to enable or disable cancel ability on a given animation. openborconstant("ANIMATION_CANCEL_DISABLED") – Default value. Cancels are not available. openborconstant("ANIMATION_CANCEL_ENABLED") – Cancels are enabled. This value is set when a cancel command is encountered while the model loads.
charge_timeIntegerValue (in approximate real time seconds) player must hold attack command button before releasing it will trigger this animation. By default this property only affects CHARGEATTACK (or the final series attack if CHARGEATTACK is not available) since those are the only animations natively mapped to a hold and release command. Its default value is openborconstant("ANIMATION_CHARGE_TIME_DEFAULT")
counter_action_conditionIntegerIf entity takes a hit during this animation, the following conditions are verified. If all conditions are met, the entity will immediately switch to a follow animation (see follow_up_animation_select). Logic is bitwise. It is possible to set contradictory flags if you aren’t careful, so pay attention when setting up conditions. If a condition is not specifically flagged, it simply isn’t evaluated. For example, if you don’t set a condition for freeze, then a counter can take place whether or not the attack has a freeze effect. openborconstant("COUNTER_ACTION_CONDITION_NONE") – Blank condition. If there are no conditions at all, counters are not executed. openborconstant("COUNTER_ACTION_CONDITION_ANY") – Always execute counter. Overrides all other conditions. openborconstant("COUNTER_ACTION_CONDITION_BACK_FALSE") – Attack must hit entity head on. openborconstant("COUNTER_ACTION_CONDITION_BACK_TRUE") – Attack must hit entity from behind. openborconstant("COUNTER_ACTION_CONDITION_BLOCK_FALSE") – Attack must be unblockable. openborconstant("COUNTER_ACTION_CONDITION_BLOCK_TRUE") – Attack must be blockable. openborconstant("COUNTER_ACTION_CONDITION_DAMAGE_LETHAL_FALSE") – Attack force must be insufficient to KO entity. openborconstant("COUNTER_ACTION_CONDITION_DAMAGE_LETHAL_TRUE") – Attack force must be sufficient to KO entity (note entity will not be KO’d if the counter triggers). openborconstant("COUNTER_ACTION_CONDITION_FREEZE_FALSE") – Attack does not have freeze effect. openborconstant("COUNTER_ACTION_CONDITION_FREEZE_TRUE") – Attack does have freeze effect. openborconstant("COUNTER_ACTION_CONDITION_HOSTILE_ATTACKER_FALSE") – Attacker must be benign toward entity. openborconstant("COUNTER_ACTION_CONDITION_HOSTILE_ATTACKER_TRUE") – Attacker must be hostile toward entity. openborconstant("COUNTER_ACTION_CONDITION_HOSTILE_TARGET_FALSE") – Entity must be benign toward attacker. openborconstant("COUNTER_ACTION_CONDITION_HOSTILE_TARGET_TRUE") – Entity must be hostile toward attacker.
counter_action_frame_maxIntegerThe last frame of an animation when the entity can perform a counter action.
counter_action_frame_minIntegerThe first frame of an animation when the entity can perform a counter action.
counter_action_take_damageIntegerControls how entity takes damage when a counter action is performed. openborconstant("COUNTER_ACTION_TAKE_DAMAGE_NONE") – Incoming damage is fully negated. openborconstant("COUNTER_ACTION_TAKE_DAMAGE_NORMAL") – Entity takes damage (normal damage mitigations still apply), but cannot be reduced below 1 hit-point.
drop_frameIntegerIf set, when entity reaches apex of jump or fall, the animation will skip forward to this frame. If already at or passed this frame, no action is taken. Use openborconstant("FRAME_NONE") to disable.
drop_model_indexIntegerIf set, when entity drop_frame triggers, the model with this index is spawned into play as a dust effect. Use openborconstant("MODEL_INDEX_NONE") to disable.
energy_cost_amountIntegerAmount of energy resource required to use animation.
energy_cost_disableIntegerEntity type(s) that are unable to use animation. Uses bitwise logic.
energy_cost_typeIntegerWhich energy resource is used and required. openborconstant("COST_TYPE_HP_ONLY") – Can only use hit points. openborconstant("COST_TYPE_MP_ONLY") – Can only use magic points. openborconstant("COST_TYPE_MP_THEN_HP") – Use magic points unless they are insufficient to cover the amount, then use hit points.
flip_frameIntegerWhen animation reaches this frame, the entity will switch its facing to the opposite direction.
follow_up_animation_selectIntegerWhen animation satisfies any existing follow up conditions and this property has a value of 1+, the entity will immediately switch animations to follow<this value>. For instance, if this value is 3, the entity will assume animation follow3, assuming it has that animation available.
follow_up_conditionIntegerIf this animation’s attack boxes register a hit, the following conditions are verified. If all conditions are met, the entity will immediately switch to a follow animation (see follow_up_animation_select). Logic is bitwise. It is possible to set contradictory flags if you aren’t careful, so pay attention when setting up conditions. openborconstant("FOLLOW_CONDITION_NONE") – Blank condition. If there are no conditions at all, follow ups are not executed. openborconstant("FOLLOW_CONDITION_ANY") – Always execute follow up. Overrides all other conditions. openborconstant("FOLLOW_CONDITION_BLOCK_FALSE") – Target must not block the attack. openborconstant("FOLLOW_CONDITION_BLOCK_TRUE") – Target must block the attack. openborconstant("FOLLOW_CONDITION_HOSTILE_ATTACKER_FALSE") – Entity must be benign toward target. openborconstant("FOLLOW_CONDITION_HOSTILE_ATTACKER_TRUE") – Entity must be hostile toward target. openborconstant("FOLLOW_CONDITION_HOSTILE_TARGET_FALSE") – Target must be benign toward entity. openborconstant("FOLLOW_CONDITION_HOSTILE_TARGET_TRUE") – Target must be hostile toward entity. Note the “hostile” options in followcond text command work by toggling this attribute. openborconstant("FOLLOW_CONDITION_LETHAL_FALSE") – Attack will not reduce target’s hit points to 0. openborconstant("FOLLOW_CONDITION_LETHAL_TRUE") – Attack will reduce target’s hit points to 0.
frame_countIntegerNumber of frames in animation.
hit_countIntegerNumber of attack hits by this animation. Used to determine cancel availability and resets each time animation changes. Note blocked hits still count toward this value.
indexIntegerSequential index assigned to each animation when loaded into memory. This is NOT the animation ID (Idle, Walk, etc.) – it is a specific integer value that is unique to all animations across all models.
jump_frameIntegerIf set, upon reaching this frame the entity will toss itself into the air as if in a jump. Use the jump velocity settings to control how fast/far. Use openborconstant("FRAME_NONE") to disable.
jump_model_indexIntegerIf set, when entity jump_frame triggers, the model with this index is spawned into play as a dust effect. Use openborconstant("MODEL_INDEX_NONE") to disable.
jump_velocity_xFloatX axis velocity applied on jump_frame.
jump_velocity_yFloatY axis velocity applied on jump_frame.
jump_velocity_zFloatZ axis velocity applied on jump_frame.
land_frameIntegerIf set, when entity touches ground (base) during jump or fall, the animation will skip forward to this frame. If already at or passed this frame, no action is taken. Use openborconstant("FRAME_NONE") to disable.
land_model_indexIntegerIf set, when entity land_frame triggers, the model with this index is spawned into play as a dust effect. Use openborconstant("MODEL_INDEX_NONE") to disable.
loop_frame_endIntegerWhen looping is enabled, the animation loops immediately upon reaching this frame (in other words, this frame is not seen). If not set or 0, the animation loops after playing last frame.
loop_frame_startIntegerWhen looping is enabled, the animation loops loops back to this frame. If not set, the animation loops to first frame.
loop_state BinaryIf TRUE, animation loops.
model_indexIntegerModel index this animation attached to at load.
projectilePointerHandle for animation’s projectile properties.
quake_frame_startIntegerWhen animation with quake effect reaches this frame, the quake effect begins.
quake_move_yIntegerNumber of pixels screen elements are adjusted along Y axis on each quake frame to produce a visual shake effect.
quake_repeat_countIntegerNumber of “shakes” applied by current quake effect.
quake_repeat_maxIntegerMaximum number of “shakes” before quake effect ends.
range_base_maxIntegerMaximum range detection for base axis.
range_base_minIntegerMinimum range detection for base axis.
range_x_maxIntegerMaximum range detection for X axis.
range_x_minIntegerMinimum range detection for X axis.
range_y_maxIntegerMaximum range detection for Y axis.
range_y_minIntegerMinimum range detection for Y axis.
range_z_maxIntegerMaximum range detection for Z axis.
range_z_minIntegerMinimum range detection for Z axis.
size_xIntegerEntity’s size (for interacting with terrain like walls, platforms, obstacles, etc.) along the X axis.
size_yIntegerEntity’s size (for interacting with terrain like walls, platforms, obstacles, etc.) along the Y axis.
sub_entity_model_indexIntegerModel index spawned into play by either sub_entity_spawn, or sub_entity_summon properties.
sub_entity_spawnIntegerPointer to sub entity properties controlling the frame and location of a sub entity spawn. If spawned with this property, the sub entity’s parent value is the entity that spawned it, but there is otherwise no default relationship. Spawns are unlimited.
sub_entity_summonIntegerPointer to sub entity properties controlling the frame and location of a sub entity summon. If spawned with this property sub entity’s parent value is the entity that spawned it, and the parent’s child value is the spawned entity. The parent may unsummon its child entity at any time. One summon is allowed per parent – if a second entity is summoned, the new summon replaces previous summon in parent’s child property. Effectively, the previous summoned entity is now a spawn.
sub_entity_unsummonIntegerWhen entity reaches this frame, its child dies. Specifically, the child will damage itself with type openborconstant("ATK_SUB_ENTITY_UNSUMMON").
subject_to_gravityBinaryIf TRUE, gravity does not apply to entity during animation. Same as model subject_to_gravity.

Related Post

FilestreamFilestream

Under Construction Filestreams allow CRUD (Create, Read, Update, Delete) operations on user defined files during gameplay. You can sue these to build databases and add persistence features to games.