Jump to content
Sign in to follow this  
thomsonb

MP Dynamic mission questions

Recommended Posts

Hi guys

I am making a MP Coop version of my dynamic mission.

I am experienced at scripting and debugging and dynamic mission stuff, but only in Single Player missions!

I have run into a few problems can anyone offer any pointers?

Problem:

Equipping the players with custom loadouts. I am running a script from each players init line in the editor... [this,0] execVM "equipPlayer.sqf" ...where the number specifies a load out from a list.

About 90% of the time this works fine and the unit starts with the custom loadout. However, 10% of the time the unit starts the mission with the default load out, as if the script has not been called. I have had the problem as client on a dedicated server and as client on a local server and as host of local server.

Any ideas why it doesn't execute reliably every time?

cheers

B

Share this post


Link to post
Share on other sites

Read:

http://community.bistudio.com/wiki/Locality_in_Multiplayer

http://community.bistudio.com/wiki/6thSense.eu:EG

And maybe some here:

https://dev-heaven.net/projects/cmb/wiki

My advice: Get rid of unit init coding and move completely to script files.

By this you are the boss what happens and not obscure logic behind unit inits (at least to beginners it is).

Edited by .kju [PvPscene]

Share this post


Link to post
Share on other sites

The init's are some of the first things to run when you start a mission. Some times it may try and run the script and the mission may not have fully started yet and the Unit has not been created yet. To help out with this you can put a wait at the top of your script, like this:

waitUntil {time > 0};

That will make sure it does not run until the mission actually starts. But to be honest you will still probably have problems with jip, the inits of veh are gloabal you need a way to handle things locally weather they join at mission start or later, but unfortunitly the init.sqf does not always run for jip.

I think the best way to handle is the way xeno does it, with a player jip init. something like this:

place a trigger with the condition:

// this will make sure it only runs for the player on his local machine.

local player 

on acct:

nul = [] execVM "jip_init.sqf";

Now name your players in the editor accordingly...

jip_init.sqf:

/// Start your load out script here along with any thing else you need to run locally.

your_loadout.sqf:

if (isServer) exitWith {};


_plr = player;




switch (_plr) do
{
   case p1:
   {
       //Change load out here       
   };


   case p2:
   {
       //Change load out here
   };


   // etc...
};

/// Beaten to it while I was typing in the post above lol.

Here is a good guide to learn more about multiplayer scripting:

http://community.bistudio.com/wiki/6thSense.eu:EG

Share this post


Link to post
Share on other sites
...I think the best way to handle is the way xeno does it, with a player jip init....
My advice: Get rid of unit init coding and move completely to script files.

Thanks for the quick and informative replies Riouken and PvPscene, the way ahead is much clearer now :)

I was beginning to wonder what I had let myself in for with the MP locality and Sync problems!?!

I have another question:

Regarding MP selectPlayer I have searched and found several "workarounds" for MP selectPlayer, for example this one

Are there any new improvements in the built in commands? Or are there any newer / easier / better ways of doing this??

Having a randomized player unit and side are quite important in making my missions!

EDIT

Another problem!

I am using this code to set the time randomly:

if(isServer)then{

startTimeSkip = random 17;

publicVariable "startTimeSkip";

};

waitUntil {startTimeSkip != -1};

skipTime startTimeSkip;

Problem is, it works fine when run the first time, both server and client "waitUntil {startTimeSkip != -1}" and then go on to setup.sqf

However, when I restart the mission via the "Restart" option when logged in as admin, the script fails to get passed "waitUntil {startTimeSkip != -1}" on the client!

Surely a restarted mission is exactly the same as a first run mission?! (or from another angle, is restarting a mission a bit like a JIP condition?)

Thanks

B

Edited by thomsonb

Share this post


Link to post
Share on other sites

My advice: Get rid of unit init coding and move completely to script files.

By this you are the boss what happens and not obscure logic behind unit inits (at least to beginners it is).

^^This. :)

Better advice cannot be given, using editor init lines, editor triggers and editor waypoints is definantly the way Not to do it when handling MP missions.

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  

×