zuff 10 Posted March 23, 2013 I've put together this mission, here: https://github.com/zuffdaddy/dynalamp/tree/master/DYNALAMP-WIP.Stratis And I'm having major locality issues with tasks and unit creation. The main troublemaker is "tasks.sqf" in "scripts/tasks/" I have no clue what to do when it comes to what i need to send to the clients and what needs to stay on the server. I know random numbers should be server side, but how do I get them back to the client? init.sqf: enableSaving [false, false]; waitUntil { !isNull player }; // Wait for player to initialize sleep 1; //Ammo Box Scripts _null = player execVM "scripts\ammo_boxes\weapon_box.sqf"; _null = player execVM "scripts\ammo_boxes\backpack_box.sqf"; _null = player execVM "scripts\ammo_boxes\item_box.sqf"; //MHQ Scripts _null = player execVM "scripts\mhq\mhq_marker.sqf"; // Compile scripts getLoadout = compile preprocessFileLineNumbers 'scripts\fnc_get_loadout.sqf'; setLoadout = compile preprocessFileLineNumbers 'scripts\fnc_set_loadout.sqf'; //Changeroom Script call compile preprocessFileLineNumbers "dsl_gear_get_lists.sqf"; //Mission Maker Teleport Function // use // to comment out [] execVM "MissionEditing\missionEditing.sqf"; to deactive the use of the hide/unhide features and teleport before releasing the map. [] execVM "scripts\MissionEditing\missionEditing.sqf"; //TPWCAS AI Suppression null = [3] execvm "scripts\tpwcas\tpwcas_script_init.sqf"; // Save default loadout loadout = [player] call getLoadout; // Load saved loadout on respawn player addEventHandler ["Respawn", { [player,loadout] spawn setLoadout; } ]; //Create Tasks //[(paramsarray select 2),(paramsArray select 3), (paramsArray select 4), (paramsArray select 5), (paramsArray select 6),(paramsArray select 7),(paramsArray select 8)] execVM "scripts\tasks\tasks.sqf"; [] execVM "scripts\tasks\tasks.sqf"; //Clean Dead Body Script [] execVM "scripts\clearCorpses.sqf"; tasks.sqf: //if (!isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers. timeSkip = (paramsArray select 0); // True or False for timeSkip tasksToComplete = (paramsArray select 1); // Set amount of Tasks to Complete to win mission here unitsMin = (paramsArray select 2); // Set min amount of units here unitsMax = (paramsArray select 3); // Set max amount of units here unitsLeft = (paramsArray select 4); // Units that can be left at objective before being considered completed vehOn = (paramsArray select 5); // True or False for Enemy Vehicles vehCount = (paramsArray select 6); // How many vehicles you'd like at each objective //hint format['timeSkip is %1,tasksToComplete is %2, unitsMin is %3, unitsMax is %4, unitsLeft is %5, vehOn is %6, vehCount is %7',timeSkip, tasksToComplete, unitsMin, unitsMax,unitsLeft, vehOn, vehCount]; //sleep 20; SideHQ = createCenter east; taskscompletedcount = 0; firstmark = false; secondmark = false; thirdmark = false; fourthmark = false; fifthmark = false; sixthmark = false; sevenththmark = false; locationPicked = false; taskNumber = 1; firsttask = false; m1 = 0; timeSkipped= 0; // Pick Location /////////////////////////////////////////////////////////////////////// while {taskscompletedcount < tasksToComplete} do { if (isServer) then { //n1 = round ((random tasksToComplete) + 0.5); // generates random number if (timeSkip == 1) then { timeSkipped = round ((random 6) + 6);// generates random number from 6-12 publicVariable "timeSkipped"; }; }; hint format['timeSkipped is %1', timeSkipped]; if (!firsttask) then { firsttask = true; newgroup = createGroup east; newTask = player createSimpleTask [format ["Assault Units %1", taskNumber]]; skipTime (timeSkipped); while {!locationPicked} do { if (isServer) then { m1 = round ((random 6) + 1); publicVariable "m1"; }; if (m1 == 1 && !firstmark) then { locationPicked = true; publicVariable "locationPicked"; newTask setSimpleTaskDestination (getMarkerPos "m1"); publicVariable "newTask"; createUnits = ["m1","airfield", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf"; sleep 5; firstmark = true; secondmark = false; thirdmark = false; fourthmark = false; fifthmark = false; sixthmark = false; sevenththmark = false; }; if (m1 == 2 && !secondmark) then { locationPicked = true; publicVariable "locationPicked"; newTask setSimpleTaskDestination (getMarkerPos "m2"); publicVariable "newTask"; createUnits = ["m2","agia", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf"; sleep 5; firstmark = false; secondmark = true; thirdmark = false; fourthmark = false; fifthmark = false; sixthmark = false; sevenththmark = false; }; if (m1 == 3 && !thirdmark) then { locationPicked = true; publicVariable "locationPicked"; newTask setSimpleTaskDestination (getMarkerPos "m3"); publicVariable "newTask"; createUnits = ["m3","kamino", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf"; sleep 5; firstmark = false; secondmark = false; thirdmark = true; fourthmark = false; fifthmark = false; sixthmark = false; sevenththmark = false; }; if (m1 == 4 && !fourthmark) then { locationPicked = true; publicVariable "locationPicked"; newTask setSimpleTaskDestination (getMarkerPos "m4"); publicVariable "newTask"; createUnits = ["m4","mike26", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf"; sleep 5; firstmark = false; secondmark = false; thirdmark = false; fourthmark = true; fifthmark = false; sixthmark = false; sevenththmark = false; }; if (m1 == 5 && !fifthmark) then { locationPicked = true; publicVariable "locationPicked"; newTask setSimpleTaskDestination (getMarkerPos "m5"); publicVariable "newTask"; createUnits = ["m5","maxwell", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf"; sleep 5; firstmark = false; secondmark = false; thirdmark = false; fourthmark = false; fifthmark = true; sixthmark = false; sevenththmark = false; }; if (m1 == 6 && !sixthmark) then { locationPicked = true; publicVariable "locationPicked"; newTask setSimpleTaskDestination (getMarkerPos "m6"); publicVariable "newTask"; createUnits = ["m6","tempest", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf"; sleep 5; firstmark = false; secondmark = false; thirdmark = false; fourthmark = false; fifthmark = false; sixthmark = true; sevenththmark = false; }; if (m1 == 7 && !seventhmark) then { locationPicked = true; publicVariable "locationPicked"; newTask setSimpleTaskDestination (getMarkerPos "m7"); publicVariable "newTask"; createUnits = ["m7","girna", unitsMin, unitsMax, vehOn, vehCount] execVM "scripts\tasks\createUnits.sqf"; sleep 5; firstmark = false; secondmark = false; thirdmark = false; fourthmark = false; fifthmark = false; sixthmark = false; sevenththmark = true; }; }; locationPicked = false; publicVariable "locationPicked"; newTask setTaskState "Assigned"; publicVariable "newTask"; player setCurrentTask newTask; waitUntil {({alive _x} count units newgroup) == 0 || ({alive _x} count units newgroup) <= unitsLeft}; deleteGroup newgroup; newTask setTaskState "Succeeded"; publicVariable "newTask"; hint format["Objective %1 Complete",taskNumber]; taskNumber = taskNumber + 1; publicVariable "taskNumber"; taskscompletedcount = taskscompletedcount + 1; publicVariable "taskscompletedcount"; firsttask = false; publicVariable "firsttask"; sleep 5; }; }; hint "All done"; createUnits.sqf: //if (!isServer) exitwith {}; // NOTE: in multiplayer, only server should create random numbers. //hint 'CreateUnits is Working'; _marker = _this select 0; _patrolMarker = _this select 1; _unitsMin = _this select 2; _unitsMax = _this select 3; _vehOn = _this select 4; _vehCount = _this select 5; _unitsDif = 0; _unitsDif = (_unitsMax - _unitsMin); _unitsTotal = 0; if (isServer) then { _unitsTotal = round ((random _unitsDif) + unitsMin); publicVariable "_unitsTotal"; }; //hint format["Units Total is %1", _unitsTotal]; //hint format["Vehicles are %1", _vehOn]; _counter = 0; _vehCounter = 0; while {_counter < _unitsTotal} do { "O_Soldier_F" createUnit [getMarkerPos _marker, newgroup, "nul =[this, _patrolMarker, ""random"",""nofollow"",""showmarker""] execvm ""scripts\ups.sqf"""]; if (_vehOn == 1) then { while {_vehCount > _vehCounter} do { _dist = random 45;// this chooses a random distance from 0-45 _dir = random 360;// this selects a random direction from 360 degrees rotation _pos = getMarkerPos _marker; if (isServer) then { _positions = [(_pos select 0) + (sin _dir) * _dist, (_pos select 1) + (cos _dir) * _dist, 0]; }; _vehGroup = createGroup east; _veh = "O_Galkin_MG_F" createVehicle (_positions); _vehDriver = _vehGroup createUnit ["O_Soldier_F", _positions, [], 0, "FORM"]; _vehGunner = _vehGroup createUnit ["O_Soldier_F", _positions, [], 0, "FORM"]; _vehDriver assignAsDriver _veh; _vehDriver moveInDriver _veh; _vehGunner assignAsGunner _veh; _vehGunner moveInGunner _veh; _veh = nil; _vehDriver = nil; _vehGunner = nil; _vehCounter = _vehCounter + 1; }; }; _counter = _counter + 1; }; If anyone has any advice, links, tutorials please help me. It's really bugging me I can't get this working correctly on a dedicated server. Share this post Link to post Share on other sites