» Uncategorized Posts

Player Variables

Manual HomeProgramming

Important

These variables are frequently used and can be changed to achieve different effects.

Variable Description
url The unique identifier number for a character
player Your player number (1-4)
state Your current state
state_timer How many frames into the current state you are
state_cat Your current state category
prev_state The previous state you were in
prev_prev_state The state before the previous state you were in
attack The current attack you’re using or the last attack you used, if you aren’t currently attacking
window The window of the action you’re in
window_timer How many frames into the current window you are
spr_dir The direction the player is facing: 1 = right, -1 = left
spr_angle The angle at which to draw the player’s sprite
free Whether the player is aerial or not
hsp The current horizontal speed in pixels per frame
vsp The current vertical speed in pixels per frame
joy_pad_idle Whether the joystick is idle or not.
Also works with keyboard
joy_dir The direction of the joystick.
Also works with keyboard.
Only accurate if joy_pad_idle is false
[input_name]_pressed Checks whether an input was just pressed, buffer included
[input_name]_down Checks whether an input is being held down
[direction]_hard_pressed Used for joystick hard presses, like dashing or dropping through platforms
was_parried Whether your current attack has been parried or not
can_move Whether you can move during an attack or not
can_jump Whether you can jump or not.
Used for jump cancels in attacks
can_attack Whether you can attack or not.
Used for jab / tilt cancels
can_strong Whether you can use Fstrong / Dstrong or not.
Used for strong attack cancels
can_ustrong Whether you can Ustrong or not.
Used for strong attack cancels
can_special Whether you can use special attacks or not.
Used for special cancels
can_shield Whether you can shield or not.
Used for parry / roll cancels
can_wall_jump Whether you can currently walljump or not. To walljump, both this variable and has_walljump must be true. Use this to make recovery moves cancellable into walljump
has_walljump Whether you have your walljump or not
has_airdodge Whether you have your airdodge or not
can_fast_fall Whether you can fastfall or not
djumps The number of double jumps you’ve used
max_djumps The max number of double jumps you can use
off_edge Whether you can leave the ledge or not; used to prevent grounded attacks from leaving the ground
super_armor Whether you have full super armor or not
soft_armor The value of KB that it takes to break your armor.
For reference, Etalus Fair has a value of 12
invincible Whether you’re invincible or not
invince_time The number of invincibility frames until invincible is set to false
hitpause Whether the player is in hitpause or not
hitstop The number of frames remaining until hitpause ends
hitstop_full The number of frames this instance of hitpause lasts total
has_hit Whether you’ve hit something with the current attack
has_hit_player Whether you’ve hit a player with the current attack
can_wall_cling Whether you’re able to wall cling or not
clinging Whether you’re wall clinging or not.
Only functions if can_wall_cling is true
fall_through Whether you can land on platforms or not. false will cause you to fall through all platforms.
go_through Whether you can pass through other players without pushing them away or not.
grav The characters gravitational acceleration
strong_charge How long you’ve been charging a strong attack (0 – 60)
move_cooldown[attack] How long the move is on cooldown for.
0 = not on cooldown

Less Important

These variables can be changed, but usually don’t need to be, as they are normally managed by themselves.

Variable Description
hit_player_obj The instance ID of the last player that you either hit or got hit by. Mainly used for hit_player.gml and got_hit.gml.
last_player The last player that hit you
last_attack The last attack that hit you
last_hbox_num The index of the last hitbox that hit you
old_hsp The hsp to apply when hitpause ends
old_vsp The vsp to apply when hitpause ends
ground_type Is 1 while on a solid block and 2 while on a platform.
marked Whether you’re marked by Maypul
wrapped Whether you’re wrapped or not
wrapped_player The player number of the character that wrapped you
burned Whether you’re on fire or not
burnt_id The player id of the character that burned you
burned_color The palette of Zetterburn to use when setting someone on fire. Should be from 0 to 5.
burn_timer How long you’ve been on fire for.
Automatically extinguishes the fire once it’s above 150
bubbled Whether you’re trapped in Ranno’s bubble or not
bubbled_id The Ranno whose bubble you’re in
bubble_time Time remaining in Ranno’s bubble
poison The number of poison stacks on you
can_freeze_timer The amount of frames left until frozen state ends. Only applicable if the player’s state is PS_FROZEN
frozen_player The player slot that froze you.
plasma_pause Whether you’re in Clairen’s plasma stun or not.
plasma_id the instance ID of the player that stunned you.
plasma_player The player slot that stunned you.
stuck Whether you’re stuck by Elliana’s mine
stuck_id The Elliana that stuck you
clone Whether you’re Forsburn’s clone or not
clones_player_id The owner of this clone
draw_indicator Set to false to hide the character’s overhead HUD
hud_offset_dest The vertical offset the indicator moves towards, relative to the player’s char_height.
old_jump Whether you started the current attack during a double jump with acceleration, like Absa’s double jump. Set this to false to prevent the attack from rising while jump is held
outline_color[R, G, B] Used to change the outline color of the character’s sprite. Should be used in conjunction with init_shader() Reference→
draw_x The horizontal offset to draw the player at. This does not effect hurtboxes or hitboxes.
draw_y The vertical offset to draw the player at. This does not effect hurtboxes or hitboxes.

Gameplay Attributes

These values determine the character’s gameplay properties. These should be set in init.gml, but can also be changed during gameplay. (“Rivals Values” are the range of values used by the default cast of Rivals of Aether).

Variable Rivals Values Description
hurtbox_spr sprites

The sprite to use for hurtbox collisions in most states
crouchbox_spr sprites

The sprite to use for your crouching hurtbox
air_hurtbox_spr sprites

The sprite to use for your hurtbox while aerial
-1 = use hurtbox_spr
hitstun_hurtbox_spr sprites

The sprite to use for your hurtbox while in hitstun
-1 = use hurtbox_spr
knockback_adj .91.2 The multiplier to knockback dealt to you:
1 = default value
higher values = lighter character
lower values = heavier character
walk_speed 34.5 The maximum speed you can achieve while walking, in pixels per frame
walk_accel .2.5 The speed gained per frame while walking
walk_turn_time 6 for all characters The number of frames it takes to turn around
initial_dash_time 816 The number of frames in your initial dash
initial_dash_speed 411 The speed of your initial dash in pixels per frame
dash_speed 4.759 The speed of your run in pixels per frame
dash_turn_time 820 The number of frames it takes to turn while running
dash_turn_accel .12 The acceleration applied when turning while running
dash_stop_time 46 The number of frames it takes to stop while running
dash_stop_percent .25.5 The value to multiply your hsp by when going into idle from dash or dashstop
ground_friction .31 Natural deceleration while on the ground
moonwalk_accel 1.21.4 The acceleration to apply while moonwalking
max_djumps 03 The number of double jumps you can perform before touching the ground again
jump_start_time 5 for all characters The number of frames of jumpsquat minus one
jump_speed 7.612 The vsp applied when fullhopping
short_hop_speed 47.4 The vsp applied when shorthopping
djump_speed 812
-1 for Absa
The vsp applied when double jumping
jump_change 3 for all characters The hsp applied if left or right is held when jumping. Will not slow you down if you’re already going faster. When reversing your momentum with a double jump, this is the maximum hsp you can have
djump_accel -1.4 The amount of acceleration to apply during your double jump.
Allows for Absa-style double jump cancels
djump_accel_start_time 4 The first frame of your double jump that acceleration is applied
djump_accel_end_time 15 The last frame of your double jump that acceleration is applied
leave_ground_max 48 The maximum hsp you can have when you go from grounded to aerial without jumping
air_max_speed 37 The maximum hsp you can accelerate to when in a normal aerial state
max_jump_hsp 48 The maximum hsp you can have when jumping from the ground
air_accel .2.4 The hsp acceleration applied when you hold left or right in a normal aerial state
air_friction .02.07 Natural deceleration applied while in the air.
Also applies while in hitstun
double_jump_time 2440 The number of frames to play the double jump animation.
Most characters have a value of 32 so that the double jump animation transitions into the falling portion of the normal jump animation
gravity_speed .3.6 The gravitational acceleration applied in non-hitstun aerial states
hitstun_grav .45.525 The gravitational acceleration applied in hitstun
max_fall 811 The maximum vsp you can accelerate to while falling normally
fast_fall 1116 The vsp applied when fastfalling
land_time 46 The number of frames in your normal landing state
prat_land_time 324 The number of frames in your prat land state
prat_fall_accel .41.5 A multiplier to your normal horizontal aerial acceleration:
1 = normal
0 = no acceleration
walljump_hsp 47 The horizontal speed to apply while walljumping, in pixels per frame
walljump_vsp 710 The vertical speed to apply while walljumping, in pixels per frame
walljump_time 1832 The number of frames the walljump state takes. Normally 32, but some characters have shorter values
roll_forward_max 911 The speed of your forward roll
roll_backward_max 911 The speed of your backward roll
wave_land_time 612
usually 8
The number of frames your waveland state lasts
wave_land_adj 1.21.5 The multiplier to your initial hsp when wavelanding.
Usually greater than 1
wave_friction 0.15 Grounded deceleration when wavelanding
techroll_speed 811 The speed during techroll’s movement
air_dodge_speed 7.58 The speed during airdodge’s movement
char_height 3674 Used for centering things on the character, placing the overhead HUD, etc
bubble_x -8-8 Used for visually positioning the character in Ranno’s bubble horizontally
bubble_y 010 Used for visually positioning the character in Ranno’s bubble vertically

Animation Attributes

These variables determine the way the character animates during certain states.

Variable Description
wall_frames The number of animation frames to play before you leave the wall
dodge_startup_frames Number of animation frames during parry’s startup. Usually just 1
dodge_active_frames Number of animation frames during parry’s active frames
dodge_recovery_frames Number of animation frames during parry’s recovery frames
tech_active_frames The number of animation frames during tech in place’s invincibility
tech_recovery_frames The number of animation frames during tech in place’s recovery
techroll_startup_frames The number of animation frames during techroll’s startup
techroll_active_frames The number of animation frames during techroll’s movement
techroll_recovery_frames The number of animation frames during techroll’s recovery
air_dodge_startup_frames The number of animation frames during techroll’s startup
air_dodge_active_frames The number of animation frames during techroll’s movement
air_dodge_recovery_frames The number of animation frames during techroll’s recovery
roll_forward_startup_frames The number of animation frames during roll forward’s startup
roll_forward_active_frames The number of animation frames during roll forward’s movement
roll_forward_recovery_frames The number of animation frames during roll forward’s recovery
roll_back_startup_frames The number of animation frames during roll backward’s startup
roll_back_active_frames The number of animation frames during roll backward’s movement
roll_back_recovery_frames The number of animation frames during roll backward’s recovery
idle_anim_speed The speed of your idle animation in anim frames per gameplay frame
walk_anim_speed The speed of your walk animation in anim frames per gameplay frame
dash_anim_speed The speed of your dash animation in anim frames per gameplay frame
crouch_anim_speed The speed of your (held) crouch animation in anim frames per gameplay frame
pratfall_anim_speed The speed of your pratfall animation in anim frames per gameplay frame

Sound Attributes

These variables determine which sounds to play during certain states.

Variable Description
land_sound The sound effect to play when landing
waveland_sound The sound effect to play when wavelanding
jump_sound The sound effect to play when jumping from the ground
djump_sound The sound effect to play when double jumping
air_dodge_sound The sound effect to play when airdodging
landing_lag_sound The sound effect to play when landing during an attack

AI variables

Variables used by the AI.

Variable Description
ai_target The current target of the AI.
ai_recovering Is true while the AI is attempting to recover back onto the stage.
temp_level The difficulty level of the AI, from 1 to 9.
ai_attack_timer The amount of frames since the AI last attacked.
ai_attack_time The minimum amount of frames before the AI can try attacking again.
ready_to_attack Is true if the AI can perform an attack.
ai_going_into_attack Is true if the AI is attempting to attack.
ai_going_left Is true if the AI is moving left.
ai_going_right Is true if the AI is moving right.

Player States

States

Use these values when changing states with set_state( state )  Reference→

To check the state of a character, use the state variable.

PS_WALK
PS_WALK_TURN
PS_DASH_START
PS_DASH
PS_DASH_STOP
PS_DASH_TURN
PS_WAVELAND


PS_AIR_DODGE
PS_PARRY_START

can transition into rolls or parry, depending on direction held
PS_PARRY
PS_ROLL_BACKWARD
PS_ROLL_FORWARD
PS_TECH_GROUND
PS_TECH_BACKWARD
PS_TECH_FORWARD
PS_WALL_TECH


PS_WRAPPED
PS_FROZEN

PS_IDLE
PS_IDLE_AIR
PS_CROUCH
PS_JUMPSQUAT
PS_FIRST_JUMP
PS_DOUBLE_JUMP
PS_WALL_JUMP
PS_LAND


PS_ATTACK_AIR
PS_ATTACK_GROUND
PS_LANDING_LAG


PS_HITSTUN
PS_HITSTUN_LAND
PS_TUMBLE
PS_PRATFALL
PS_PRATLAND


PS_SPAWN
PS_RESPAWN
PS_DEAD

State Categories

These values are set automatically depending on the state and should not be manually changed. To check a character’s state category, use the state_cat variable.

SC_HITSTUN ▼
PS_HITSTUN
PS_HITSTUN_LAND
PS_WRAPPED
PS_FROZEN

SC_AIR_NEUTRAL ▼
PS_IDLE_AIR
PS_FIRST_JUMP
PS_DOUBLE_JUMP
PS_TUMBLE

SC_AIR_COMMITTED ▼
PS_WALL_JUMP
PS_ATTACK_AIR
PS_PRATFALL
PS_AIR_DODGE
PS_WALL_TECH
PS_RESPAWN
PS_DEAD
SC_GROUND_NEUTRAL ▼
PS_IDLE
PS_CROUCH
PS_WALK


SC_GROUND_COMMITTED ▼
PS_LAND
PS_SPAWN
PS_PRATLAND
PS_LANDING_LAG
PS_WALK_TURN
PS_ATTACK_GROUND
PS_WAVELAND
PS_DASH_START
PS_DASH
PS_DASH_TURN
PS_DASH_STOP
PS_PARRY_START
PS_PARRY
PS_TECH_GROUND
PS_TECH_BACKWARD
PS_TECH_FORWARD
PS_ROLL_BACKWARD
PS_ROLL_FORWARD
PS_JUMPSQUAT

Articles

Articles are non-hitbox objects that your character can create. These include objects that can be placed on the stage like Orcane’s puddle, objects that create hitboxes when enemies get near like Lily, objects that follow you around like Sein, objects that block player movement like Kragg’s rock, objects that act like platforms like Shovel Knight’s Mobile Gear, and pretty much anything else you can think of.

Each modded character has access to 5 different articles: obj_article1, obj_article2, obj_article3, obj_article_solid, and obj_article_platform. The solid article blocks player movement, while the platform article will only block player movement if they land on it.

Articles have a few built-in variables that allow you to modify the way they react to certain scenarios:

Variable Description
hsp The horizontal speed of the article
vsp The vertical speed of the article
free Whether the article is in the air or not
can_be_grounded Determines if the article follows platforms when free == false.
false by default
ignores_walls Determines if the article goes through walls.
true by default
hit_wall Is true if the article hit a wall due to its own movement
spr_dir The direction the article is facing: 1 = right, -1 = left
player_id The id of the object’s owner
hitstop The frames remaining in hitpause.
Hitpause automatically prevents movement
uses_shader Whether the article is recolored by the player’s shader or not

Functions

These are all of the functions you can use in your scripts.

Available Common GML Functions

General Functions

  • Player-related Functions

    Sprite Functions

    Sound Functions

    View Functions

    Custom Colors Functions

    • set_num_palettes( num )  Reference→
    • set_color_profile_slot( color_slot, shade_slot, R, G, B )  Reference→
    • set_color_profile_slot_range( color_slot, H, S, V )  Reference→
    • get_color_profile_slot_r( color_slot, shade_slot )  Reference→
    • get_color_profile_slot_g( color_slot, shade_slot )  Reference→
    • get_color_profile_slot_b( color_slot, shade_slot )  Reference→
    • set_character_color_slot( shade_slot, R, G, B )  Reference→
    • set_article_color_slot( shade_slot, R, G, B )  Reference→
    • set_character_color_shading( shade_slot, value )  Reference→

    Shader Functions

    Attack/Hitbox Grid Functions

    • get_attack_value( attack, index )  Reference→
    • set_attack_value( attack, index, value )  Reference→
    • reset_attack_value( attack, index )  Reference→
    • get_window_value( attack, window, index )  Reference→
    • set_window_value( attack, window, index, value )  Reference→
    • reset_window_value( attack, window, index )  Reference→
    • get_hitbox_value( attack, hitbox, index )  Reference→
    • set_hitbox_value( attack, hitbox, index, value )  Reference→
    • reset_hitbox_value( attack, hitbox, index )  Reference→
    • get_num_hitboxes( attack )  Reference→
    • set_num_hitboxes( attack, value )  Reference→
    • reset_num_hitboxes( attack )  Reference→
    • destroy_hitboxes()  Reference→
    • get_hitbox_angle( hitbox_id )  Reference→
    • get_kb_formula( damage, kb_adj, kb_mult, hbox_damage, hbox_bkb, hbox_kb_scale )  Reference→
    • get_hitstun_formula( damage, kb_adj, kb_mult, hbox_damage, hbox_bkb, hbox_kb_scale )  Reference→
    • get_hitstop_formula( damage, hbox_damage, hbox_hitstop, hbox_hitstop_scale, hbox_extra_hitstop )  Reference→
    • create_hitbox( attack, hitbox_num, x, y )  Reference→
    • create_deathbox( x, y, w, h, player, free, shape, lifespan, bg_type )  Reference→

    Stage Scripting Functions

    Easing Functions

    Interpolates between start and end over the total time with current time being your current position in the interpolation. This website can help to understand the effect of each function.

    • ease_linear( start, end, current time, total time )
    • ease_backIn( start, end, current time, total time, overshoot )
    • ease_backOut( start, end, current time, total time, overshoot )
    • ease_backInOut( start, end, current time, total time, overshoot )
    • ease_bounceIn( start, end, current time, total time )
    • ease_bounceInOut( start, end, current time, total time )
    • ease_circIn( start, end, current time, total time )
    • ease_circOut( start, end, current time, total time )
    • ease_circInOut( start, end, current time, total time )
    • ease_cubeIn( start, end, current time, total time )
    • ease_cubeOut( start, end, current time, total time )
    • ease_cubeInOut( start, end, current time, total time )
    • ease_expoIn( start, end, current time, total time )
    • ease_expoOut( start, end, current time, total time )
    • ease_expoInOut( start, end, current time, total time )
    • ease_quadIn( start, end, current time, total time )
    • ease_quadOut( start, end, current time, total time )
    • ease_quadInOut( start, end, current time, total time )
    • ease_quartIn( start, end, current time, total time )
    • ease_quartOut( start, end, current time, total time )
    • ease_quartInOut( start, end, current time, total time )
    • ease_sineIn( start, end, current time, total time )
    • ease_sineOut( start, end, current time, total time )
    • ease_sineInOut( start, end, current time, total time )

Scripts

Avoid including empty scripts, since that will result in a crash when the item is loaded. If you don’t need any code for, say, the character’s death event, do not include death.gml at all or leave a comment line in it.

Init scripts

  • load.gml – called right after the item is loaded into the game. This is where you would normally set sprites’ origins and bounding boxes. To help place origins correctly, use the Rivals Workshop Helper.
  • colors.gmlused to generate the alternate color palettes for the character.
  • init.gml – called once the player object is created. This is where you want to initialize most of the player variables.
  • other_init.gml – called by all other players in a match that includes your character. This is where you want to initialize variables that you can change on other players.
  • init_shader.gml – called every time the init_shader() function is run, either by the game or when the function is called by the user. Used for refreshing the character’s shader values after changing them. The game itself runs init_shader() when changing the character’s color for things like parrying or flashing during hitstun.

Animation and Draw scripts

  • animation.gml – called every frame. Used for animation purposes such as changing the character’s sprite_index and image_index.
  • pre_draw.gml – used to draw sprites other than the player’s sprite. Everything will be drawn behind the player character.
  • post_draw.gml – used to draw sprites other than the player’s sprite. Everything will be drawn in front of the player character.
  • other_pre_draw.gml – used by opponent characters to draw sprites underneath themselves.
    Use other_player_id to reference your workshop character.
  • other_post_draw.gml – used by opponent characters to draw sprites on top of themselves.
    Use other_player_id to reference your workshop character.
  • debug_draw.gml – used to draw debug text/sprites. Everything will be drawn in front of all game objects.
  • draw_hud.gml – used to draw on top of the player’s HUD. To get the position of the HUD, use temp_x and temp_y.
  • css_draw.gml – used to draw things on the character select screen when the character is selected. in this script, x and y will refer to the top left corner of the player’s character profile.
  • article[index]_pre_draw.gml – used to draw things on custom article objects. Everything will be drawn behind the article running the script.
    For solid and platform articles, use articlesolid_pre_draw.gml and articleplatform_pre_draw.gml.
  • article[index]_post_draw.gml – used to draw things on custom article objects. Everything will be drawn in front of the article running the script.
    For solid and platform articles, use articlesolid_pre_draw.gml and articleplatform_pre_draw.gml.

Gameplay-related scripts

  • update.gml – called every frame. Used for gameplay mechanics.
  • death.gml – called when the character dies. Useful for resetting variables or deleting articles.
  • set_attack.gml – called at the beginning of every attack. Used to change things like Dspecial into Dspecial_air under certain conditions.
  • attack_update.gml – called every frame, but only if the character is performing an attack (attack type is stored inside the attack variable).
  • /attacks/[attack_name].gml – called after init.gml. This is where you want to use the Attack/Hitbox Grid Functions to modify attack grids and hitbox grids for every attack type [list of attack names]. Note that all attack scripts should be placed inside the /attacks folder.
  • hit_player.gml – called when you hit another player with any hitbox. Use hit_player_obj to reference the player object that was hit. Use hit_player to reference which player you hit (player 1, player 2, etc). Use my_hitboxID to reference the hitbox you hit them with. To change the knockback given, edit hit_player_obj.orig_knock. You can disable the purple kill effect by setting hit_player_obj.should_make_shockwave to false.
  • got_hit.gml – called when you are hit by any hitbox. Use hit_player_obj to reference the player object that hit you. Use hit_player to reference which player hit you (player 1, player 2, etc). Use enemy_hitboxID to reference the hitbox you were hit with. To change the knockback received, edit orig_knock. You can disable the purple kill effect by setting should_make_shockwave to false.
  • parry.gml – called when you parry a hitbox. Use hit_player_obj to reference the player object whose hitbox you parried. Use hit_player to reference which player owns the hitbox (player 1, player 2, etc). Use enemy_hitboxID to reference the hitbox you parried.
  • got_parried.gml – called when your hitbox is parried. Use hit_player_obj to reference the player object who parried your hitbox. Use hit_player to reference which player parried your hitbox (player 1, player 2, etc). Use my_hitboxID to reference the hitbox that was parried.
  • user_event[0 – 15].gml – called only by running the corresponding user_event() function. Used for whatever the user wants, though usually it’s for any blocks of code that would be run in multiple different scenarios.

Article and Hitbox scripts

  • article[index]_init.gml – called once the specified custom article object is created. For solid and platform articles, use articlesolid_init.gml and articleplatform_init.gml.
  • article[index]_update.gml – called every frame for the specified custom article object. For solid and platform articles, use articlesolid_update.gml and articleplatform_update.gml.
  • hitbox_init.gml – called when one of the character’s hitboxes is created. This script is called from the perspective of the hitbox.
  • hitbox_update.gml – called every frame for each of the character’s hitboxes. This script is called from the perspective of the hitbox.

AI scripts

  • ai_init.gml – called when a CPU version of the character is created. This script should populate the following arrays with attack indexes.

    The arrays can be any size. Each entry in the array has the same probability of being selected. The entries in the arrays should only be the default attacks values – AT_DSPECIAL_AIR is not valid, for instance, and should just be AT_DSPECIAL.

  • ai_update.gml – called every frame for a CPU version of the character. Used for special cases like recovery and complex special moves. Use ai_target to reference the player object the CPU is currently targeting. Use ai_recovering to check if the CPU is recovering or not. Use temp_level to reference the CPU’s difficulty level (1-9).