Jump to content
Sign in to follow this  
jaapjolman

WailUnitl never ends on client howto get this working

Recommended Posts

Hello Everyone, i got a problem in my init.sqf

if (isServer) then {
   _factories = Call Compile loadFile "\userconfig\cti-chernarus\factories.sqf";
   publicVariable "_factories";
   diag_log _factories;
   {
       diag_log _x;
       _x Call BIS_WF_AddUnitData;
   } forEach _factories;
}
else
{
   waitUntil {!isNil "_factories"};
   {
       _x Call BIS_WF_AddUnitData;
   } forEach _factories;
};

i am trying to get the array from file into a public variable, it works on the server so far as it show this in the RPT file

2013/12/18, 20:17:58 [EAST,"Aircraft","Mi17_INS",5000,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [EAST,"Aircraft","Mi17_rockets_RU",8000,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [EAST,"Aircraft","Mi17_Civilian",4500,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [EAST,"Aircraft","Mi24_D",10000,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [EAST,"Aircraft","Mi24_P",11200,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [EAST,"Aircraft","Mi24_V",11200,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [EAST,"Aircraft","Ka52",12000,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [EAST,"Aircraft","Ka52Black",12000,90,0,1,"","","RU"]
2013/12/18, 20:17:58 [WEST,"Aircraft","AH1Z",8500,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","AH64D",11200,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","MH60S",11200,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","UH1Y",8500,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","MV22",14000,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","UH60M_EP1",11200,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","UH60M_MEV_EP1",11200,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","AH6J_EP1",5000,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","CH_47F_BAF",18000,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","AW159_Lynx_BAF",10000,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","BAF_Merlin_HC3_D",18000,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","Ka137_PMC",16000,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [WEST,"Aircraft","Ka60_GL_PMC",16000,90,0,1,"","","USMC"]
2013/12/18, 20:17:58 [GUER,"Aircraft","UH1Y",8500,90,0,1,"","","GUE"]
2013/12/18, 20:17:58 [GUER,"Aircraft","AH1Z",8500,90,0,1,"","","GUE"]
2013/12/18, 20:17:58 [GUER,"Aircraft","Mi17_INS",5000,90,0,1,"","","GUE"]
2013/12/18, 20:17:58 [GUER,"Aircraft","Mi17_rockets_RU",8000,90,0,1,"","","GUE"]
2013/12/18, 20:17:58 [GUER,"Aircraft","Mi17_Civilian",4500,90,0,1,"","","GUE"]
2013/12/18, 20:17:58 [GUER,"Aircraft","BAF_Merlin_HC3_D",18000,90,0,1,"","","GUE"]
2013/12/18, 20:17:58 [GUER,"Aircraft","Mi24_P",11200,90,0,1,"","","GUE"]
2013/12/18, 20:17:58 [GUER,"Aircraft","Ka52Black",10000,90,0,1,"","","GUE"]

but the clients get stuck on loading at like 99% so i guess its in the waitUntil {!isNil "_factories"};

but so far all my attempts to get this loading for the clients failed

i hope somebody knows how to solve this,

Greetings Jaap

Share this post


Link to post
Share on other sites

Assuming that you can indeed broadcast compiled code, you can't broadcast a local variable. Factories needs to be a global variable.

Share this post


Link to post
Share on other sites

How do i define a global variable?

nvm:

http://community.bistudio.com/wiki/Variables

http://community.bistudio.com/wiki/Identifier

if (isServer) then {
   factories = loadFile "\userconfig\cti-chernarus\factories.sqf";
   publicVariable "factories";
   _factories = Call Compile factories;
   diag_log _factories;
   {
       diag_log _x;
       _x Call BIS_WF_AddUnitData;
   } forEach _factories;
}
else
{
   waitUntil {!isNil "factories"};
   _factories = Call Compile factories;
   {
       _x Call BIS_WF_AddUnitData;
   } forEach _factories;
};

does this look more like it?

---------- Post added at 20:22 ---------- Previous post was at 19:58 ----------

i tried the code i posted before but now the client just crashes without any scripterrors " i did add -showScriptErrors "

---------- Post added at 21:28 ---------- Previous post was at 20:22 ----------

YEEEEEEEEEEEAHHHHHHH i got it working this code works

if (isServer) then {
   factories = Compile loadFile "\userconfig\cti-chernarus\factories.sqf";
   publicVariable "factories";
   _factories = Call factories;
   diag_log _factories;
   {
       diag_log _x;
       _x Call BIS_WF_AddUnitData;
   } forEach _factories;
}
else
{
   waitUntil {!isNil "factories"};
   _factories = Call factories;
   {
       _x Call BIS_WF_AddUnitData;
   } forEach _factories;
};

Edited by jaapjolman
Found how to define global

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
Sign in to follow this  

×