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.
Name | Type | Read Only | Description |
---|---|---|---|
attack_one | Binary | When TRUE, attack boxes only act on the first detected collision. Default TRUE for grab attacks, FALSE for all others. | |
bounce_factor | Float | When 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). | |
cancel | Integer | Enable 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_time | Integer | Value (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_condition | Integer | If 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_max | Integer | The last frame of an animation when the entity can perform a counter action. | |
counter_action_frame_min | Integer | The first frame of an animation when the entity can perform a counter action. | |
counter_action_take_damage | Integer | Controls 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_frame | Integer | If 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_index | Integer | If 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_amount | Integer | Amount of energy resource required to use animation. | |
energy_cost_disable | Integer | Entity type(s) that are unable to use animation. Uses bitwise logic. | |
energy_cost_type | Integer | Which 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_frame | Integer | When animation reaches this frame, the entity will switch its facing to the opposite direction. | |
follow_up_animation_select | Integer | When 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_condition | Integer | If 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_count | Integer | Number of frames in animation. | |
hit_count | Integer | Number 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. | |
index | Integer | Sequential 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_frame | Integer | If 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_index | Integer | If 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_x | Float | X axis velocity applied on jump_frame. | |
jump_velocity_y | Float | Y axis velocity applied on jump_frame. | |
jump_velocity_z | Float | Z axis velocity applied on jump_frame. | |
land_frame | Integer | If 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_index | Integer | If 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_end | Integer | When 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_start | Integer | When looping is enabled, the animation loops loops back to this frame. If not set, the animation loops to first frame. | |
loop_state | Binary | If TRUE, animation loops. | |
model_index | Integer | Model index this animation attached to at load. | |
projectile | Pointer | Handle for animation’s projectile properties. | |
quake_frame_start | Integer | When animation with quake effect reaches this frame, the quake effect begins. | |
quake_move_y | Integer | Number of pixels screen elements are adjusted along Y axis on each quake frame to produce a visual shake effect. | |
quake_repeat_count | Integer | Number of “shakes” applied by current quake effect. | |
quake_repeat_max | Integer | Maximum number of “shakes” before quake effect ends. | |
range_base_max | Integer | Maximum range detection for base axis. | |
range_base_min | Integer | Minimum range detection for base axis. | |
range_x_max | Integer | Maximum range detection for X axis. | |
range_x_min | Integer | Minimum range detection for X axis. | |
range_y_max | Integer | Maximum range detection for Y axis. | |
range_y_min | Integer | Minimum range detection for Y axis. | |
range_z_max | Integer | Maximum range detection for Z axis. | |
range_z_min | Integer | Minimum range detection for Z axis. | |
size_x | Integer | Entity’s size (for interacting with terrain like walls, platforms, obstacles, etc.) along the X axis. | |
size_y | Integer | Entity’s size (for interacting with terrain like walls, platforms, obstacles, etc.) along the Y axis. | |
sub_entity_model_index | Integer | Model index spawned into play by either sub_entity_spawn, or sub_entity_summon properties. | |
sub_entity_spawn | Integer | Pointer 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_summon | Integer | Pointer 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_unsummon | Integer | When entity reaches this frame, its child dies. Specifically, the child will damage itself with type openborconstant("ATK_SUB_ENTITY_UNSUMMON") . | |
subject_to_gravity | Binary | If TRUE, gravity does not apply to entity during animation. Same as model subject_to_gravity. |