although the function syncRequest(req_id, x, y, object, object2) products a synchronized eventSyncRequest(from,req_id, x, y, obj_id, obj_id2)
it can only carry arguments of fixed length and type,
so i make this library, serialize the arguments of non-synchronized function(which must have fixed name and json serializable arguments) and wrapped in syncRequest send it to all clients, make it synchronized.
for example, make addDroid a synchronized function:
Code: Select all
include("multiplay/script/mods/sync.js");
var syncAddDroid=synchronize(addDroid)//must be executed in all clients
when a player says "/tank", a "Gauss Cannon Hydra Dragon Hover" will be spawned at its startPositions. and it works in multiplay.