# Init and Attack scripts
These are the easy scripts to write, because they contain data rather than behavior. Writing them is a bit like filling out a form.
These scripts run once, at the beginning of the game.
# Initializing Variables
# init.gml
init.gml
initializes your character's variables.
Many of them are built-in variables to do with movement or animation, but you can also initialize any variables you need
for your complex behavior, such as laser_charge = 0
.
Under Construction
Need guide for choosing movement attributes
# other_init.gml
other_init.gml
is called by all other characters at the start of the game.
This is useful for setting other character's up to be compatible with your complex behavior.
Prefixing variables with your character's name helps to avoid "name collisions", using variable names that the other character is already
using, which can lead to bugs. Mr. Example's other_init.gml
might contain mr_example_debuff_active = false
.
# Initializing Graphics
# load.gml
load.gml
looks like:
sprite_change_offset("idle", 29, 70)
sprite_change_offset("crouch", 25, 66)
// ... many more lines
Calling sprite_change_offset(sprite_name, x_offset, y_offset)
for each sprite to tell Rivals where to draw the sprite.
If they're wrong, you may find them floating or clipping into the floor.
The origin point should be at the bottom center of your character. You can find the right offset by opening the final sprite .png
in your editor or
using Dan Fornace's workshophelper (opens new window)
Note that the offset point in your \anims
.aseprite
file may not be the same as the final \sprites
.png
file, because many sprites are scaled up, to x2, or even x4 for SSL (opens new window).
# colors.gml
Used to generate the alternate color palettes for the character.
You can use RoaColorsGmlHelper (opens new window) to generate and test this file more easily.
Characters have 6 palette slots by default, but that can change to up to 16 by
using set_num_palettes
(opens new window).
More information:
# init_shader.gml
init_shader.gml
is called when the character's colors change, such as when parrying or in hitstun, and whenever you
call init_shader()
yourself.
Used for refreshing the character’s shader values after changing them.
Under Construction
I don't know what to say here. I haven't worked with shaders much. What are the use cases exactly?
# Initializing Attacks
Unlike all other scripts, you need to place these in /scripts/attacks
.
Names are typically from the standard attack names (opens new window), such as bair.gml
The files typically look like a long series of function calls setting attack, window, and hitbox values:
make_hitbox(AT_DAIR, 1,
HG_LIFETIME, 3,
HG_HITBOX_X, -6,
HG_HITBOX_Y, -44,
// ... Many more lines
)
Or, without the assistant's functions:
set_hitbox_value(AT_DAIR, 1, HG_LIFETIME, 3);
set_hitbox_value(AT_DAIR, 1, HG_HITBOX_X, -6);
set_hitbox_value(AT_DAIR, 1, HG_HITBOX_Y, -44);
// ... Many more lines
Mawral's Window Guide (opens new window) Mawral's Hitbox Guide (opens new window) Relevant functions (opens new window) Attack Grid Indices (opens new window) Hitbox Grid Indices (opens new window)
Under Construction
This will need a much larger guide to talk about how to design an attack.
Will also need integration with .atk file processing.
# Misc
# unload.gml
Not mentioned in the manual Called at the end of each match, and is used to destroy any persistent 'ds_' data structures.
← VFX Event Scripts →