Player-Sync Variables problem

Posted by bruc
I have a problem: I synchronize the player variables with a script called "sync_player" that I execute in the Step Event of the obj_player object, but when I test the game the player variables are not correctly synchronized (The variable "name" gets "", the variables "atk", "def" and "dir" gets 0 and player x and y are not synchronized sometimes). How I can fix this?

The script "sync_player":
//Update variables

gms_self_set("name",gms_self_name());
gms_self_set("sprite",obj_player.sprite_index);
gms_self_set("blend",obj_player.image_blend);
gms_self_set("atk",global.atk);
gms_self_set("def",global.def);
gms_self_set("dir",global.Direction);


The draw event code of "obj_other_player":
draw_sprite_ext(gms_other_get(player_id,"sprite"),image_index,x,y,image_xscale,image_yscale,gms_other_get(player_id,"dir"),gms_other_get(player_id,"blend"),image_alpha);

Replies (3)

Last message on 24 Apr 2017

Zeth on 19 Apr 2017, 00:42:18
I've fixed this strangely. I added Begin Step event to "obj_gms" and in the code I rewrote the gms_settings function (Although I have already wrote it in the Create event of that same object).
Size43 (Administrator) on 24 Apr 2017, 11:42:48
Name is already automatically syncronised by the extension, overriding that might be causing some issues.
Zeth on 19 Apr 2017, 00:43:31
PD. I'm bruc, but that's my test-account, lol.