Sync Military Logistics on Trigger

  1. 7 years ago

    Is there a way to sync the logistics to an opcom via a trigger? Would synchronizeObjectsAdd work or no because ALiVE takes place on the mission init?

    I know there is the script snippet to change the force pool level, and I've tried setting that in the activation field of a trigger, but how do I know it is working?

  2. hi!
    good question, i wish to know this too!

  3. Edited 7 years ago by marceldev89

    @patpowercat Is there a way to sync the logistics to an opcom via a trigger? Would synchronizeObjectsAdd work or no because ALiVE takes place on the mission init?

    After a quick scan of the scripts I'd say it should work.

    The AI commander module checks if the logistics module is available every time it wants to request reinforcements. It doesn't seem to store the results in a private variable during init, which is a good thing in this case. :)

    @patpowercat I know there is the script snippet to change the force pool level, and I've tried setting that in the activation field of a trigger, but how do I know it is working?

    With [ALIVE_globalForcePool,"BLU_F"] call ALIVE_fnc_hashGet; you can get the current force pool level so you can use that to see if your trigger worked, I guess.

  4. With [ALIVE_globalForcePool,"BLU_F"] call ALIVE_fnc_hashGet; you can get the current force pool level so you can use that to see if your trigger worked, I guess.

    This

  5. Hello there ! Sorry i didnt understood clearly what are the correct steps to make the logistic avaible only if a trigger is true.
    Thanks !

  6. So I am kinda dumb. How can I display this so I actually know? I understand the script snippet, but is there some way to display this as a hint or something?

    This is what I want: BLUFOR destroys a radio tower or something. This takes away OPFOR ability to get replacements. I have all the triggers set up. For testing how can I display that the reinforcement level is 0 to confirm no further OPFOR replacements will come?

  7. Edited 7 years ago by SpyderBlack723

    Easiest way is to create a function that works when both called on a client or server. The code needs to always run on the server to work but we can modify the function to detect if it's called on a client, and if so, re-execute it on the server.

    Spyder_fnc_setForcepoolByFaction = {
    	if (!isServer) exitWith {_this remoteExecCall ["Spyder_fnc_setForcepoolByFaction",2]};
    
    	params ["_faction","_forcepool"];
    
    	[ALiVE_globalForcePool,_faction, _forcepool] call ALIVE_fnc_hashSet;
    };

    This function can be called on a client or on the server and will always automatically re-execute on the server if needed.

    Ex. call: ["OPF_F",0] call Spyder_fnc_setForcepoolByFaction; // Will set the forcepool of faction OPF_F to 0

    Then you can either display a hint however you want, or just modify the script to do it for you (although I would recommend keeping it for you.

    Ex. of implementing hint directly into the function

    Spyder_fnc_setForcepoolByFaction = {
    	if (!isServer) exitWith {_this remoteExecCall ["Spyder_fnc_setForcepoolByFaction",2]};
    
    	params ["_faction","_forcepool"];
    
    	[ALiVE_globalForcePool,_faction, _forcepool] call ALIVE_fnc_hashSet;
    
            "OPF_F forcepool set to zero" remoteExecCall ["hint", -2]; // only called on clients
    };
  8. I guess I don't understand how to set this for a specific faction. Is this function defined in the init file and then I just have to call it like in your example? Or does all this need to go into the init field?

  9. Edited 7 years ago by SpyderBlack723

    Just post the function declaration in the init.sqf or in a CfgFunctions if you use/prefer that method.

    Then, when you want to modify a faction's forcepool, call the function with appropriate parameters

    [_faction,_forcepool] call Spyder_fnc_setForcepoolByFaction;
    ["OPF_F",0] call Spyder_fnc_setForcepoolByFaction; // sets faction OPF_F forcepool to zero -- no reinforcements
  10. Edited 7 years ago by patpowercat

    Alright thanks a ton! Is this the same as my other post about disabling/pausing an OPCOM? Place the function in an init.sqf and then call the function in the init field of the trigger?

    Sorry never made a custom function before

  11. Yes

 

or Sign Up to reply!