Hello, why my NPC is owned by every player who connect to game?
I have this in create code:
owner = "";
if(gms_instance_is_owner(id))
{
owner = oPlayer.name;
pch = choose(pathCircleNPC, pathNPC);
path = path_start(pch,3,path_action_restart,0);
}
But every player seen different paths on NPC.. How can I do this NPC will start path and other players will see him same..
Step:
if(gms_instance_is_owner(id))
{
gms_instance_handover(id);
}
Size43
(Administrator)
on
15 Dec 2018, 19:15:17
gms_instance_is_owner might not work in the create event, it's better to move it to an alarm that fires after a few steps.
Also note that the owner variable is already set to the player ID of the owner of the instance.
jdev
on
9 Dec 2018, 01:54:26
This code seems to be the issue. Why are you transferring the ownership of the instance to everyone else if you are the owner of it; that doesn't make sense.
if(gms_instance_is_owner(id))
{
gms_instance_handover(id);
}
Try removing this code and let me know if the issue persists.
Thanks for reply. No it's not work. On every client are NPCs still on different way.
jdev
on
9 Dec 2018, 15:18:52
You cannot sync a path, they will all run at different times depending on the speed of the client unless you use delta_time.
And is something else what can I use for that?
jdev
on
9 Dec 2018, 23:58:21
As far as I am aware, unless you sync the x and y from a GameINI, there is no way to do this.
Its fast sync x and y of every NPC?
Size43
(Administrator)
on
15 Dec 2018, 19:18:29
You might want to use p2p messages instead of writing to a GameINI to get faster synchronization.
jdev
on
10 Dec 2018, 14:10:58
That depends on how often you read the GameINI x and y values.
To clarify, does this mean that imputing "gms_instance_is_owner(id)" will return true if the instance was created originally on the current client and false if created by a different client?
Size43
(Administrator)
on
6 Sep 2016, 21:11:51
If you're not using gms_instance_handover, then yes. The owner might also switch if the original owner leaves the room or quits the game.