lawman_actual 24 Posted July 18, 2018 I am trying to get to the bottom of why not all assets from some mods are made available for a zeus curator when initiated through an in-game script. Note that this is not related to needing to adjust the module to read "all addons including unofficial ones" in the editor. I have a script which creates a curator module and assigns it to the designated player (usually me), and is supposed to add all addons to it. This works fine with almost everything; all vanilla factions are added without fault and almost all downloaded mods. However, for a couple of faction mods, some assets are not being added even when some of them are. While it is usually quite consistent which fail to add, it is not always completely. At first I assumed it was a case of some assets in the mod having scopeCurator set such that this was intended, but even having been into the configs and successfully changed it, it still fails most the time. It also wouldn't explain why on some occasions these assets do get added. Here is the script I have been using to add the curator and configure it in singleplayer: _unit = player; // Exit if unit is already curator if (!isNull (getAssignedCuratorLogic _unit)) exitWith { systemChat format["[Zeus] Logic already assigned to %1, remove it first",name _unit]; }; private _curator = missionNamespace getVariable [format["f_zeusCurator_%1",getPlayerUID _unit],objNull]; // Check curator exists, if not create it if !(isNull _curator) then { format["[Zeus] Curator variable already assigned to %1, reassigning", name _unit] remoteExec ["systemChat",_unit]; unassignCurator _curator; deleteVehicle _curator; sleep 1; } else { //format["No Curator.", _curator] remoteExec ["systemChat",_unit]; unassignCurator _curator; f_var_sideCenter = createCenter sideLogic; format["Creating....", _curator] remoteExec ["systemChat",_unit] }; _var = missionNameSpace getVariable ["l_var_sideLogic","Fail"]; // Create a new curator logic _curator = (createGroup f_var_sideCenter) createUnit ["ModuleCurator_F",[0,0,0],[],0,""]; _curator setVariable ["owner",format["%1",getPlayerUID _unit],true]; _curator setVariable ["showNotification",false,true]; _curator setVariable ["Addons",3,true]; //Set Zeus Vision Modes [_curator, [-1, -2, 0]] call bis_fnc_setcuratorvisionmodes; // Assign the passed unit as curator //_unit assignCurator _curator; _unit assignCurator _curator; private _curator = getAssignedCuratorLogic _unit; systemChat format["Curator: %1", _curator];; if (isNull _curator) then { _curator = _unit; }; // If curator is null or not the correct logic exit with an error message. if (isNull _curator || typeOf _curator != "ModuleCurator_F") exitWith { systemChat format["Failed to resolve curator for %1", _unit]; }; // Decide which addons to add based on passed mode _mode = True; _addons = []; switch (typeName _mode) do { case "ARRAY"; case "STRING": { if (_mode isEqualType "") then { if (_mode == "basic") then { // Load predefined basic modules _mode = ["A3_Data_F","A3_Data_F_Curator","A3_Functions_F_Curator","A3_Misc_F","A3_Modules_F_EPB","A3_Ui_F_Curator","A3_Modules_F_Curator","A3_Modules_F_Curator_Misc","CuratorOnly_Modules_F_Curator_Chemlights","CuratorOnly_Modules_F_Curator_Environment","CuratorOnly_Modules_F_Curator_Flares","CuratorOnly_Modules_F_Curator_Ordnance","CuratorOnly_Modules_F_Curator_Smokeshells","A3_Modules_F_Bootcamp","A3_Modules_F_Bootcamp_Misc"]; } else { // Convert to array _mode = [_mode]; }; }; { if (isClass (configFile >> "cfgPatches" >> _x)) then { _addons pushBack (configName (configFile >> "cfgPatches" >>_x)); }; } forEach _mode; }; case "BOOL": { if (_mode) then { // If true was passed, add all available addons to curator list _cfgPatches = configFile >> "cfgPatches"; for "_i" from 0 to (count _cfgPatches - 1) do { _class = _cfgPatches select _i; if (isClass _class) then { _addons pushBack (configName _class); }; }; } else { removeAllCuratorAddons _curator; }; }; }; // Nothing to add! if (count _addons == 0) exitWith {}; // Remove existing addons removeAllCuratorAddons _curator; _curator addCuratorAddons _addons; systemChat format["[Zeus] Added %1 addons",count _addons]; // Reduce costs for all actions _curator setCuratorWaypointCost 0; { _curator setCuratorCoef [_x,0]; } forEach ["place","edit","delete","destroy","group","synchronize"]; systemChat format["[Zeus] Curator set-up complete for %1.",name _unit]; _unit assignCurator _curator; I have checked my patch file that is supposed to be fixing this to ensure that the vehicles are listed in cfgPatches, and that the assets I am looking for have scopeCurator = 2. I am not getting any error messages other than: Quote [BIS_fnc_activateAddons] The function can be run only during the mission init This confuses me because I read on a biki page that addons can be added "on the fly" for a curator, and it works despite this error message for most addons. So I'm not entirely sure what to be looking for from here. Pointers appreciated. Cheers, Law Share this post Link to post Share on other sites
Larrow 2822 Posted July 22, 2018 On 7/18/2018 at 8:25 PM, lawman_actual said: This confuses me because I read on a biki page that addons can be added "on the fly" for a curator, They can, but if adding addons that are not activated, as in they may not be in the required addons of the mission, then it will try to activate them which you can only do before time is > 0. Where exactly are you running this code from? pre/postInit, initServer, initPlayerLocal? May be worth doing it from pre/postInit. From the looks of your error I'm going to guess that this is happening post time = 0 and the error is coming from the module initialisation where it tries to add addons that are not activated. There seems little point in doing... On 7/18/2018 at 8:25 PM, lawman_actual said: // If true was passed, add all available addons to curator list _cfgPatches = configFile >> "cfgPatches"; for "_i" from 0 to (count _cfgPatches - 1) do { _class = _cfgPatches select _i; if (isClass _class) then { _addons pushBack (configName _class); }; }; ...as this should be handled already by spawning the curator module with... On 7/18/2018 at 8:25 PM, lawman_actual said: _curator = (createGroup f_var_sideCenter) createUnit ["ModuleCurator_F",[0,0,0],[],0,""]; _curator setVariable ["owner",format["%1",getPlayerUID _unit],true]; _curator setVariable ["showNotification",false,true]; _curator setVariable ["Addons",3,true]; //<<< this means all addons ...as the Addons attribute does exactly the same code as you have shown, during initialisation of the module via its function. It may be worth using the Type createUnit [ pos, grp, init ] variant and using the init to add the attributes so you know they are there immediately at module creation. Share this post Link to post Share on other sites
lawman_actual 24 Posted July 23, 2018 Thanks for the reply Larrow, glad to finally have some response on this. On 7/22/2018 at 10:54 AM, Larrow said: From the looks of your error I'm going to guess that this is happening post time = 0 Correct, I have been running the code through a debug console in singleplayer during the mission or 'post-init / time = 0'. (console made available with mod) Essentially my aim was to use zeus and the console to get extra functionality from some SP missions downloaded from the workshop (such as Dynamic Recon Ops). With the console and zeus I've been happily 'tailoring' workshop missions to my own preferences, without having to go into the editor and manually edit them all each time one is updated. But since the mission does not by default have a curator, or any required addons, I guess I can start to see where the issues occurs based on your information about activating addons. On 7/22/2018 at 10:54 AM, Larrow said: There seems little point in doing... ...as this should be handled already by spawning the curator module with... ...as the Addons attribute does exactly the same code as you have shown, during initialisation of the module via its function. Good to know. I had been trying to figure out why even when removing the line "addCuratorAddons" I was still getting access to assets. I would guess the reason for building an array of available addons is because the script was originally developed, by another member of the community I play with, such that whoever is calling the script can choose if they give the designated curator access to no addons, official addons only, or all addons. This would explain why later on the following is included, no?: removeAllCuratorAddons _curator; _curator addCuratorAddons _addons; Within this context however, I am the only one in the game and I would like to think I can trust myself around myself. In which case you are correct and I shall remove the unnecessary lines. On 7/22/2018 at 10:54 AM, Larrow said: It may be worth using the Type createUnit [ pos, grp, init ] variant and using the init to add the attributes so you know they are there immediately at module creation. Not entirely following your suggestion here. Use createUnit just to check that the unit can be created in the first place? And my final comment; although I now understand a bit more about what it means to 'activate' an addon, I'm still unsure why doing this in a single player context, post-init seems to fail only for specific assets within specific mods. I will continue to run some tests but if anyone can shed some light in the meantime that would be great. Thanks again, Law Share this post Link to post Share on other sites
Larrow 2822 Posted July 24, 2018 On 7/23/2018 at 10:41 AM, lawman_actual said: This would explain why later on the following is included, no?: Yes, and again this is included in the module initialisation. On 7/23/2018 at 10:41 AM, lawman_actual said: Not entirely following your suggestion here. Use createUnit just to check that the unit can be created in the first place? No, instead of... On 7/18/2018 at 8:25 PM, lawman_actual said: // Create a new curator logic _curator = (createGroup f_var_sideCenter) createUnit ["ModuleCurator_F",[0,0,0],[],0,""]; _curator setVariable ["owner",format["%1",getPlayerUID _unit],true]; _curator setVariable ["showNotification",false,true]; _curator setVariable ["Addons",3,true]; ...do... // Create a new curator logic _curator = "ModuleCurator_F" createUnit [ [0,0,0], (createGroup f_var_sideCenter), format[ " this setVariable ['owner',format['%1',getPlayerUID ( '%1' call BIS_fnc_objectFromNetId ) ],true]; this setVariable ['showNotification',false,true]; this setVariable ['Addons',3,true]; ", _unit call BIS_fnc_netId ]]; ...I have noticed from messing around with initialising other modules through script that this is the best way of doing it, as the attributes are there straight in the object init much like how they behave from the editor. Otherwise I have noticed that on occasion, particularly with modules with a larger list of attributes, it can sometimes cause problems with the attributes not being set in time for when the modules script queries the module for its attribute values. On 7/23/2018 at 10:41 AM, lawman_actual said: post-init seems to fail only for specific assets within specific mods Does it 100%? Previously you said... On 7/18/2018 at 8:25 PM, lawman_actual said: However, for a couple of faction mods, some assets are not being added even when some of them are. While it is usually quite consistent which fail to add, it is not always completely. I expect the easiest way to accomplish this or to test it properly, seeing as you do not wish to touch the mission itself, is to make a mod that automatically creates a curator module for all missions via a CfgFunctions preInit function. Within this function just create the module, which initialises addons via the modules attribute 'Addons'. If you need automatic curator assignment (the unit who is to be zeus) also spawn a thread that waits until the player is not null and only then assign them as curator. If the mission is still missing addons when done this way then there must be something else going on. Share this post Link to post Share on other sites
lawman_actual 24 Posted July 24, 2018 38 minutes ago, Larrow said: Does it 100%? Previously you said... Should probably have been a bit more careful with my wording. There appear to be some groups which work every time, and some which I have never seen added. There are a small minority that I have seen work sometimes but not others. I haven't yet worked out a way of reproducing this, though I haven't tried very hard for this exact issue yet. I will investigate your advice regarding creating the module with attributes set in the init, simply out of curiosity. But I will also explore a curator-giving mod that handles things pre-init, since this sounds like the most efficient and reliable way to meet my needs. Thanks again Larrow, I'll report back if I find anything interesting or confuse myself. Cheers, Law Share this post Link to post Share on other sites
lawman_actual 24 Posted July 25, 2018 I believe I have successfully created a mod to create the module preInit. However I am still seeing issues with the mod I am trying to fix (though the mod has now saved me 30 seconds or so per scenario playthrough, which is nice). Now, however, I am seeing an error message when I open the zeus interface: Quote No entry 'bin\config.bin/CfgVehicles.SPOTTER'. This is similar to an error I had been seeing previous, which I (rather painstakingly) managed to find and fix: Quote No entry 'bin\config.bin/BOATBOATBOAT'. It turned out to be a line referenced in a group composition for a vehicle class that did not exist. Since fixing this error I had seen tank units successfully appearing sometimes, whereas before I had not. I surmised that this error was causing the process to hang when adding assets. Curious that I had not seen the SPOTTER error before, but I will investigate further and see if I can find the source. Cheers, Law Share this post Link to post Share on other sites
lawman_actual 24 Posted July 25, 2018 Fixed the SPOTTER issue. No longer seeing error messages for this particular mod, however still some assets remain inaccessible. For example; none of the helicopters within the VME PLA mod appear. And yet, as far as I can see, these assets have scopeCurator = 2, are defined in the mod's cfgPatches under units = { }, and have the correct requriedAddons. I'm pretty stumped at the moment. Share this post Link to post Share on other sites
lawman_actual 24 Posted July 25, 2018 Through ongoing discussion between myself and @Larrow, we have found that the root of the issue within VME's PLA mod relates to the crew of affected vehicles not having an associated cfgPatch entry. The original mod maker can fix this by going back into their cfgPatches entry and ensuring the crew member is properly included. Alternatively replace the crewman with a different and working entity: crew = "newAndWorkingCrewman"; Hopefully other mods exhibiting similar symptoms are also experiencing this issue. Many thanks to Larrow for his help on this one, Lawman 1 Share this post Link to post Share on other sites
lawman_actual 24 Posted September 11, 2018 So...in a related issue, it would appear that if I have a curator initialised (preinit) with all addons successfully activated, and then create a highCommand module for myself using the debug console, certain units are no longer accessible through the curator. In testing I have seen this issue in a blank editor scenario with VME's PLA mod installed. I also have a feeling I have seen this issue with one or two other mods, including a British Armed Forces one. Here is the code I use to make myself a HC leader: createCenter sideLogic; _group = createGroup sideLogic; _logicCmd = _group createUnit ["HighCommand", [0, 0, 0], [], 0, "NONE"]; _logicCmd synchronizeObjectsAdd [player]; And here is the hc.sqf file which runs when the module is created. scriptName "HC\data\scripts\HC.sqf"; /* File: HC.sqf Author: Karel Moricky Description: Init script - High Command Parameter(s): _this: the HC logic unit which triggered this script. */ if (is3DEN) exitwith {}; textLogFormat["HC-PRELOAD_ HC.sqf start..."]; _logic = _this select 0; _logic setpos [1000,10,0]; _group = group _logic; //--- HC main is laready running _isMain = if (_logic == BIS_HC_mainscope) then {true} else {false}; //if (_isMain) then {startLoadingScreen ['High Command']}; //--- Code executed only on first HC scope if (_isMain) then { //SPACE selects last unit that reported, variables: HC_lastUnitReporting = []; //hc unit - array of groups HC_lastUnitReportingTime = 0; HC_lastUnitReportingMarkerName = ""; HC_lastUnitReportingTimeMax = 45; //no older reports than this from teams are considered _logic setvariable ["sound",false]; //--- Execute MARTA if (isNil "BIS_MARTA_mainScope") then {//create MARTA only once, avoid creating too much groups activateaddons ["A3_Modules_F_Marta"]; _logicMARTA =(group _logic) createunit ["MartaManager",position player,[],0,"none"]; //BIS_MARTA_mainScope = _logicMARTA; //TODO: look at this (it is here because init handler of marta (setting BIS_MARTA_mainScope) runs maybe too late (after initialization of whole WF) }; //waituntil {count (BIS_marta_mainscope getvariable "allgroups") > 0}; //_logicMARTA = BIS_marta_mainscope; }; //--- Scope name for "_i" from 0 to 1000 do { _name = format ["BIS_HC_%1",_i]; if (isnil _name) exitwith {call compile format ["%1 = _logic",_name]}; }; //--- Synchronization waituntil {{typeof _x != "HighCommandSubordinate"} count (synchronizedObjects _logic) > 0 || _logic == bis_hc_mainscope}; _possibleLeaders = synchronizedObjects _logic; _groupColors = ["teammain","teamgreen","teamblue","teamyellow"]; _sublogics = []; for "_i" from 0 to (count _possibleLeaders - 1) do { _element = _possibleLeaders select _i; if (typeof _element == "HighCommandSubordinate") then { _sublogics = _sublogics + [_element]; if (isnil {_element getvariable "color"}) then { _color = if (_i >= count _groupColors) then {"teammain"} else {_groupColors select _i}; _element setvariable ["color",_color]; }; }; }; _possibleLeaders = _possibleLeaders - _sublogics; _logic setvariable ["sublogics",_sublogics]; if (count _possibleLeaders > 1) then {textLogFormat ["Log: [High Command] WARNING! More than one commanders assigned - %1",_possibleleaders]}; _leader = _possibleLeaders select 0; _leader setvariable ["BIS_HC_scope",_logic,true]; //--- Default leader //_leader setvariable ["hcdefaultcommander",true]; //--- Functions are loaded waituntil {!isnil "BIS_fnc_init"}; //--- Get custom params ---------------------------------------------------------------------------------- /* //--- Commanders _commanders = if (isnil {_logic getvariable "commanders"}) then { if (_leader != _logic) then {[_leader]} else {[]}; } else { _logic getvariable "commanders"; }; _logic setvariable ["commanders",_commanders,true]; */ //--- Detect all (obsolete) _addAllGroups = if (isnil {_logic getvariable "addAllGroups"}) then { if (count _sublogics > 0) then {false} else {true} } else {_logic getvariable "addAllGroups"}; _logic setvariable ["addAllGroups",_addAllGroups,true]; //--- Radio activations _radios = if (isnil {_logic getvariable "radios"}) then {[]} else {_logic getvariable "radios"}; _logic setvariable ["radios",_radios,true]; //--- Chain of Command _coc = if (isnil {_logic getvariable "chainofcommand"}) then {false} else {_logic getvariable "chainofcommand"}; _logic setvariable ["chainofcommand",_coc,true]; //--- Task created _onTaskCreated = if (isnil {_logic getvariable "onTaskCreated"}) then {{}} else {_logic getvariable "onTaskCreated"}; _logic setvariable ["onTaskCreated",_onTaskCreated,true]; //--- Task assigned _onTaskAssigned = if (isnil {_logic getvariable "onTaskAssigned"}) then {{}} else {_logic getvariable "onTaskAssigned"}; _logic setvariable ["onTaskAssigned",_onTaskAssigned,true]; //--- RMBmenu /* _RMBmenu = if (isnil {_logic getvariable "RMBmenu"}) then {""} else {_logic getvariable "RMBmenu"}; _logic setvariable ["RMBmenu",_RMBmenu,true]; */ //--- Automatic group assigning - Synchronized if (count _sublogics > 0 && !_addAllGroups) then { //if (isnull(hcleader group _leader)) then {_leader HCsetgroup [group _leader,""]}; _linkedLogic = synchronizedObjects _logic; if (count _linkedLogic > 1) then { { if (typeof _x == "HighCommandSubordinate") then { _subordinate = _x; _linkedSubordinate = synchronizedObjects _subordinate; { if !(_x iskindof "logic") then { _group = group _x; _groupColor = _subordinate getvariable "color"; [_leader,"MARTA_REVEAL",[_group],false,true] call BIS_fnc_variableSpaceAdd; _leader HCsetgroup [_group,"",_groupColor]; }; } foreach _linkedSubordinate; }; } foreach _linkedlogic; }; } else { //--- Automatic group assigning - All //if (isnull(hcleader group _leader)) then {_leader HCsetgroup [group _leader,""]}; _groups = allgroups;//_logicMARTA getvariable "allgroups"; { //--- No HCO defined yet _grp = _x; if (isnull hcleader _grp) then { if (side player == side _grp && _addAllGroups) then { [player,"MARTA_REVEAL",[_x],false,true] call BIS_fnc_variableSpaceAdd; player HCsetgroup [_grp,""]; }; }; } foreach _groups; }; //--- Local script --------------------------------------------------------------------------------------- //waitUntil{!isNil {BIS_MPF_initDone}}; if (_isMain) then { //[nil, nil, "per", rEXECVM, "A3\modules_f\HC\data\scripts\HC_local.sqf"] call RE [["A3\modules_f\HC\data\scripts\HC_local.sqf"],"BIS_fnc_execVM",nil,true] call BIS_fnc_MP; }; //--- No proper Chain of Command if !(_coc) exitwith {}; while {true} do { _allgroups = allgroups; { _group = _x; if (isnil {_group getvariable "BIS_HC_fsmcoc"}) then { _fsm = _group execfsm ("\A3\modules_f\hc\data\scripts\HC_COC.fsm"); _group setvariable ["BIS_HC_fsmcoc",_fsm]; }; sleep 0.05; } foreach _allgroups; sleep 1; }; I don't see anything that would immediately suggest why hc.sqf is causing assets to not appear in curator. Share this post Link to post Share on other sites
adamkl 0 Posted February 2, 2022 thx this is exactly what i needed however is seems that thing like skip time and play music arent working have you found a fix yet after all this is guite an old post thx in advance Share this post Link to post Share on other sites