Syncing Instances with P2P on GM8/8.1

Posted by AouabAdYT

I've heard a lot of people having issues with instances syncing , in this non-sense tutorial , im going to show you how to sync instances only ONE TIME using p2p messages.
Works only in gm8/8.1.

This method is long and no sense so if instance syncing works on your game stop reading.

First you should define a script :

i = instance_create(argument1,argument2,argument0)
i.code = argument3
with(i) {execute_string(code)}
i.owner = gms_self_playerid()
//where p2p_inst is a macro/constant


This script creates the instance for the client with the variables defined in argument3 wich is the code executed , and then sends the p2p message to all players in session.

We need to receive the message:
[Look down below]

Replies (2)

Last message on 27 Jun 2018

AouabAdYT (Topicstarter) on 13 Apr 2018, 15:29:14
We need to receive the message:
//In the p2p receiving script
case p2p_inst:
if argument1 != gms_self_playerid()
var _x,_y,obj,code;
_x = ds_list_find_value(argument2,1)
_y = ds_list_find_value(argument2,2)
obj = ds_list_find_value(argument2,0)
code = ds_list_find_value(argument2,3)
i = instance_create(obj,_x,_y)
i.code = code
with (i) { execute_string(code)}
i.owner = 

That's it . Now to sync your instance , do :
//Syncing objBullet 
c = " speed = 13; direction = " + string(objPlayer.dir);
Chibi on 27 Jun 2018, 03:27:19
Nice tutorial bro ;) (By Shadownya)