Jump to content
Sign in to follow this  
wallside

location to define custom functions

Recommended Posts

Hello,

can someone tell me what's the correct location to define custom per-mission functions? The problem with the init.sqf seems to be, that it isn't guaranteed to be executed before scripts in init-fields (where I want to use those functions).

Share this post


Link to post
Share on other sites

There isn't any "set in stone" locations for custom functions. You can put them in a functions folder. If it is a custom function that you made then I suggest create a file called functions.sqf. You can place this file along side your init.sqf or in a folder but usually I just leave along side the init. Inside your init.sqf put this line of code in the file

execVM "functions.sqf";

Make sure that the game reads the functions before the functions are being called.

Share this post


Link to post
Share on other sites
Make sure that the game reads the functions before the functions are being called.

Well, exactly that was my problem.

kylania, if I read your link (thx!) correctly, functions declared inside the description.ext are available right at the beginning?

Edited by wallside
wrong username

Share this post


Link to post
Share on other sites

you could put a waitUntil in there to wait for your functions.sqf to be finished before continueing.


functions = [] execVM "functions.sqf";
waitUntil {scriptDone functions};

Share this post


Link to post
Share on other sites

Thank you all, I think the link from kylania has answered my question conclusively.

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  

×