» Uncategorized Posts

set_synced_var

Sets the persistent global variable of that player slot. This value persists before and after matches, as well as being saved in replays.

ArgumentTypeDescription
player:realID of the player to get the synced variable of
value:intThe value to set the variable to

Example, called from css_update.gml:

// This character only sets their synced var to "true" when selecting a specific palette
if (get_player_color( player ) == 12) {
(set_synced_var( player, true)
} else {
(set_synced_var( player, false)
}

article_destroy

Prompts the article to despawn, but not immediately deleting it. Using this on a custom article only sets its destroyed variable to true, meaning the article might not be able to be destroyed.

ArgumentTypeDescription
instance_id:realThe Instance ID of the article to destroy.

Example, called from update.gml:

// This code attmpts to destroy the closest kragg rock to the player:
var near = instance_nearest(x, y, asset_get("rock_obj"));
article_destroy(near);

set_ui_element

Sets character-related UI sprites and sounds, such as the victory theme or their HUD icon.

Uses the following indexes

ArgumentTypeDescription
type:realThe type of UI element to set
value:intThe custom asset to set it to

Example, called from load.gml:

set_ui_element( UI_WIN_THEME, sound_get( "custom" ));

get_hitstun_formula

Returns the resulting amount of hitstun a player would get if they were hit with the specified stats. Note that hitstun is not hitstop; Hitstun is how long the player remains inactionable after being hit.

ArgumentTypeDescription
player damage:realThe current damage of the target before being hit
player knockback_adj:realThe target's knockback multiplier, usually under knockback_adj
KB mulitplier:realThe general KB multiplier, usually defined by match settings
hitbox damage:realThe amount of damage the hitbox deals
hitbox BKB:realThe hitbox's base knockback value
hitbox KB scale:realThe hitbox's knockback scaling

Example, called from article1_hit.gml:

// This simulates hitstun in an article as if it were a player, to be used elsewhere:
hitstun = get_hitstun_formula(damage, knockback_adj, 1.0, enemy_hitboxID.damage, enemy_hitboxID.kb_value, enemy_hitboxID.kb_scale);

Stage Scripting

Advanced stages can be given access to custom scripts and articles by setting the scripting parameter in its config.ini to “1”.

Stages with scripting enabled get two new tabs in addition to terrain and player spawns: Markers and Article spawners.

Markers

Markers are simply a set of immovable coordinates. They can be used in a variety of ways, such as creating a path for a moving platform to follow or arbitrary boundaries for things like goalposts or spawn areas.

To find a specific marker’s coordinates in a match, use the functions get_marker_x()  Reference→ and get_marker_y()  Reference→.

Selecting or placing one opens a small menu that lets you change the marker’s color and symbol for better organization.

Article Spawners

For more details on how stage articles themselves work, check the Articles and Stage Articles pages.

At the start of a match, article spawners will create an article that uses the script set corresponding to the spawner’s number, shown on the upper-right of its icon in the top bar. Selecting or placing one opens a menu with the following properties:

Obj Type – Whether the article is normal, a platform or a solid block.

Layout – Whether the article will spawn in both stage layouts, or is exclusive to either Aether or Basic.

Depth – The depth of the article, which determines whether it shows in front of (negative value) or behind (positive value) other layers. A depth of 0 is the ground layer.

Parallax X – The article’s horizontal parallax (only applies to normal articles)

Parallax Y – The article’s vertical parallax (only applies to normal articles)

ARG0 – ARG7 – These values will be transferred to the article’s spawn_variables array when created.

Folders

Scripted stages will detect the following additional folders: /scripts/, /scripts/attacks/, /sounds/sfx/, and /sprites/articles/.

The scripts and attacks folder behave similarly to character scripts. To see what scripts stages normally use and when they use them, check the Stage Scripts page.

The sfx folder loads sounds to be used with the sound_get function, much like the sounds folder in players. Likewise, the articles folder loads sprites for use with sprite_get.

Rule Overrides

Custom stages can also override the normal rules, accessible via the stage’s config.ini file, under the section labelled [scripting_overrides]. A value of -1 means the rule will not be overridden.

Setting the stocks override to 0 will disable stock limits entirely, and setting the time override to 0 will disable the timer. Setting teams to 1 will auto-sort every other player into opposite teams if teams were not enabled in the lobby beforehand.