gms_instance_get_owner

Usage: gms_instance_get_owner ( id )

Description

Returns the player_id of the player that is syncing the instance.

Replies (11)

Last message on 11 Aug 2018

CurrentCanine on 21 Jul 2018, 22:08:08
I seem to be having an issue and I'm not sure why exactly it's happening...
I've synced my object across all clients in the create event with:

gms_instance_sync(id,is_full,"x","y","image_index")

in the draw event I have this code: (this is what causes the crash)

if(gms_instance_is_owner(id)) {
var GetColor = make_colour_rgb(Other_BannerRed,Other_BannerGreen,Other_BannerBlue)
} else {
var Owner = gms_instance_get_owner(id)
var GetColor = make_colour_rgb(gms_other_get(Owner,"Other_BannerRed"),gms_other_get(Owner,"Other_BannerGreen"),gms_other_get(Owner,"Other_BannerBlue"))
}
draw_sprite_ext(sHumanShirt,ShirtColor,x-(sprite_width/2),y-sprite_height,image_xscale,image_yscale,image_angle,GetColor,image_alpha)

when this code runs if you are not the owner of the object then this error shows up:

Retrieving owner for non-existing instance 101446.000000
Size43 (Administrator) on 22 Jul 2018, 14:57:33
Are there maybe instances of the object that aren't synced? (Maybe an instance change, or a persistent object after changing rooms, etc)

By the way, the "x" and "y" variables are always synced; you don't need to specify them explicitly.
CurrentCanine on 22 Jul 2018, 20:08:12
I've figured out the issue, it turns out it wasn't caused by this code..
I'm having a new issue however. I removed the x and y variables from the sync as you said it was already done, but now my objects don't move on other player's screens unless I leave and rejoin the match. I have absolutely no clue why this is happening... Another issue I've been having is that when a new player joins the session all of the objects being synced are not synced on their client. Do you know how I can fix this?
Size43 (Administrator) on 28 Jul 2018, 16:25:56
When are you creating the object? If it's right after a room change/start the extension might not be aware of the room it's in yet, so they end up registering for the wrong room.
CurrentCanine on 28 Jul 2018, 22:14:35
it's created in the mouse click event, the way it works is the player picks a spawn location based on where they click on the map and it creates the object there. It works perfect on the local client, but the object sits completely still as if it had no logic on other player's screens, unless you disconnect from the match and reconnect. Also the other issue I was having I feel like I wasn't clear enough on. Basically I'm creating an extended sync object to show on all clients, however if a client joins the game after that object is already synced then they can not see it. I was wondering if there is anyway to fix this.
Size43 (Administrator) on 8 Aug 2018, 11:25:12
Extended sync objects are not stored on the server, so they cannot be sent to new players joining. You should use full sync for that.

What are you expecting the object to do which it isn't doing? (e.g. move, play an animation, etc.)
CurrentCanine on 8 Aug 2018, 23:36:47
Oh okay, I can't use full sync because there are way too many objects that would need to be synced. Also the objects are completely predictable (other than create and destroy) so extended would be perfect if it synced on clients that join late... What I'm trying to do is sync all of the Trees/buildings on the map (which is massive, with 200+ trees) My game allows the players to destroy trees for resources, so their destroy is unpredictable. I was thinking about making a list of all trees/building positions but I'm not sure how to go about syncing that among all clients. Also the issue I was having with the human object is that it uses is_full syncing however the X and Y position isn't synced for some reason...
Size43 (Administrator) on 11 Aug 2018, 14:25:39
Sounds like you might be better off by building something custom using p2p messages for the trees. You could take a look at the Blocks example, which uses p2p messages to update blocks on a grid.

Can you not use the default player sync for the human?
CurrentCanine on 4 Aug 2018, 19:36:09
Hi size, I just wanted to make sure that this message was seen. I know that you don't do this for money so your replies are really slow, however this reply feels slower then usual so I wanted to just check in and make sure my message was seen... Sorry if it seems like I'm trying to rush you as this is not my intentions...
Size43 (Administrator) on 4 Aug 2018, 19:55:03
Hi,

I'm currently dealing with some drama (which you can probably figure out from the news on this site).

I'll be back to normal when it all dies down.
CurrentCanine on 4 Aug 2018, 20:02:53
Okay yeah I've seen that, sorry for rushing you. I hope everything gets sorted out correctly =)