Jump to content
Sign in to follow this  
ArmAddict

Init.sqf not Initializing at Map Screen?

Recommended Posts

I seem to be having issues with my init.sqf. When I start the mission, both offline and online, nothing that is written in the init.sqf happens. It doesn't initialize until after I start the mission. Here is my init.sqf:

if ((!isServer) && (player != player)) then

{

waitUntil {player == player};

};

//Init UPSMON scritp (must be run on all clients)

call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";

//Process statements stored using setVehicleInit

processInitCommands;

//Finish world initialization before mission is launched.

finishMissionInit;

//Loadingtext

if (time < 10) then {

[] spawn {

waitUntil {!isNil "BIS_fnc_init"};

//Info text

["Devil Dogs", "USMC Force Recon", "Near Strelka, Utes"] spawn BIS_fnc_infoText;

};

};

//Hides UPSMON markers.

"patrol1" setMarkerAlpha 0;

"patrol2" setMarkerAlpha 0;

"patrol3" setMarkerAlpha 0;

//Initializes briefing

execVM "briefing.sqf";

ace_sys_spectator_playable_only = true;

All help is appreciated!

Share this post


Link to post
Share on other sites

I maybe talking out of my arse on this one but, doesn't the "execVM" go at the top so it's executed first?

I'm sure someone more qualified will help you out...

Share this post


Link to post
Share on other sites

You have:

callcompilepreprocessFileLineNumbers "scripts\Init_UPSMON.sqf";

It should be:

call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";

You can delete:

processInitCommands;

Since init lines are executed before init.sqf anyway.

Not sure about this (never used it):

finishMissionInit;

You have:

if ((!isServer) && ([b][color="Red"]player![/color][/b]= player)) then

{
waitUntil {player == player};
};

It should be:

if ((!isServer) && (player != player)) then

{
waitUntil {player == player};
};

Or use this instead:

waitUntil {(isDedicated) || !(isNull player)};

Please use -showScriptErrors and/or check your RPT file to get rid of these (obvious) mistakes.

Edited by sxp2high

Share this post


Link to post
Share on other sites
I don't think you can use waitUntil (or sleep) in init.sqf, unless if spawned from it.
init.sqf is execVM'd, so yes you can.

But a well designed system generally doesn't need waitUntils.

Share this post


Link to post
Share on other sites

waitUntil works just fine in init.sqf

Sleep however will suspend until time > 0

Share this post


Link to post
Share on other sites

uses for waitUntil in init.sqf

waitUntil {!(isNull player)}; //ensure JIP is initialized

waitUntil {(!(isNil "AAS_RandomMissionGenerationDone"))}; // wait for PV of another instance, like some server to client info/sync

Share this post


Link to post
Share on other sites

sxp2high,

I had everything you told me to change but for some reason when I copy and pasted the code here it removed the spaces. I also have the game set to show script errors but It doesn't show any when I start the mission. The init.sqf still doesn't seem to be launching until after I leave the map screen.

Share this post


Link to post
Share on other sites
sxp2high,

I had everything you told me to change but for some reason when I copy and pasted the code here it removed the spaces. I also have the game set to show script errors but It doesn't show any when I start the mission. The init.sqf still doesn't seem to be launching until after I leave the map screen.

It will depend on the script load during the briefing cycle.

E.g if you use ACRE and certain scripts like weapon crate filling automatically from the config, then the scripting engine is very much bogged down, due to 1000's of added weapon classes.

If you want something to execute at the briefing, best run it from an init field of a vehicle or unit, or init eventhandlers from the config.

If you usually play with CBA, you could even use Extended EventHandlers from within your Mission description.ext

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  

×