Jump to content
cklymowsky

Initialization Order & BIS_fnc_moduleSector_sectors

Recommended Posts

HI All,

 

I'm having problems with my script obtaining BIS_fnc_moduleSector_sectors and I think it is related to a timing issue?

 

In my description.ext below, setUpSector creates sectors on the map. I added preInit thinking this would be done early on (as per https://community.bistudio.com/wiki/Initialization_Order) when loading the MP game, but do not notice much difference between  postInit and preInit

 

description.ext

class CfgFunctions {
	class BEAKS
	{
		class SetUp
		{
			file = "functions\SetUp";
			class setUpSector {postInit = 1};	//{postInit = 1}; {preInit = 1}; not sure which to use 
			class sectorDistances {};
		}
	}
};

fn_sectorDistances.sqf, 

waitUntil {!isNull player};

fn_Draw3Dsectors = {
	{	
		//...script to display distance of sectors
	} forEach BIS_fnc_moduleSector_sectors;
};

private ["_addNew"];

_addNew = ["BIS_id", "onEachFrame", "fn_Draw3Dsectors"] call BIS_fnc_addStackedEventHandler	

TRUE

The BIS_fnc_moduleSector_sectors works when BEAKS_fnc_sectorDistances is called below for some reason?

 

initPlayerLocal.sqf

waituntil {!isnil "bis_fnc_init"};
waitUntil {!isNull player};

[] call BEAKS_fnc_sectorDistances;

hint format ["BIS_fnc_moduleSector_sectors: \n %1",  BIS_fnc_moduleSector_sectors];	

HOWEVER, I get an "Error Undefined variable in expression: bis_fnc_modulesector_sectors" with the hint statement?

 

How to I get BIS_fnc_moduleSector_sectors recognized?

Share this post


Link to post
Share on other sites

Wait until time > 0 should fix it. Had a similar problem discussed here about timing of sector initialisation.

Share this post


Link to post
Share on other sites

Thanks Larrow,

 

I actually had to increase initPlayerLocal.sqf up to waitUntil { time > 2 };  before I stopped getting undefined variable errors, and  BIS_fnc_moduleSector_sectors  would give the sectors. I assume my script setUpSector  requires this much time.

 

My thought was that by running setUpSector that calls createSector embedded within it, with preInit in the description.ext, all the sectors would be created and initialized before initPlayerLocal?

 

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×