Syncing Health

Posted by Shaddovv
Hey Size!

I had a question about sycing health. Normally you can use gms_instanc_sync and then is_full to fully sync the enemy object, but how do you substract it on 2 sides?

Like when you use gms_instance_is_owner ( id ) to set the variable and to get it for the other players to sync it correctly, but how can you substract it on the other players side, so that everyone can attack it?

Thank you for youre time! :)

Replies (5)

Last message on 25 Jun 2016

RandomNICK on 25 Jun 2016, 07:33:48
I believe looking in the online multiplayer shooter gmk example should answer your question. :)
Shaddovv (Topicstarter) on 25 Jun 2016, 14:02:53
Thanks, il take a look!
Shaddovv (Topicstarter) on 25 Jun 2016, 16:58:42
Tried to take a look at the online shooter but i cant open it becouse i get an error:

action number 1
of Begin Step Event
for object __newobject12:

In extension function gms_step:
In extension function XWindow_totalstep:
In extension function gms_login_player_has_account:
Error in code at line 18:
at position 18: Unknown variable argument or array index out of bounds

Illegal array index in script "<unknown>".
trying to access argument[1], but only 0 arguments have been supplied.
Shaddovv (Topicstarter) on 25 Jun 2016, 21:23:42
I opened the instnace sync example and also got the same error, on GM8. But i looked at the code and i got my awnser :)
Size43 (Administrator) on 25 Jun 2016, 21:47:14
For anyone wondering: you can use gms_instance_set and gms_instance_get to sync variables of an instance between clients.