Questions about gms_other_get()

Posted by Cromemadnd
How does gms_other_get() work?
I tried

gms_other_get(player_id,"global.facing") and gms_other_get(player_id,"facing") and gms_other_get(player_id,"moving")

in obj_other_player,but they always return 0.
Also,I tried

gms_other_get_real(player_id,"global.facing") and gms_other_get_real(player_id,"facing") and gms_other_get_real(player_id,"moving")

but they returned 0 again.
Why it doesn't return the right health value of the other player?
Please tell me.
Is it only can read the preset variables?

//gms_settings() code in the create event of login object
gms_settings(1,1.0,obj_mainchara,obj_other_player)

//Moving code in the step event of obj_mainchara
if global.move && image_alpha>0{ //Variable spd's value is 5
if keyboard_check(vk_down) {if !place_free(x,y+spd) moving=0 else {y+=spd moving=1} global.facing=0}
else if keyboard_check(vk_up) {if !place_free(x,y-spd) moving=0 else {y-=spd moving=1} global.facing=3}
if keyboard_check(vk_left) {if !place_free(x-spd,y) moving=0 else {x-=spd moving=1} global.facing=1}
else if keyboard_check(vk_right) {if !place_free(x+spd,y) moving=0 else {x+=spd moving=1} global.facing=2}
if keyboard_check(vk_nokey) moving=0}
else moving=0

//Step event of obj_other_player
image_alpha=obj_mainchara.image_alpha
x=gms_other_get(player_id,"x")
y=gms_other_get(player_id,"y")

Replies (3)

Last message on 25 Feb 2019

Cromemadnd (Topicstarter) on 14 Feb 2019, 06:04:47
Sorry,I didn't read the article about custom variables...
Don't apply this topic.I got it.
I'm very sorry.
Size43 (Administrator) on 25 Feb 2019, 13:48:18
No worries!

For anyone else that might stumble upon this topic, this is the tutorial Cromemadnd is referring to:
https://gamemakerserver.com/en/docs/article/syncing_player_variables/
Cromemadnd (Topicstarter) on 14 Feb 2019, 06:05:19
*Reply