Wait for ALIVE_globalForcePool to be fully initialized

  1. 6 years ago

    I'm trying to pull data from the globalForcePool, however I haven't found a way to wait for it finish grabbing data in a more robust way. I'm currently just sleeping for 30 seconds after mission start, which works, but I have no guarantee that this will work all the time.

    I've tried waiting for waitUntil {!isNil "ALIVE_mil_OPCOM"}, but this happens before the globalForcePool is initalized.
    Doing the same for ALIVE_mil_logistics never continues.
    Doing the same for ALIVE_globalForcePool returns an empty array.

    Looking into the code, it seems that the Military Logistics module has its own variables for startupComplete and initialAnalysisComplete, which looks like what I need, but I can't find a way to access those variables directly.

    Any help would be appreciated.

  2. You could loop through all Module_F objects and check if any match the classname of the MilLog module. Then waitUntil the module has a variable named "initialAnalysisComplete" AND its value is true.

    private _moduleObject = ...;
    waitUntil { _moduleObject getvariable ["initialAnalysisComplete", false] };

    // it's done

  3. After taking a break, I realized I was approaching this from entirely the wrong angle. Instead of waiting for the module to initialize, I just need to wait for the variable I need to have data.

    In case anyone needs to do a similar thing, this is what I solved it with:

    private "_forcePool";
    _faction = "BLU_F";
    waitUntil {
    	sleep 0.5;
    	_forcePool = [ALIVE_globalForcePool, _faction] call ALIVE_fnc_hashGet;
    	!isNil "_forcePool";
    };

    Either way, thanks for the help @SpyderBlack723

 

or Sign Up to reply!