Jump to content
Sign in to follow this  
tobmic

Help on init.sqf

Recommended Posts

Can you guys take a look on my init.sqf and see if I have done everything okay and what I should change ?

onPlayerConnected "

publicVariable 'task1done';

publicVariable 'task2done';

publicVariable 'task3done';

publicVariable 'task4done';

publicVariable 'task5done';

publicVariable 'task6done';

publicVariable 'task7done';

publicVariable 'task8done';

publicVariable 'task9done';

publicVariable 'task10done';

";

if (isServer) then

{

task1done=false;

task2done=false;

task3done=false;

task4done=false;

task5done=false;

task6done=false;

task7done=false;

task8done=false;

task9done=false;

task10done=false;

};

/////////////////////////////////////////////////////////////////////////////////////////////////////

bon_settings_maxallowed_viewdist = 7000;

/////////////////////////////////////////////////////////////////////////////////////////////////////

if (isServer) then {

ace_sys_tracking_markers_enabled = false;

publicVariable "ace_sys_tracking_markers_enabled";

};

if (isServer) then {

waitUntil {!isNull player};

execVM "scripts\clearCorpses.sqf";

};

/////////////////////////////////////////////////////////////////////////////////////////////////////

[] spawn {

waitUntil {!isNull player};

execVM "scripts\checkweapon.sqf";

};

[] spawn {

waitUntil {!isNull player};

execVM "bon_settings\bon_settings_init.sqf";

};

[] spawn {

waitUntil {!isNull player};

execVM "briefing.sqf";

};

[] spawn {

waitUntil {!isNull player};

execVM "scripts\respawn.sqf";

};

[] spawn {

waitUntil {!isNull player};

execVM "scripts\rucksack.sqf";

};

/////////////////////////////////////////////////////////////////////////////////////////////////////

waitUntil { !(isNil "GL4_Global") };

#include "GL4\GL4_Global.sqf";

waitUntil { !(isNil "GL4_Local") };

#include "GL4\GL4_Local.sqf";

waitUntil { !(isNil "GL4_Random") };

#include "GL4\GL4_Random.sqf";

waitUntil { !(isNil "GL4_Core") };

#include "GL4\GL4_Core.sqf";

waitUntil { !(isNil "GL4_High_Command") };

#include "GL4\GL4_High_Command.sqf";

waitUntil { !(isNil "GL4_Radio_Chatter") };

#include "GL4\GL4_Radio_Chatter.sqf";

waitUntil { !(isNil "GL4_Skill_Types") };

#include "GL4\GL4_Skill_Types.sqf";

Share this post


Link to post
Share on other sites

You really missed the point about publicVariable - JIPs will pick up whatever value was last broadcast using that command. You just set up a handler for each of them. You don't have to wait for the same thing before doing a lot of other things. That's just strange. I don't think it's necessary at all, but I could be wrong. I take it GL4/bon/ace is some add-on I'm not familiar with, and I'll avoid those 3rd party things:

execVM "scripts\clearCorpses.sqf";
execVM "scripts\checkweapon.sqf";
execVM "bon_settings\bon_settings_init.sqf";
execVM "briefing.sqf";
execVM "scripts\respawn.sqf";
execVM "scripts\rucksack.sqf";

That's your init before third party programs. You just need something to pick up on changes on variables, which will be picked up by JIPs automatically.

ie.

if (isNil "varName") then {
"varName" addPublicVariableEventHandler {
	your stuff;
};

Which is the handler. Of the variable. Which will fire when the var value is changed and pV'd.

Share this post


Link to post
Share on other sites

A friend has helped me with the init.sqf it looks like this now and its working fine

Gnome why do I need to put the GL4 stuff to the top ? when i do that the init.sqf wont run : (

/////////////////////////////////////////////////////////////////////////////////////////////////////

if(isNil "task1done") then{task1done = false};

if(isNil "task2done") then{task2done = false};

if(isNil "task3done") then{task3done = false};

if(isNil "task4done") then{task4done = false};

if(isNil "task5done") then{task5done = false};

if(isNil "task6done") then{task6done = false};

if(isNil "task7done") then{task7done = false};

if(isNil "task8done") then{task8done = false};

if(isNil "task9done") then{task9done = false};

if(isNil "task10done") then{task10done = false};

/////////////////////////////////////////////////////////////////////////////////////////////////////

bon_settings_maxallowed_viewdist = 7000;

/////////////////////////////////////////////////////////////////////////////////////////////////////

ace_sys_tracking_markers_enabled = false;

/////////////////////////////////////////////////////////////////////////////////////////////////////

if (isServer) then {

execVM "scripts\clearCorpses.sqf";

};

/////////////////////////////////////////////////////////////////////////////////////////////////////

if(local player) then{

[] spawn {

waitUntil {!isNull player};

execVM "scripts\checkweapon.sqf";

execVM "bon_settings\bon_settings_init.sqf";

execVM "briefing.sqf";

execVM "scripts\respawn.sqf";

execVM "scripts\rucksack.sqf";

}

};

/////////////////////////////////////////////////////////////////////////////////////////////////////

waitUntil { !(isNil "GL4_Global") };

call compile preProcessFile "GL4\GL4_Global.sqf";

waitUntil { !(isNil "GL4_Local") };

call compile preProcessFile "GL4\GL4_Local.sqf";

waitUntil { !(isNil "GL4_Random") };

call compile preProcessFile "GL4\GL4_Random.sqf";

waitUntil { !(isNil "GL4_Core") };

call compile preProcessFile "GL4\GL4_Core.sqf";

waitUntil { !(isNil "GL4_High_Command") };

call compile preProcessFile "GL4\GL4_High_Command.sqf";

Share this post


Link to post
Share on other sites

The issue with GL4 is with it's initialization, currently it might take a few seconds for it to "activate" and start initializing things. So, in order to ensure your #included files initialize when needed, (like before GL4 self initializes) you should move those entries to the top of the init.sqf ;)

Now, if things are not working when you do this ... there is a very high probablity that one of the settings in one of your included files is not correct. Common errors are things like changing the wrong array entry or putting a 0/1 when it should be true/false.

I would almost bet that this is your problem if it fails to load. And if there is an error in one of those setting files, that could explain alot of things. What could happen right now is, GL4 will self initialize (if using CBA), and your settings don't initialize in time. Thus making things seem broken, yet still functional in some aspects.

Gnome

Do you run with -showscripterrors startup switch on? If you do, and a setting file is jacked up, you'll see quite a few GL4 a + b > farkle type .rpt errors. ;)

Share this post


Link to post
Share on other sites

I have to say that moving "#include" statements before script calls or spawn blocks is never a good idea.

Before it comes to the GL4 things, nothing can go wrong in your init.sqf file.

The "if(isNil "task1done") then{..." is just a variable declaration, as well as bon_settings... and ace_sys_tracking_markers_enabled. Then comes a "spawn" block that also gives back a script handler immediately. So NOTHING can go wrong before the GL4 section and it will always come to it.

Now, on the other side, if you put the GL4 initialization to the top, and something goes wrong within that, you can forget about all the other stuff, too, since the GL4 initializations are done with including code instead of calling an external script.

So most definitely, keep it like this.

Share this post


Link to post
Share on other sites

whats wrong with the init.sqf now ?

When I reconnect on the Dedi the init.sqf doesnt work anymore i also tried to remove the GL4 settings but still the same

if(isNil "task1done") then{task1done = false};

if(isNil "task2done") then{task2done = false};

if(isNil "task3done") then{task3done = false};

if(isNil "task4done") then{task4done = false};

if(isNil "task5done") then{task5done = false};

if(isNil "task6done") then{task6done = false};

if(isNil "task7done") then{task7done = false};

if(isNil "task8done") then{task8done = false};

if(isNil "task9done") then{task9done = false};

if(isNil "task10done") then{task10done = false};

/////////////////////////////////////////////////////////////////////////////////////////////////////

bon_settings_maxallowed_viewdist = 7000;

/////////////////////////////////////////////////////////////////////////////////////////////////////

ace_sys_tracking_markers_enabled = false;

/////////////////////////////////////////////////////////////////////////////////////////////////////

if (isServer) then {

execVM "scripts\clearCorpses.sqf";

};

/////////////////////////////////////////////////////////////////////////////////////////////////////

if(local player) then{

[] spawn {

waitUntil {!isNull player};

execVM "scripts\checkweapon.sqf";

execVM "bon_settings\bon_settings_init.sqf";

execVM "briefing.sqf";

execVM "scripts\respawn.sqf";

execVM "scripts\rucksack.sqf";

}

};

/////////////////////////////////////////////////////////////////////////////////////////////////////

waitUntil { !(isNil "GL4_Global") };

call compile preProcessFile "GL4\GL4_Global.sqf";

waitUntil { !(isNil "GL4_Local") };

call compile preProcessFile "GL4\GL4_Local.sqf";

waitUntil { !(isNil "GL4_Core") };

call compile preProcessFile "GL4\GL4_Core.sqf";

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  

×