» Uncategorized Posts

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();
}
}
}

get_instance_y

Returns the y value 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 y value of

Example, called from article1_update.gml:

// destroys the article when it’s within Clairen’s plasma field:
with (asset_get( "plasma_field_obj" )) {
with (other.id) {
if (point_distance(
x + 10 * spr_dir,
y,
get_instance_x( other ),
get_instance_y( other )
) < 180) {
instance_destroy();
}
}
}