» Uncategorized Posts

set_player_team

Sets the team for the specified player.

ArgumentTypeDescription
player:realID of the player to get the team of
value:realThe value to set. Should be either 1 or 2

Example, called from attack_update.gml:

// changes teams at the beginning of your taunt:
if (attack == AT_TAUNT && window == 1 && window_timer == 1) {
if (get_player_team( player ) == 1) {
set_player_team( player, 2 );
} else {
set_player_team( player, 1 );
}
}

get_player_team

Returns the team of the specified player. If team mode is off, it will return the player number.

ArgumentTypeDescription
player:realID of the player to get the team of

Example, called from hit_player.gml:

// this character plays a sound effect when they hit their teammate:
if (get_player_team( hit_player ) == get_player_team( player )) {
sound_play( sound_get( "oops" ));
}

get_training_cpu_action

Returns the current “CPU Action” setting in training mode. Can be used in ai_update.gml to separate attack code from other code (like recovery code).

Return values:

When not in training mode, the function will always return CPU_FIGHT.

Example, called from ai_update.gml:

if (get_training_cpu_action() == CPU_FIGHT) {
// insert custom attack code here, since it should only execute
// if the CPU Action is set to Fight
}
// insert custom recovery code here, since the CPU should try to recover regardless of the CPU Action setting

get_instance_player_id

Returns the ID of the player associated with the object. Used for referencing objects that you normally don’t have access to.

ArgumentTypeDescription
instance_id:realThe ID of the instance to get the player ID of

Example, called from hit_player.gml:

// plays a concerned sound whenever you hit Maypul while she has Lily out:
with (asset_get( "plant_obj" )) {
if (get_instance_player_id( self ) == other.hit_player_obj) {
sound_play( "plant_concerned_sound" );
}
}

get_instance_player

Returns the player number of the specified instance. Used for referencing objects that you normally don’t have access to.

ArgumentTypeDescription
instance_id:realThe ID of the instance to get the player number of

Example, called from article1_update.gml:

// destroys the article when it’s within an enemy Clairen’s plasma field:
with (asset_get( "plasma_field_obj" )) {
with (other.id) {
var _team = get_player_team( get_instance_player( other ));
if (_team != get_player_team( player )
&& point_distance(
x + 10 * spr_dir,
y,
get_instance_x( other ),
get_instance_y( other )
) < 180) {
instance_destroy();
}
}
}