Synide – User talk

From Bohemia Interactive Community
Revision as of 14:52, 31 May 2007 by Synide (talk | contribs)
Jump to navigation Jump to search

The following is temporary...


This is my init.sqf file I use in all my missions. It correctly identifies in what context the init.sqf file is being run.

init_common = compile preprocessfile "scripts\init_common.sqf"; init_server = compile preprocessfile "scripts\init_server.sqf"; init_client = compile preprocessfile "scripts\init_client.sqf"; init_jip = compile preprocessfile "scripts\init_jip.sqf"; Context = objNull; //isServer = call {if (local SERVER) then {true} else {false};}; // for use with v1.05, requires... GameLogic called 'SERVER' to be present on map. if (isServer) then { Context = "SP_SERVER"; if (isnull player) then {Context = "MP_SERVER";}; } else { Context = "MP_CLIENT"; if (isnull player) then {Context = "JIP_CLIENT";}; }; _handle = [] spawn init_common; waitUntil {scriptDone _handle;}; switch (Context) do { case "MP_SERVER": {call init_server;}; case "SP_SERVER": {call init_server; call init_client;}; case "JIP_CLIENT": {call init_jip;}; case "MP_CLIENT": {call init_client;}; };

Things to note about the above for MP only.

  • If you are there at mission launch from that point on your 'Context' will always be 'MP_CLIENT' and will stay as such even when you respawn.
  • If you are an 'MP_CLIENT' then you 'disconnect' from the continuing mission and select a new playable character you will become a 'JIP_CLIENT'.
  • If you join an inprogress mission you will be a 'JIP_CLIENT' from that point till the mission ends.