OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: M!StAkE id11479 on 05 Oct 2009, 15:23:11

Title: Moveincargo troubles in MP
Post by: M!StAkE id11479 on 05 Oct 2009, 15:23:11
Hi ofpec community.  :)
I maked a big MP para mission but sometimes it start wrong...
I have 2 player squads starting in 2 differents ch-47 choppers with the classic command "moveincargo heli foreach units mygroup", it work fine when i try in solo or with 2 or 3 friends on my pc as server, but when i try it on a ded server with full players the first time one full squad started out of chopper and the second time 3 players, i think its due to desynch and lag troubles, am i right?
If yes is there any solution for making sure the both squads start in choppers??   :dunno:
Title: Re: Moveincargo troubles in MP
Post by: tcp on 07 Oct 2009, 22:07:19
Yes, probably due to not all players initializing at same time.
Either, put <this moveInCargo heli;> in each unit's init

Or, in init.sqf:
Code: [Select]
sleep 1;
waitUntil{alive squadleadername};
if(group player == group squadleadername) then {player moveInCargo heli};

If you have AI enabled, you might have to do this:
Code: [Select]
sleep 1;
waitUntil{alive squadleadername};
if(isServer) then {
{if(!isPlayer _x) then {_x moveInCargo heli}} forEach units group squadleadername;
};
if(group player == group squadleadername) then {player moveInCargo heli};
Title: Re: Moveincargo troubles in MP
Post by: M!StAkE id11479 on 08 Oct 2009, 18:30:55
Thanks for your help!  :good:
Ill try tonight.
Title: Re: Moveincargo troubles in MP
Post by: Mr.Peanut on 19 Nov 2009, 16:58:02
tcp's code is for ArmA, not OFP.

Two things.
1) In MP best to always assign every unit to a group name in each unit's init.
Code: [Select]
grpCheese = group this2) Move your all your unit initialisation code to the init.sqs
Code: [Select]
{_x moveInCargo heliCheese} forEach units grpCheeseI have often had problems in MP with code in units init fields. Sometimes the code never executes. However, the group assignment always does.