Init.sqs – Talk
(runInitScript) |
m (init on JIP) |
||
Line 26: | Line 26: | ||
::: My bad, sorry, I usually don't use init.sqs for client initialization :). You '''could''' however seperate the <tt>init.sqs</tt> into <tt>init.sqs</tt> (which only runs server related stuff, or stuff that should only on one machine and once, using the good old <tt>?!local server:exit</tt>) and <tt>init_client.sqf</tt> for clients, which are run once by a trigger with condition <tt>alive player</tt>. Furthermore, push variables across the net again with [[publicVariable]] in an [[onPlayerConnected]] event handler, in case this is required. | ::: My bad, sorry, I usually don't use init.sqs for client initialization :). You '''could''' however seperate the <tt>init.sqs</tt> into <tt>init.sqs</tt> (which only runs server related stuff, or stuff that should only on one machine and once, using the good old <tt>?!local server:exit</tt>) and <tt>init_client.sqf</tt> for clients, which are run once by a trigger with condition <tt>alive player</tt>. Furthermore, push variables across the net again with [[publicVariable]] in an [[onPlayerConnected]] event handler, in case this is required. | ||
::: I'll try to address issues like this in a seperate article about multiplayer locality somewhen this month. -- [[User:Manny|Manny]] 15:06, 7 May 2007 (CEST) | ::: I'll try to address issues like this in a seperate article about multiplayer locality somewhen this month. -- [[User:Manny|Manny]] 15:06, 7 May 2007 (CEST) | ||
: I'm getting the opposite result, ie a JIP player's client executes init.sqf! 5143 beta. --[[User:Ceeeb|Ceeeb]] 08:29, 8 May 2007 (CEST) | |||
I normally use: | I normally use: | ||
Line 33: | Line 35: | ||
if ( local player) { execVM "init_client.sqf"}; | if ( local player) { execVM "init_client.sqf"}; | ||
However the JIP has foobar'd this and adding "if ( local player) { execVM "init_client.sqf"};" to the initbox of every player seems overkill, and error-prone. | However the JIP has foobar'd this and adding "if ( local player) { execVM "init_client.sqf"};" to the initbox of every player seems overkill, and error-prone. {{UnsignedComment|BarmyArmy}} | ||
== runInitScript == | == runInitScript == | ||
Adding one item onto the map with <code>if ( local player) then {runInitScript}</code> in the initBox would force JIP clients to run the initscript.[[User:BarmyArmy|BarmyArmy]] | Adding one item onto the map with <code>if ( local player) then {runInitScript}</code> in the initBox would force JIP clients to run the initscript.[[User:BarmyArmy|BarmyArmy]] |
Revision as of 07:29, 8 May 2007
An init.sqf file may be used instead of the init.sqs. Not sure if the article should be moved or just added to. --pyro05x 07:59, 7 February 2007 (CET)
- Add it, as the init.sqs is still working. :) --raedor 15:24, 7 February 2007 (CET)
And if there're both sqs&sqf what happens ? What is executed first ? --bdfy
- I don't know, test it :P --raedor 23:35, 7 February 2007 (CET)
Hmm, seems to execute for each player that joins, as oppose to once at the beginning of the mission... --BarmyArmy, 09:32, 14 April 2007
- Unless something has changed recently, it shouldn't. --Kronzky 17:17, 14 April 2007 (CEST)
- I also noticed that the init is executed for every player that joins. Probably it is the mission start for him. --T_D 14:36, 15 April 2007 (CEST)
- I believe Suma was mistaken in what he wrote there. Executing init for JIP players is much better from a mission editing POV anyway. I sent him a message about it a while ago and he said he'd investigate but heard nothing back so hopefully the current behaviour is here to stay. --Salisan 19:25, 15 April 2007 (CEST)
JIP and INIT.SQS/F
Further investigation shows that init.sqs is NOT run for JIP ( Join-game-in-progress) players. Certainly not on a dedicated server. Which is rather irritating. Template:UnsignedComment
- If I recall correctly, the init.sqs is never run on any other machine than the server. -- Manny 01:43, 7 May 2007 (CEST)
- Init.sqf/sqs runs on all machines during mission initialization. --Ceeeb 06:18, 7 May 2007 (CEST)
- My bad, sorry, I usually don't use init.sqs for client initialization :). You could however seperate the init.sqs into init.sqs (which only runs server related stuff, or stuff that should only on one machine and once, using the good old ?!local server:exit) and init_client.sqf for clients, which are run once by a trigger with condition alive player. Furthermore, push variables across the net again with publicVariable in an onPlayerConnected event handler, in case this is required.
- I'll try to address issues like this in a seperate article about multiplayer locality somewhen this month. -- Manny 15:06, 7 May 2007 (CEST)
- I'm getting the opposite result, ie a JIP player's client executes init.sqf! 5143 beta. --Ceeeb 08:29, 8 May 2007 (CEST)
I normally use:
execVM "init_common.sqf"; if ( local server) { execVM "init_server.sqf"}; if ( local player) { execVM "init_client.sqf"};
However the JIP has foobar'd this and adding "if ( local player) { execVM "init_client.sqf"};" to the initbox of every player seems overkill, and error-prone. Template:UnsignedComment
runInitScript
Adding one item onto the map with if ( local player) then {runInitScript}
in the initBox would force JIP clients to run the initscript.BarmyArmy