Sgt_HARTMAN Posted August 27, 2019 Share Posted August 27, 2019 Hello everyone. Would anyone know how to randomize the appearance of the main missions? Indeed, I would like to do as on the old I & A at least two years old. That is, start the first mission anywhere on Altis and at the end of it, select another random location and no longer work with the "controlled zones". After several attempts to modify scripts in "fn_getAo.sqf" and "MainAos.hpp, I can not find a solution to what I want to achieve. I thank you in advance for your help. Sorry for any mistakes in my sentences, I am French and my English is not great ... Sgt_HARTMAN Link to comment Share on other sites More sharing options...
Stanhope Posted August 27, 2019 Share Posted August 27, 2019 This is a little script I've written to find the closest AO to a given position, you can probably tweak it to pick a random AO: private _sortedByRange = [allMapMarkers, [_pos], {(getMarkerPos _x) distance2D _input0}, "ASCEND"] call BIS_fnc_sortBy; private _breakOut = false; { if (markerType _x == "Empty") then { private _name = (missionConfigFile >> "Main_Aos" >> "AOs" >> _x >> "name") call BIS_fnc_getCfgData; if (!isNil "_name") then { if (str _name != "any") then { private _result = [format ["Do you want to set %1 as the next AO?", _name], "", "Yes", "No"] call BIS_fnc_guiMessage; if (_result) exitWith { manualAO = _x; publicVariableServer "manualAO"; hint (_name + " set as next AO."); _breakOut = true; }; if (!_result) exitWith { hint "Did nothing"; _breakOut = true; }; }; }; }; if (_breakOut) exitWith {}; } forEach _sortedByRange; Link to comment Share on other sites More sharing options...
Sgt_HARTMAN Posted August 28, 2019 Author Share Posted August 28, 2019 Thank you for your answer. Under which script did you integrate it and by which is it called? I am version I & A 3.35. thank you in advance Link to comment Share on other sites More sharing options...
Stanhope Posted August 28, 2019 Share Posted August 28, 2019 Well probably fn_getAo.sqf but as I said this is some code I've made to find the closest AO to a given location. You'll need to alter it for it to pick a random AO. Link to comment Share on other sites More sharing options...
Sgt_HARTMAN Posted August 28, 2019 Author Share Posted August 28, 2019 I am not an expert in scripting, I made several attempts but unsuccessful. Would there be another way to only change the order of appearance? In my tests I changed the order of "Class" in "MainAos.hpp" but the first AO spawn always to "Atkinarki". Would there be another script determining the order of appearance of "Aos"? Thanks Link to comment Share on other sites More sharing options...
Stanhope Posted August 29, 2019 Share Posted August 29, 2019 private _nextAO = ""; if (manualAO != "") then { _nextAO = manualAO; }; while {_nextAO == ""} do { private _testAO = selectRandom allMapMarkers; private _testAOName = (missionConfigFile >> "Main_Aos" >> "AOs" >> _x >> "name") call BIS_fnc_getCfgData; if (!isNil "_name") then { if (str _name != "any") then { if (!(_nextAO in controlledZones)) then { _nextAO = _testAO; }; }; }; }; _nextAO Replace whatever is in fn_getAo by this. Don't know if it works or not, I didn't test it. Link to comment Share on other sites More sharing options...
Sgt_HARTMAN Posted August 29, 2019 Author Share Posted August 29, 2019 I tried to declare the variable or replace _x with _AO_Entry by declaring _AO_Entry = _this select 0; but it does not work, I will try other things while waiting for some help. Thank you Link to comment Share on other sites More sharing options...
Stanhope Posted August 29, 2019 Share Posted August 29, 2019 You should really learn some scripting if you want to edit scripts to make them do something else. private _nextAO = ""; if (manualAO != "") then { _nextAO = manualAO; }; while {_nextAO == ""} do { private _testAO = selectRandom allMapMarkers; private _testAOName = (missionConfigFile >> "Main_Aos" >> "AOs" >> _testAO >> "name") call BIS_fnc_getCfgData; if (!isNil "_name") then { if (str _name != "any") then { if (!(_nextAO in controlledZones)) then { _nextAO = _testAO; }; }; }; }; _nextAO This should fix that, still untested. Link to comment Share on other sites More sharing options...
Sgt_HARTMAN Posted September 1, 2019 Author Share Posted September 1, 2019 That's what I do, I learn by integrating pre-edited scripts and create some basic ones. I & A is quite complex and it allows me to learn. I thank you for the advice you give me because you help me to learn even if I know you have more important things to do. I tried the last script you gave me but unfortunately nothing happens. the main and secondaries missions don't spawn but no error messages appears. Would this be a problem with "(_nextAO in controlledZones)" or because the "manualAO" should be called by another scipt ? or quite simply manually called by an admin command in game ? I will continue my tests by modifying the script in "MainMachine.sqf" thanks for your help. Link to comment Share on other sites More sharing options...
Stanhope Posted September 1, 2019 Share Posted September 1, 2019 Well I was assuming you didn't edit anything elsewhere. I'm away from my pc for a while so I can't help you. Link to comment Share on other sites More sharing options...
Sgt_HARTMAN Posted September 1, 2019 Author Share Posted September 1, 2019 Thank you, I just found how to move the spawn point of the first AO and following. I keep looking how spawn the AOs as in the 2.82 version of the invade & annex Do I wish you a good holiday ? lol Thank's Link to comment Share on other sites More sharing options...
Sgt_HARTMAN Posted October 4, 2019 Author Share Posted October 4, 2019 Hello world, I allow myself to UP this subject because because I did not find the solution. I understood why the sides did not appear and have fixed it. thank you in advance Link to comment Share on other sites More sharing options...
Stanhope Posted October 4, 2019 Share Posted October 4, 2019 private _nextAO = ""; if (manualAO != "") then { _nextAO = manualAO; }; while {_nextAO == ""} do { private _testAO = selectRandom allMapMarkers; private _testAOName = (missionConfigFile >> "Main_Aos" >> "AOs" >> _testAO >> "name") call BIS_fnc_getCfgData; if (!isNil "_testAOName") then { if (str _testAOName != "any") then { if (!(_nextAO in controlledZones)) then { _nextAO = _testAO; }; }; }; }; _nextAO Try that, didn't test it myself though. Sgt_HARTMAN 1 Link to comment Share on other sites More sharing options...
Sgt_HARTMAN Posted October 5, 2019 Author Share Posted October 5, 2019 Thank you very much, this works perfectly, without any modification. I am very grateful for the help you have given me. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now