Comrades in Arms Discussion Board

Full Version: Understanding init.sqf
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Since I've learned that JIP players do run init.sqf on joining, if I start some other scripts in the init.sqf ie. execVM "myscript.sqf", do they re-run when someone joins or not?

If they do, how do I then run something only at start of the mission? An initserver.sqf file or using isServer/isDedicated?
I'm not sure, but maybe you should try:
Code:
if (time < 1) then
{
code
}

in your init.sqf

That should work if time is global to all machines.
I tried that, but you still have that less than a second long moment before it executes the command, so if you want to add an intro/cutscene right at the start, the init is still better.
Well, add a black screen at start.
(05-12-2013, 01:08 PM)Outlawz7 link Wrote: [ -> ]Since I've learned that JIP players do run init.sqf on joining, if I start some other scripts in the init.sqf ie. execVM "myscript.sqf", do they re-run when someone joins or not?

uhhh, yes, they do ? Unless that changed in the latest Beta ? Arma 2 or Amra 3 ?

Usually, you detect a JIP player by checking for (isNil player) in init.sqf, and add a waitUntil {!isNil {player}};

Arma2
(05-13-2013, 02:15 PM)Outlawz7 link Wrote: [ -> ]Arma2

I am quite sure that JIP runs init.sqf as well.
(05-13-2013, 02:15 PM)Outlawz7 link Wrote: [ -> ]Arma2

Definitely runs init.sqf on JIP clients, with the prerequisites stated previously: player object is nul. That's how the task tracker for example checks for JIP players.
So what would be the argument for "is not a JIP player" ie. "IF not JIP THEN do stuff"
(05-13-2013, 05:32 PM)Outlawz7 link Wrote: [ -> ]So what would be the argument for "is not a JIP player" ie. "IF not JIP THEN do stuff"

if (!isNil player) then {do stuff};
Thanks

I have this in the inits of several of the new ACR missions

player action ["nvGoggles", player];

works in SP, you start with NVGs on, but didnt work on the CiA server when i tried one of the missions
(05-14-2013, 06:52 PM)Outlawz7 link Wrote: [ -> ]player action ["nvGoggles", player];

Add a

waituntil {!isNil player};

in front. On JIP clients, player is nil and thus the statement does not have any effect.
(05-13-2013, 07:50 PM)Varanon link Wrote: [ -> ]if (!isNil player) then {do stuff};

Gave me an error on local, apparently isNil needs to be followed by string not object.

if (!isNil {player})

^this worked.
For UPSMON, do I need to add anything else to the init or just call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";?
Pages: 1 2