How can I sync a variable for bullet

Posted by namlunthkl
Here is my script:
i=instance_create(x,y,obj_bullet);
i.direction=image_angle
i.image_angle=image_angle
i.damage=12 //I want to sync this variable
gms_instance_sync(i,is_onetime)

Replies (2)

Last message on 21 Jun 2015

Size43 (Administrator) on 21 Jun 2015, 12:23:50
There are two options depending on the version of GameMaker you're using:

GM8 / GM8.1:

Add the following piece of code:

gms_instance_sync(i, is_onetime | isc_local, “damage”);

GM:Studio:

In GM:Studio, you'll need to do a little more work when synchronizing an instance variable.

GameMaker Server has a special function that is used to set both the variable name and value for instance synchronisation, gms_instance_sync_var_add(...).

gms_instance_sync_var_add(“damage”,i.damage);
gms_instance_sync(i, is_onetime | isc_local);

namlunthkl (Topicstarter) on 21 Jun 2015, 13:09:50
Thanks!