Jump to content
Sign in to follow this  
Rak

Synchronise Problems

Recommended Posts

Hello all,

I've been trying to get into mission making and I can say I've made my first mission. Though, it does work great in Singleplayer, I have some problems in Multiplayer.

The thing is, I have a chopper moving into the base at the start of the mission. It should land and pick us up(my GET IN waypoint is synchronised to his LOAD waypoint, it also has a helipad to land).

What happens in Multiplayer is; it approaches to the base, and when it reaches the "LOAD" waypoint, it immidiately rushes to "TRANSPORT UNLOAD" waypoint. Which in doing leaves my group staring at him on the ground. This only happens when I'm the group leader. When I let the AI do it, it perfectly lands and picks us up. Which confuses me on what to do.

help.gif

Share this post


Link to post
Share on other sites

Any ideas? sad_o.gif

Share this post


Link to post
Share on other sites

Sry mate one of lifes great mysteries!

Can never get that to work myself!

Try putting helipads around the area,works sometimes crazy_o.gif

Share this post


Link to post
Share on other sites

I have a pair scripts that will solve that problem for you. It actually solves *several* problems with using helicopters in arma.

CSL_HeliDrop.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

// To Use: make a move waypoint for your helicopter near a H or H(Invisible) and put the following in the on activation box

// CSL_Garbage = [MyHeloName, (leader MyGroupName), desiredFlyOutHeightInMeters] execVM "CSL_HeliDrop.sqf"

// BEGIN SCRIPT

if (isServer) then

{

// Get All Passed Data

_chopper = _this select 0;

_group = _this select 1;

_flyOutHeight = _this select 2;

// Stop the chopper from trying to go to the next WP

_chopper LockWP true;

_chopperPos = getPos _chopper;

_chopperDir = VectorDir _chopper;

// Once the Helo touches the ground, this will be set to true and

// will prevent takeoff until squad is aboard

_grounded = false;

_squadInHeli = true;

while {(GetPos _chopper select 2) > 1} do

{

// synchronise with frame rate

_i = 0;

waitUntil {_i = _i + 1; _i > 1};

_chopper land "GET OUT";

};

_chopperPos = [getPos _chopper select 0, getPos _chopper select 1, getPos _chopper select 2];

_chopperDir = VectorDir _chopper;

while {_chopperPos select 2 > 0} do

{

_chopper setPos _chopperPos;

_chopper setVectorDir _chopperDir;

sleep 0.001;

_chopperPos = [_chopperPos select 0, _chopperPos select 1, (_chopperPos select 2) - 0.03];

};

// loop until the squad has gotten out

while {_squadInHeli} do

{

// synchronise with frame rate

_i = 0;

waitUntil {_i = _i + 1; _i > 1};

_chopper setPos _chopperPos;

_chopper setVectorDir _chopperDir;

_chopper flyinheight 0;

// pull all squad members

_squad = units _group;

// count all squad members

_squadCount = count _squad;

// create a counter for those that have boarded

_incount = 0;

_i = 0;

// loop to check status of squad mates

while {_i < _squadCount} do

{

if ((_squad select _i) in _chopper) then

{

_incount = _incount + 1;

unassignVehicle (_squad select _i);

(_squad select _i) action ["eject", vehicle (_squad select _i)];

};

_nowTime = time;

while {time <= (_nowTime + 1)} do

{

if (time <=5) then {_nowTime = time;};

// synchronise with frame rate

_j = 0;

waitUntil {_j = _j + 1; _j > 1};

_chopper setPos _chopperPos;

_chopper setVectorDir _chopperDir;

_chopper flyinheight 0;

};

waitUntil {vehicle (_squad select _i) == (_squad select _i)};

if ((getPos (_squad select _i) select 2) > 1.7) then

{

(_squad select _i) setPos [(getPos (_squad select _i) select 0), getPos (_squad select _i) select 1, 0];

};

if (not (isPlayer (_squad select _i))) then

{

while {(_squad select _i) distance _chopper < 6} do

{

(_squad select _i) setPos [(_chopperPos select 0) + 7, _chopperPos select 1, 0];

// synchronise with frame rate

_j = 0;

waitUntil {_j = _j + 1; _j > 1};

};

};

_i = _i + 1;

};

// if there are still squadmembers in the chopper, loop, otherwise, exit

if (_incount == 0) then {_squadInHeli = false;};

};

// small delay for effect

_nowTime = time;

while {time <= (_nowTime + 20)} do

{

if (time <=5) then {_nowTime = time;};

// synchronise with frame rate

_i = 0;

waitUntil {_i = _i + 1; _i > 1};

_chopper setPos _chopperPos;

_chopper setVectorDir _chopperDir;

_chopper flyinheight 0;

};

// Set flying height to height specified in script

_chopper flyinheight _flyOutHeight;

_chopper doMove (getPos _chopper);

// Since all squad members are in the chopper, let it move to the next waypoint.

_chopper LockWP false;

};

// finished

// END SCRIPT

CSL_HeliPickup.sqf

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

// To Use: make a move waypoint for your helicopter near a H or H(Invisible) and put the following in the on activation box

// CSL_Garbage = [MyHeloName, (leader MyGroupName), desiredFlyOutHeightInMeters] execVM "CSL_HeliPickup.sqf"

// BEGIN SCRIPT

if (isServer) then

{

// Get All Passed Data

_chopper = _this select 0;

_group = _this select 1;

_flyOutHeight = _this select 2;

// Stop the chopper from trying to go to the next WP

_chopper LockWP true;

// Once the Helo touches the ground, this will be set to true and

// will prevent takeoff until squad is aboard

_grounded = false;

_squadNotInHeli = true;

// loop until the squad has got in

while {_squadNotInHeli} do

{

// small delay so the script doesn't eat all resources

sleep 0.5;

// if the chopper hasn't landed, tell it to do so

if ((GetPos _chopper select 2) > 1) then {_chopper land "GET IN";};

// if it has landed, let the script know to keep it on the ground

if ((GetPos _chopper select 2) <= 1) then {_grounded = true;};

// if the helicopter has landed and is grounded

// prevent take off

if (_grounded) then {_chopper flyinheight 0;};

// pull all squad members

_squad = units _group;

// count all squad members

_num = count _squad;

// create a counter for those that have boarded

_incount = 0;

_i = 0;

_squadCount = count _squad;

// loop to check status of squad mates

while {_i < _squadCount} do

{

if ((_squad select _i in _chopper) or (!alive (_squad select _i)))then {_incount = _incount + 1;}

else

{

if ((_squad select _i distance _chopper) <= 9 and (not (isPlayer (_squad select _i)))) then

{

_squad select _i playmove "AmovPercMstpSnonWnonDnon_AcrgPknlMstpSnonWnonDnon_getInMedium";

sleep 4;

_squad select _i moveInCargo _chopper;

};

};

_i = _i + 1;

};

// if there are still squadmembers out of the chopper, loop, otherwise, exit

if (_incount == _num) then {_squadNotInHeli = false;};

};

// small delay

sleep 5;

// Since all squad members are in the chopper, let it move to the next waypoint.

_chopper LockWP false;

// Set flying height to height specified in script

_chopper flyinheight _flyOutHeight;

};

// finished

// END SCRIPT

Share this post


Link to post
Share on other sites

I've made a Helicopter Tutorial, but only in german language smile_o.gif

On the "Load" waypoint you can write as condition NameofHeli flyinHeight 1;

Then place directly at the "Load" waypoint of the heli a "Move" waypoint. In this condition you write {_x in NameofHeli} foreach units group player;

Now the heli arrives his "Load" waypoint, fly in height of 1 meter and wait till the group of the player is in the heli. Then he fly away

wink_o.gif

Hope this helps too

Regards

Imutep

Share this post


Link to post
Share on other sites

Thank you guys! I loved ArmA editing but this problem was really bugging me.

It seems singleplayer and multiplayer is a lot different in how arma ArmA plays.

Cheers,

Rak

Share this post


Link to post
Share on other sites
{_x in NameofHeli} foreach units group player;

That's the basic methodology used in the script above. The thing is that without elaboration, the basic method breaks when someone who's separated from the squad dies. Basically, the group command returns everyone that the squad thinks is alive, just like you see in the command menu at the bottom of the screen. If someone dies where no squadmember sees them, it'll take several minutes for the squad to realize he's missing.

It also fails when the AI gets stuck on the helicopter. This problem is especially noticable on the mi-17 and blackhawks with rocket pods, as they like to get caught up behind the launchers sometimes.

The script above accounts for both problems and solves them.

Share this post


Link to post
Share on other sites

Right CSL xmas_o.gif good scripts

Another easy way without scripting is, select your team, click on the incoming chopper and your team will get in when the chopper is landing. But you must be in the chopper before the last man from your team is in. Otherwise the chopper fly away with your team but without you confused_o.gif

Share this post


Link to post
Share on other sites
I have a pair scripts that will solve that problem for you.  It actually solves *several* problems with using helicopters in arma.

[/code]

Hello,

Thank for the help. Though when I put this in the waypoint "On Act." box, I get a "Type Script: Expected Nothing" error. I don't know what to do help.gif

[MyHeloName, (leader MyGroupName), desiredFlyOutHeightInMeters] execVM "CSL_HeliPickup.sqf"

Share this post


Link to post
Share on other sites
Thank for the help. Though when I put this in the waypoint "On Act." box, I get a "Type Script: Expected Nothing" error. I don't know what to do help.gif

[MyHeloName, (leader MyGroupName), desiredFlyOutHeightInMeters] execVM "CSL_HeliPickup.sqf"

Those lines "MyHeloName" are usually used as example just as the group name.(I assume this is the case here)

You just need to change them with names you are using in your mission.

And dont forget the ";" at the end of that line.

Share this post


Link to post
Share on other sites

It's me again whistle.gif

This time, I gave Imutep's method a go. It works when I give names to each group member names like "s1", "s2" and write in the helicopter move waypoint condition box "s1 in UH60 && s2 in UH60 . . ." it works.

But I want to make a MP mission and I want the game to check if all the group members are in, in case some of them died. So, I define my group as "mygroup" and put this in the move waypoint condition box: "{_x in UH60} foreach units group mygroup;". It gives me an error "Type nothing, expected Bool".

I'm about to get this one to work. I just need a little more help :X

Share this post


Link to post
Share on other sites

Try {_x in UH60} foreach units group player;

or

{_x in UH60} foreach units mygroup; smile_o.gif

Share this post


Link to post
Share on other sites

I've got it working with CSL scripts, but I've learned a lot in the progress. Thanks!

Share this post


Link to post
Share on other sites
I have a pair scripts that will solve that problem for you. It actually solves *several* problems with using helicopters in arma.

Hello,

Thank for the help. Though when I put this in the waypoint "On Act." box, I get a "Type Script: Expected Nothing" error. I don't know what to do help.gif

[MyHeloName, (leader MyGroupName), desiredFlyOutHeightInMeters] execVM "CSL_HeliPickup.sqf"

I know you got it working, but for the benifit of other people, the trouble there is that arma has the capability to return a value with the execVM command.

This means that in the editor, you have to give it a variable to put a potential return value into. If the script returns nothing, I just use garbage as my variable name, like so:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">CSL_Garbage = [MyHeloName, (leader MyGroupName), desiredFlyOutHeightInMeters] execVM "CSL_HeliPickup.sqf"

Note that programming convention says that you *never* assign "garbage" as a variable name that contains a value you actually intend to keep. Therefore, you always know that garbage is just junk.

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  

×