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