ryansoper
Member-
Content Count
65 -
Joined
-
Last visited
-
Medals
Community Reputation
10 GoodAbout ryansoper
-
Rank
Corporal
-
Script won't add magazines? But will add weapon!
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I had no idea this function even existed! Makes life much easier! Now lets see if it works! -
Script won't add magazines? But will add weapon!
ryansoper posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hi guys, I'm currently trying to write part of a larger script and this bit should spawn a gunman and then arm him with 1 of three weapons depending on the roll, and then it will give him three mags for that gun. In testing the gun will be added to the inventory, and the hint inside the ifs for the magazines is displayed, it just won't actually add the magazines. _weaponArray = ["hgun_Pistol_heavy_01_F", "hgun_PDW2000_F", "srifle_DMR_05_tan_f"]; _weapon = selectRandom _weaponArray; _skill = random 1; hint format ["skill = %1", _gunmanPos]; _gunman = "criminal_1" createUnit [ getMarkerPos _gunmanPos, CriminalGroup, "gunman = this;"]; removeAllWeapons gunman; gunman setSkill _skill; gunman addEventHandler ["MPKilled", {call FNC_CalloutConcluded;}]; if (_weapon == "hgun_Pistol_heavy_01_F") then { hint "hgun_Pistol_heavy_01_F"; gunman addMagazine "11Rnd_45ACP_Mag"; gunman addMagazine "11Rnd_45ACP_Mag"; gunman addMagazine "11Rnd_45ACP_Mag"; }; if (_weapon == "hgun_PDW2000_F") then { hint "hgun_PDW2000_F"; gunman addMagazine "30Rnd_9x21_Mag"; gunman addMagazine "30Rnd_9x21_Mag"; gunman addMagazine "30Rnd_9x21_Mag"; }; if (_weapon == "srifle_DMR_05_tan_f") then { hint "srifle_DMR_05_tan_f"; gunman addMagazine "10Rnd_93x64_DMR_05_Mag"; gunman addMagazine "10Rnd_93x64_DMR_05_Mag"; gunman addMagazine "10Rnd_93x64_DMR_05_Mag"; }; gunman addWeapon _weapon; Any ideas what might be going wrong? Let me know if you need more of the code, this is just a snippet that *should* deal with the weapon addition. Ryan -
Persistent variables - Best ways to achieve?
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
This is certainly a very swift solution! I am also interested in how people do link their missions with databases (see dayz and the like where on any server you have the same stats) from a purely educational standpoint to see how it's done. -
Persistent variables - Best ways to achieve?
ryansoper posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
I'm sure this has been asked and answered, but i'm struggling to find anything related. I want to know what the best way to save variables in missions would be so that you can achieve persistence in your missions. For instance, in some of the 'Life' mission types peoples cars and moneys are obvioulsy saved somewhere extrenal so that this information remains true when the mission restarts. I assume it'll write to some kind of database. But how is this achieved? Can anyone point me in the direction any guides on the topic? Also, I have come across https://community.bistudio.com/wiki/profileNamespacewhich appears to allow you to save variables to the profileNamespace, but this seems insecure as a aplayer could just edit the variable amount in their own profile namespace. Any help will be greatly appreciated. Ryan -
Loop won't resume? WaitUntil
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Ah! Thank you! your help is greatly appreciated, the documentation, particularly around threading and multiplayer scripting is patchy at best! I see, so if I were to run this job mutiplayer with say 10 players, I'd end up with 10 abandoned vehicles? -
Loop won't resume? WaitUntil
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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. -
Spawn Editor created missions?
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Perfect! Starred on Git. -
Loop won't resume? WaitUntil
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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? -
I'm wondering if there is anyway I can create a mission in the editor in the usual drag and drop fashion. Then use the scripting engine to generate the mission units within another mission? So for instance, I have a 'mini-missions' script, and I want to create a mission whereby you have to infiltrate a compound and rescue a hostage. Could I make said mission in the editor, then somehow copy the units over so I can spawn the mission from within a larger script? I realize I can script the mission to do this manually, I'm just wondering if this is possible, because it would make the process of making mini missions far quicker/simpler.
-
Loop won't resume? WaitUntil
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Ah! This will be very useful then! -
Loop won't resume? WaitUntil
ryansoper replied to ryansoper's topic in ARMA 3 - MISSION EDITING & SCRIPTING
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 ---------- Do i append this as a launch option? -
Loop won't resume? WaitUntil
ryansoper replied to ryansoper's topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Top bloke! I knew it'd be something simple, but I couldn't for the life of me work it out! -
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
-
Loop won't resume? WaitUntil
ryansoper posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
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 -
Array issue - Why can I not select?!
ryansoper posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
I realise, I probably come across as a right knob, but I cannot for the life of me work out what I'm doing wrong. I have an array, which contains the name of a load of markers: _CSites =["CSite1", "CSite2", "CSite3", "CSite4", "CSite5", "CSite6", "CSite7", "CSite8", "CSite9", "CSite10"]; In order to test the selecting I have a the following: _var = _CSites select 0; hint format ["Pos:", _var]; So i'm expecting the hint in game to display "Pos: CSite1". However, all i see is "Pos: ". What have I done?! EDIT: Sigh, I am a knob, I hadn't formatted the hint correctly...