ryansoper 10 Posted April 6, 2015 I have three files: init.sqf waitUntil {time > 5}; jobactive = false; publicVariable "jobactive"; while {true} do { hint "This Far"; jobSelect = floor(random 2); publicVariable "jobSelect"; jobactive = true; publicVariable "jobactive"; switch (jobSelect) do { case 0: {execVM "jobs\susactivity.sqf";}; case 1: {execVM "jobs\drugsden.sqf";}; }; hint format ["%1", jobactive]; waitUntil (!jobactive); hint format ["After: %1", jobactive]; sleep 20; }; susActivity.sqf jobactive = true; publicVariable "jobactive"; thisjob = true; publicVariable "thisjob"; sleep 3; _SMhint = "<t align='center'><t size='2.2'>CALL INCOMING...</t><br/><t size='1.5' color='#00B2EE'>Abandoned Vehicle</t><br/>____________________<br/>Caller has reported an abandoned vehicle. Please head to the area to investigate.</t>"; hint parsetext _SMhint; _CompleteHint = "<t align='center'><t size='2.2'>JOB COMPLETED</t>>"; _polStationPos = getMarkerPos "polstationmarker"; _position = [_polstationpos, 150, 200, 3, 0, 20, 0] call BIS_fnc_findSafePos; //hint format ["Position: %1",_position]; sideObj = "C_Van_01_box_F" createVehicle _position; sideobj lock true; sideObj setDir random 360; sideObj addAction ["Recover Vehicle", {hint "Recovering vehicle"; sleep 3; deleteVehicle (_this select 0); thisjob = false; publicVariable "thisjob";}]; jobMarker = createMarker ["jobMarker", position player]; "jobMarker" setmarkerpos (position sideobj); "jobMarker" setmarkertext "Abandoned Vehicle"; "jobMarker" setmarkercolor "ColorRed"; "jobMarker" setMarkerAlpha 1; "jobMarker" setmarkerType "hd_dot"; _job = player createSimpleTask ["Suspicious Activity"]; _job setSimpleTaskDescription ["Respond to area an investigate for suspcious activity.","Active Job",""]; _job setTaskState "Assigned"; player setCurrentTask _job; waitUntil {!thisjob}; deleteMarker jobmarker; _job setTaskState "Succeeded"; hint parsetext _completehint; jobactive = false; publicVariable "jobactive"; and drugsden.sqf jobactive = true; publicVariable "jobactive"; _CSites =["CSite1", "CSite2", "CSite3", "CSite4", "CSite5", "CSite6", "CSite7", "CSite8", "CSite9", "CSite10"]; sleep 3; _CompleteHint = "<t align='center'><t size='2.2'>DRUGS DEN CLEARED</t>>"; _SMhint = "<t align='center'><t size='2.2'>CALL INCOMING...</t><br/><t size='1.5' color='#00B2EE'>Possible Drugs Den</t><br/>____________________<br/>Intel suggests the presence of a Drugs den in this area. Please respond to the area and investigate. HIGH CHANCE OF ARMED SUPSECTS. Lethal force is sanctioned.</t>"; hint parsetext _SMhint; _Pos = _CSites select random 10; DenPos = [getMarkerPos _pos, 1, 25, 3, 0, 20, 0] call BIS_fnc_findSafePos; criminalCar = "max_robbers_suv" createVehicle denPos; criminalCar lock true; criminalGroup = [DenPos, EAST, ["max_robber_light", "max_robber_light", "max_robber_light", "Max_robber"], [],[],[],[],[],180] call BIS_fnc_spawnGroup; criminalBoss = "Max_robber_boss" createUnit [ DenPos, criminalGroup, "crimboss = this"]; jobMarker = createMarker ["jobMarker", position player]; "jobMarker" setmarkerpos (position CriminalCar); "jobMarker" setmarkertext "Drugs Den"; "jobMarker" setmarkercolor "ColorRed"; "jobMarker" setMarkerAlpha 1; "jobMarker" setmarkerType "hd_dot"; waitUntil {!alive crimBoss}; criminalCar addAction ["Recover Vehicle", {hint "Recovering vehicle"; sleep 3; deleteVehicle (_this select 0); jobactive = false; publicVariable "jobactive";}]; hint "Boss Dead, Recover the car"; waitUntil {!jobactive}; deleteMarker jobmarker; _job setTaskState "Succeeded"; hint parsetext _completehint; publicVariable "jobactive"; My intention is that the game launches, and it generates one of the jobs. When you clear it. It will then continue the loop and generate another random job. This did work briefly, however for some reason now, I cannot get the loop to resume after the first iteration. I'm not sure if I've just totally messed something up, but I'd appreciate it if someone would take a look. Thanks, Ryan Share this post Link to post Share on other sites
Schatten 287 Posted April 7, 2015 http://forums.bistudio.com/showthread.php?190593-Loop-won-t-resume-WaitUntil Share this post Link to post Share on other sites
killzone_kid 1330 Posted April 7, 2015 -showScriptErrors Share this post Link to post Share on other sites
shuko 59 Posted April 7, 2015 Since you are using publicvariable, I presume you are making a multiplayer mission. In that case, I would suggest not having every machine (server/host and each client) to do the jobselect random. It should be done by just one machine and then PV'd to others. Share this post Link to post Share on other sites
ryansoper 10 Posted April 7, 2015 (edited) Since you are using publicvariable, I presume you are making a multiplayer mission. In that case, I would suggest not having every machine (server/host and each client) to do the jobselect random. It should be done by just one machine and then PV'd to others. I'm very new to the world of multiplayer scripting, so I appreciate the advice, however I'm not sure how I would acheive what you mean? Could you provide a quick example? I've found it very hard to find any info about Multiplayer scripting! I suppose I could detect if the player is the host or if it's a dedicated server and then do the select before handing it off? ---------- Post added at 10:43 AM ---------- Previous post was at 10:42 AM ---------- -showScriptErrors Do i append this as a launch option? Edited April 7, 2015 by RyanSoper Share this post Link to post Share on other sites
killzone_kid 1330 Posted April 7, 2015 Do i append this as a launch option? yep this is game lauch flag Share this post Link to post Share on other sites
ryansoper 10 Posted April 7, 2015 yep this is game lauch flag Ah! This will be very useful then! Share this post Link to post Share on other sites
shuko 59 Posted April 7, 2015 (edited) I haven't opened Arma or scripted in 2 years. Thus, there might be some really simple mistakes. [color="#FF8040"][color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]time[/color] [color="#8B3E2F"][b]>[/b][/color] [color="#FF0000"]5[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color]currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// if variable doesnt exist, set default value. Var might exists even for JIPs due to it being pubvar'd.[/i][/color] [color="#191970"][b]if[/b][/color] [color="#191970"][b]isServer[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// run only on the server[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// create a new thread for the loop so it doesnt stop the init.sqf from continuing[/i][/color] [color="#191970"][b]while[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob [color="#8B3E2F"][b]<[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// no job assigned[/i][/color] currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]floor[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]random[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// random is important to do only on one machine, because you dont want everyone doing their own random, and then everyone sending their conflicting random result to everyone else[/i][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// create a loop on server and clients which will catch the assigned job pubvar'd from server. Could be done with pubvar eventhandler, but let's not confuse more...[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]while[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// job assigned[/i][/color] [color="#191970"][b]switch[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob[color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]case[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]execVM[/b][/color] [color="#7A7A7A"]"jobs\susactivity.sqf"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]case[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]execVM[/b][/color] [color="#7A7A7A"]"jobs\drugsden.sqf"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob [color="#8B3E2F"][b]<[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// no job assigned[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter susActivity [color="#FF8040"]jobdone0 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_SMhint[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"<t align='center'><t size='2.2'>CALL INCOMING...</t><br/><t size='1.5' color='#00B2EE'>Abandoned Vehicle</t><br/>____________________<br/>Caller has reported an abandoned vehicle. Please head to the area to investigate.</t>"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#1874CD"]_SMhint[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_CompleteHint[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"<t align='center'><t size='2.2'>JOB COMPLETED</t>>"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_polStationPos[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"polstationmarker"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_position[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_polstationpos[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]150[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]200[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]20[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]call[/b][/color] BIS_fnc_findSafePos[color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format ["Position: %1",_position];[/i][/color] sideObj [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"C_Van_01_box_F"[/color] [color="#191970"][b]createVehicle[/b][/color] [color="#1874CD"]_position[/color][color="#8B3E2F"][b];[/b][/color] sideobj [color="#191970"][b]lock[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] sideObj [color="#191970"][b]setDir[/b][/color] [color="#191970"][b]random[/b][/color] [color="#FF0000"]360[/color][color="#8B3E2F"][b];[/b][/color] sideObj [color="#191970"][b]addAction[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Recover Vehicle"[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]hint[/b][/color] [color="#7A7A7A"]"Recovering vehicle"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]deleteVehicle[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] jobdone0 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"jobdone0"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] jobMarker [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]createMarker[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"jobMarker"[/color][color="#8B3E2F"][b],[/b][/color] [color="#191970"][b]position[/b][/color] [color="#000000"]player[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerPos[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]position[/b][/color] sideobj[color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerText[/b][/color] [color="#7A7A7A"]"Abandoned Vehicle"[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerColor[/b][/color] [color="#7A7A7A"]"ColorRed"[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerAlpha[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerType[/b][/color] [color="#7A7A7A"]"hd_dot"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]createSimpleTask[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Suspicious Activity"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setSimpleTaskDescription[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Respond to area an investigate for suspcious activity."[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"Active Job"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]""[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setTaskState[/b][/color] [color="#7A7A7A"]"Assigned"[/color][color="#8B3E2F"][b];[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]setCurrentTask[/b][/color] [color="#1874CD"]_job[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]jobdone0[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]deleteMarker[/b][/color] jobmarker[color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setTaskState[/b][/color] [color="#7A7A7A"]"Succeeded"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#1874CD"]_completehint[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// unassign current job[/i][/color] currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter Edited April 7, 2015 by Shuko Share this post Link to post Share on other sites
ryansoper 10 Posted April 7, 2015 (edited) I haven't opened Arma or scripted in 2 years. Thus, there might be some really simple mistakes. [color="#FF8040"][color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]time[/color] [color="#8B3E2F"][b]>[/b][/color] [color="#FF0000"]5[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color]currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// if variable doesnt exist, set default value. Var might exists even for JIPs due to it being pubvar'd.[/i][/color] [color="#191970"][b]if[/b][/color] [color="#191970"][b]isServer[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// run only on the server[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// create a new thread for the loop so it doesnt stop the init.sqf from continuing[/i][/color] [color="#191970"][b]while[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob [color="#8B3E2F"][b]<[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// no job assigned[/i][/color] currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]floor[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]random[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// random is important to do only on one machine, because you dont want everyone doing their own random, and then everyone sending their conflicting random result to everyone else[/i][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// create a loop on server and clients which will catch the assigned job pubvar'd from server. Could be done with pubvar eventhandler, but let's not confuse more...[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]while[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// job assigned[/i][/color] [color="#191970"][b]switch[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob[color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]case[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]execVM[/b][/color] [color="#7A7A7A"]"jobs\susactivity.sqf"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]case[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]execVM[/b][/color] [color="#7A7A7A"]"jobs\drugsden.sqf"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob [color="#8B3E2F"][b]<[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// no job assigned[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter susActivity [color="#FF8040"]jobdone0 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_SMhint[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"<t align='center'><t size='2.2'>CALL INCOMING...</t><br/><t size='1.5' color='#00B2EE'>Abandoned Vehicle</t><br/>____________________<br/>Caller has reported an abandoned vehicle. Please head to the area to investigate.</t>"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#1874CD"]_SMhint[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_CompleteHint[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"<t align='center'><t size='2.2'>JOB COMPLETED</t>>"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_polStationPos[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"polstationmarker"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_position[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_polstationpos[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]150[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]200[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]20[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]call[/b][/color] BIS_fnc_findSafePos[color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format ["Position: %1",_position];[/i][/color] sideObj [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"C_Van_01_box_F"[/color] [color="#191970"][b]createVehicle[/b][/color] [color="#1874CD"]_position[/color][color="#8B3E2F"][b];[/b][/color] sideobj [color="#191970"][b]lock[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] sideObj [color="#191970"][b]setDir[/b][/color] [color="#191970"][b]random[/b][/color] [color="#FF0000"]360[/color][color="#8B3E2F"][b];[/b][/color] sideObj [color="#191970"][b]addAction[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Recover Vehicle"[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]hint[/b][/color] [color="#7A7A7A"]"Recovering vehicle"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]deleteVehicle[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] jobdone0 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"jobdone0"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] jobMarker [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]createMarker[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"jobMarker"[/color][color="#8B3E2F"][b],[/b][/color] [color="#191970"][b]position[/b][/color] [color="#000000"]player[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerPos[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]position[/b][/color] sideobj[color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerText[/b][/color] [color="#7A7A7A"]"Abandoned Vehicle"[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerColor[/b][/color] [color="#7A7A7A"]"ColorRed"[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerAlpha[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerType[/b][/color] [color="#7A7A7A"]"hd_dot"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]createSimpleTask[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Suspicious Activity"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setSimpleTaskDescription[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Respond to area an investigate for suspcious activity."[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"Active Job"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]""[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setTaskState[/b][/color] [color="#7A7A7A"]"Assigned"[/color][color="#8B3E2F"][b];[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]setCurrentTask[/b][/color] [color="#1874CD"]_job[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]jobdone0[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]deleteMarker[/b][/color] jobmarker[color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setTaskState[/b][/color] [color="#7A7A7A"]"Succeeded"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#1874CD"]_completehint[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// unassign current job[/i][/color] currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter Given your version ago, It appears to generate a mission, but will not go back to the selector again to select a new mission. Any ideas as to why? Edited April 7, 2015 by RyanSoper Share this post Link to post Share on other sites
ryansoper 10 Posted April 8, 2015 My current files: [code][color="#FF8040"][color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]time[/color] [color="#8B3E2F"][b]>[/b][/color] [color="#FF0000"]5[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isNil[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color]currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// if variable doesnt exist, set default value. Var might exists even for JIPs due to it being pubvar'd.[/i][/color] [color="#191970"][b]if[/b][/color] [color="#191970"][b]isServer[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// run only on the server[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// create a new thread for the loop so it doesnt stop the init.sqf from continuing[/i][/color] [color="#191970"][b]while[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]currentjob [color="#8B3E2F"][b]<[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// no job assigned[/i][/color] currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]floor[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]random[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// random is important to do only on one machine, because you dont want everyone doing their own random, and then everyone sending their conflicting random result to everyone else[/i][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]while[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]true[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]currentjob [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// job assigned[/i][/color] [color="#191970"][b]hint[/b][/color] [color="#7A7A7A"]"Mission Selector"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]switch[/b][/color] [color="#8B3E2F"][b]([/b][/color]currentjob[color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]case[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]execVM[/b][/color] [color="#7A7A7A"]"jobs\susactivity.sqf"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]case[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b]:[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]execVM[/b][/color] [color="#7A7A7A"]"jobs\drugsden.sqf"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]currentjob [color="#8B3E2F"][b]<[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// no job assigned[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter[/code] and susactivity.sqf [code][color="#FF8040"]jobdone0 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_SMhint[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"<t align='center'><t size='2.2'>CALL INCOMING...</t><br/><t size='1.5' color='#00B2EE'>Abandoned Vehicle</t><br/>____________________<br/>Caller has reported an abandoned vehicle. Please head to the area to investigate.</t>"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#1874CD"]_SMhint[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_CompleteHint[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"<t align='center'><t size='2.2'>JOB COMPLETED</t>>"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_polStationPos[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]getMarkerPos[/b][/color] [color="#7A7A7A"]"polstationmarker"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_position[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_polstationpos[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]150[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]200[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]20[/color][color="#8B3E2F"][b],[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]call[/b][/color] BIS_fnc_findSafePos[color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//hint format ["Position: %1",_position];[/i][/color] sideObj [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"C_Van_01_box_F"[/color] [color="#191970"][b]createVehicle[/b][/color] [color="#1874CD"]_position[/color][color="#8B3E2F"][b];[/b][/color] sideobj [color="#191970"][b]lock[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] sideObj [color="#191970"][b]setDir[/b][/color] [color="#191970"][b]random[/b][/color] [color="#FF0000"]360[/color][color="#8B3E2F"][b];[/b][/color] sideObj [color="#191970"][b]addAction[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Recover Vehicle"[/color][color="#8B3E2F"][b],[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]hint[/b][/color] [color="#7A7A7A"]"Recovering vehicle"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]sleep[/b][/color] [color="#FF0000"]3[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]deleteVehicle[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_this[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] jobdone0 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"jobdone0"[/color][color="#8B3E2F"][b];[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] jobMarker [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]createMarker[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"jobMarker"[/color][color="#8B3E2F"][b],[/b][/color] [color="#191970"][b]position[/b][/color] [color="#000000"]player[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerPos[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]position[/b][/color] sideobj[color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerText[/b][/color] [color="#7A7A7A"]"Abandoned Vehicle"[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerColor[/b][/color] [color="#7A7A7A"]"ColorRed"[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerAlpha[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b];[/b][/color] [color="#7A7A7A"]"jobMarker"[/color] [color="#191970"][b]setMarkerType[/b][/color] [color="#7A7A7A"]"hd_dot"[/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]createSimpleTask[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Suspicious Activity"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setSimpleTaskDescription[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Respond to area an investigate for suspcious activity."[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"Active Job"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]""[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setTaskState[/b][/color] [color="#7A7A7A"]"Assigned"[/color][color="#8B3E2F"][b];[/b][/color] [color="#000000"]player[/color] [color="#191970"][b]setCurrentTask[/b][/color] [color="#1874CD"]_job[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]jobdone0[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]deleteMarker[/b][/color] jobmarker[color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_job[/color] [color="#191970"][b]setTaskState[/b][/color] [color="#7A7A7A"]"Succeeded"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#1874CD"]_completehint[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// unassign current job[/i][/color] currentjob [color="#8B3E2F"][b]=[/b][/color] [color="#FF0000"]-1[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"currentjob"[/color][color="#8B3E2F"][b];[/b][/color] [/color] Made with KK's SQF to BBCode Converter[/code] It's happy to spawn one initial mission, and it will complete and display the hint, but it will not then spawn another mission. I think it might be something to do with the thread not having visibility of the updated variable? Is there a command you need to use in threading to pull the latest version of a variable? I saw something in some documentation about the threads not having access to variables in the same scope as it, but they can view global variables. Share this post Link to post Share on other sites
shuko 59 Posted April 8, 2015 Well, I actually started up the game just for you! ;) I changed it so that it will not have a possibility to assign the same task multiple times. [color="#FF8040"][color="#191970"][b]if[/b][/color] [color="#191970"][b]isServer[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color] SHK_AvailableTasks [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"susactivity"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"drugsden"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// Available tasks, array of script names.[/i][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]spawn[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]time[/color] [color="#8B3E2F"][b]>[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_cnt"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_rnd"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]while[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#1874CD"]_cnt[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]count[/b][/color] SHK_AvailableTasks[color="#8B3E2F"][b];[/b][/color] [color="#1874CD"]_cnt[/color] [color="#8B3E2F"][b]>[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// Run as long as there are tasks left.[/i][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#191970"][b]isNil[/b][/color] [color="#7A7A7A"]"SHK_CurrentTask"[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// Wait until a new task is requested.[/i][/color] [color="#1874CD"]_rnd[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]floor[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#191970"][b]random[/b][/color] [color="#1874CD"]_cnt[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// Randomly select a task from available tasks.[/i][/color] SHK_CurrentTask [color="#8B3E2F"][b]=[/b][/color] SHK_AvailableTasks [color="#191970"][b]select[/b][/color] [color="#1874CD"]_rnd[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"SHK_CurrentTask"[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// Tell clients which task to create.[/i][/color] SHK_AvailableTasks [color="#8B3E2F"][b]=[/b][/color] SHK_AvailableTasks [color="#8B3E2F"][b]-[/b][/color] [color="#8B3E2F"][b][[/b][/color]SHK_CurrentTask[color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// Remove current task from available tasks.[/i][/color] [color="#191970"][b]execVM[/b][/color] [color="#191970"][b]format[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"jobs\%1.sqf"[/color][color="#8B3E2F"][b],[/b][/color]SHK_CurrentTask[color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// Create and assign task.[/i][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]else[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#006400"][i]// Client eventhandler which will catch pubvar from server about an assigned task.[/i][/color] [color="#7A7A7A"]"SHK_CurrentTask"[/color] [color="#191970"][b]addPublicVariableEventHandler[/b][/color] [color="#8B3E2F"][b]{[/b][/color] [color="#191970"][b]execVM[/b][/color] [color="#191970"][b]format[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"jobs\%1.sqf"[/color][color="#8B3E2F"][b],[/b][/color]SHK_CurrentTask[color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color][/color] Made with KK's SQF to BBCode Converter Example of needed stuff in a job/task script. [color="#FF8040"]jobdone1 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]false[/color][color="#8B3E2F"][b];[/b][/color] jobdone1 [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]true[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]publicVariable[/b][/color] [color="#7A7A7A"]"jobdone1"[/color][color="#8B3E2F"][b];[/b][/color] [color="#191970"][b]waitUntil[/b][/color] [color="#8B3E2F"][b]{[/b][/color]jobdone1[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] SHK_CurrentTask [color="#8B3E2F"][b]=[/b][/color] [color="#000000"]nil[/color][color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]// Get new task.[/i][/color][/color] Made with KK's SQF to BBCode Converter It is important to keep in mind that the job script is run on each machine. That means, for example, when you spawn stuff (createvehicle), you will create server + count of clients times the object. To avoid that, these commands need to put into a if isserver check within the job script. test mission Share this post Link to post Share on other sites
ryansoper 10 Posted April 8, 2015 Ah! Thank you! your help is greatly appreciated, the documentation, particularly around threading and multiplayer scripting is patchy at best! It is important to keep in mind that the job script is run on each machine. That means, for example, when you spawn stuff (createvehicle), you will create server + count of clients times the object. To avoid that, these commands need to put into a if isserver check within the job script. I see, so if I were to run this job mutiplayer with say 10 players, I'd end up with 10 abandoned vehicles? Share this post Link to post Share on other sites
shuko 59 Posted April 8, 2015 I see, so if I were to run this job mutiplayer with say 10 players, I'd end up with 10 abandoned vehicles? Yes, unless the behaviour of createVehicle has been altered in the past 1-2 years. Share this post Link to post Share on other sites