nomadd 66 Posted January 19, 2013 ok, I have a question. I have a number of functions I have made. If I call/spawn them from a .sqf or trigger they work fine, no problems, but if I try and do it from the init box of a unit/vehicle I get nothing. The only thing I can think is the init box is getting run before my functions are processed. I looked at some of BIS stuff, exp BIS_fnc_Taskpatrol, at the tops of the script they have scriptname "blah\blah\blah.sqf". I know I need to somehow direct the call/spawn to the path of the script and I need to do it before the init box gets run. I figure the way to do it is with the description.ext (I believe it gets run before anything). So far everything I have tried as failed. I know I can execvm the script from init box and it works fine. What I am trying to do may not be possible without putting the functions into mod form. I can't seem to find information regarding this or maybe I am just searching in the wrong places. Nomad Share this post Link to post Share on other sites
f2k sel 164 Posted January 19, 2013 I think you need to delay the game a fraction because functions/modules take a short time to start. create on init.sqf file and place this in it. waitUntil {not(isNil "BIS_fnc_init")}; Share this post Link to post Share on other sites
nomadd 66 Posted January 19, 2013 (edited) Ah, I have waitUntil {!(isNil "BIS_fnc_init")}; in the scripts but not in the init.sqf. I was under the impression it was a bad idea to use waituntils in the init.sqf. I will give this a try and let you know. Thanks for the fast response That didn't make any difference. Still getting nothing when I try and use unit\vehicle init box. Doesn't the init.sqf get run after all the init boxes? Edited January 19, 2013 by Nomadd Share this post Link to post Share on other sites
Horner 13 Posted January 19, 2013 You have to use a handler. null = [] spawn my_fnc; Share this post Link to post Share on other sites
nomadd 66 Posted January 19, 2013 Maybe I am not explaining this well. I have no problems using call/spawn from a trigger or from inside a script. It is only when I try to use it from units init box. What I am trying to call/spawn are functions in the mission folder, not functions that are part of any mod. I can put [blah,blah] call BIS_fnc_whatever in a units init box and it will work, but if I take the same function and put it in the mission folder it will not work from a units init box. Yes I have XX = compile preprocessfile "pathto.sqf";. This is what I think the problem is I need to compile preprocessfile "xx.sqf" before the units init box runs, but it looks like the units init box gets run before the init.sqf. (This part is just a guess however) Share this post Link to post Share on other sites
cuel 25 Posted January 20, 2013 Yeah I'm fairly certain that all editor inits run before init.sqf. You could just set up a variable by yourself when your functions has been compiled. Then in the script for the unit script have your own version of "waitUntil {!isNil "TAG_fn_init_done"};". Alternatively look into using an #include Share this post Link to post Share on other sites
nomadd 66 Posted January 20, 2013 Ah, thanks cuel. That is what I thought. I tried using #include but so far no luck getting it to work, but I do not fully understand how to implement #include. Time to do some more searching Share this post Link to post Share on other sites