Comrades in Arms Discussion Board
Understanding init.sqf - Printable Version

+- Comrades in Arms Discussion Board (http://forum.ciahome.net)
+-- Forum: Comrades in Arms Life (http://forum.ciahome.net/forumdisplay.php?fid=3)
+--- Forum: Mission Making (http://forum.ciahome.net/forumdisplay.php?fid=8)
+--- Thread: Understanding init.sqf (/showthread.php?tid=2359)

Pages: 1 2


Understanding init.sqf - Outlawz7 - 05-12-2013

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?


Re: Understanding init.sqf - kutya - 05-12-2013

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.



Re: Understanding init.sqf - Outlawz7 - 05-12-2013

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.


Re: Understanding init.sqf - kutya - 05-12-2013

Well, add a black screen at start.


Re: Understanding init.sqf - Varanon - 05-12-2013

(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}};




Re: Understanding init.sqf - Outlawz7 - 05-13-2013

Arma2


Re: Understanding init.sqf - Alwarren - 05-13-2013

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

I am quite sure that JIP runs init.sqf as well.


Re: Understanding init.sqf - Varanon - 05-13-2013

(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.



Re: Understanding init.sqf - Outlawz7 - 05-13-2013

So what would be the argument for "is not a JIP player" ie. "IF not JIP THEN do stuff"


Re: Understanding init.sqf - kutya - 05-13-2013

This should help.

http://creobellum.org/node/22



Re: Understanding init.sqf - Varanon - 05-13-2013

(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};


Re: Understanding init.sqf - Outlawz7 - 05-14-2013

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


Re: Understanding init.sqf - Varanon - 05-14-2013

(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.



Re: Understanding init.sqf - Outlawz7 - 05-18-2013

(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.


Re: Understanding init.sqf - Outlawz7 - 07-14-2013

For UPSMON, do I need to add anything else to the init or just call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";?