» Uncategorized Posts

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).