gms_instance_handover

Usage: gms_instance_handover ( id )

Description

Asks the server to change the instances 'owner.' The value of server_instance_get_owner will change after this.

Replies (5)

Last message on 26 Aug 2021

TheRetroBoy on 18 Aug 2021, 21:58:34
Hi, I keep getting this error when I leave my game with synced enemies in the room:


___________________________________________
############################################################################################
ERROR in
action number 1
of Other Event: Game End
for object prt_enemy:

Data structure with index does not exist.
at gml_Script_gms_instance_handover (line 5) - buffer_write(_b, buffer_u16, ds_map_find_value(__s, "syncID") - 1000000);
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Script_gms_instance_handover (line 5)
called from - gml_Object_prt_enemy_EndGameEvent_1 (line 3) - gms_instance_handover(id);

I don't know what's going on.
Size43 (Administrator) on 22 Aug 2021, 16:41:22
Are you sure the instance has been synced with gms_instance_sync when you call gms_instance_handover?

You can check this by adding the following code:

[gml]
if gms_instance_get_owner(id) != 0 {
gms_instance_handover(id);
} else {
show_message("This instance is not being synced")
}
[/gml]
TheRetroBoy on 26 Aug 2021, 00:44:07
It worked, thanks!
vagrantwhale on 20 Aug 2018, 20:21:13
gms_instance_handover(id) gives and error on game end event. Am I doing something wrong or is it because there is no one to hand them over to...what do you do if there are no players left in the server?
Size43 (Administrator) on 22 Aug 2018, 20:17:30
Instances are handed over to another player upon logout automatically.

If no player is available, handover is delayed until another player enters that room.