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