Jump to content
Sign in to follow this  
breeze

move in cargo

Recommended Posts

OK I have a chopper starting my mission in a flying position I name it chopper one I have a group of soldiers on the ground that I want to start in the chopper flying i name them player 1 through 5

I label in the init line player1 moveincargo chopper1 and it should work right?

I know theres a more efficent group command but that should work right?

I even made a second set of waypoints the first with being load

if anyone knows the group command that'd be good to.

Share this post


Link to post
Share on other sites

In group leader's init:

{_x moveInCargo chopper1} foreach units group this;

  • Like 1

Share this post


Link to post
Share on other sites

where the x is I put the group leaders name?

Share this post


Link to post
Share on other sites

No._x is variable. _x include all units in group (in that code). So let the _x there and put that code to the group leader initialization line.

Edited by resistance-rat

Share this post


Link to post
Share on other sites

Nope, _x is a reserved value. It means "current value" in a loop. So what that code is saying is "Give me a list of all the units in a group of this guy". Then it'll issue the command of moveInCargo chopper1 for each of the units in turn, _x being replaced by the unit object it's currently on.

Share this post


Link to post
Share on other sites

Executes the given command(s) on every item of an array.
The array items are represented by _x.
Plural commands are executed within one frame, so this command might cause
performance loss when used on very large arrays or with very complex commands.
In ArmA2, the [b]variable[/b] _x is always local to the foreach block so it is safe to nest foreach commands. 

I thought _x is variable.

Edited by resistance-rat

Share this post


Link to post
Share on other sites

Well its still not working? I don't get it this is one of the easier commands that I remember when I used to play this should work with no problem and without getting fancy I cant get it to work with just one unit never mind the damm group

Share this post


Link to post
Share on other sites

yeah im a jerk i was using a chopper with no passenger room LOL sorry

Share this post


Link to post
Share on other sites
yeah im a jerk i was using a chopper with no passenger room LOL sorry

haha, nice. :) I've had that sort of thing happen before to me.

Share this post


Link to post
Share on other sites

Hey!

Sorry to bump this dusty thread but I'm trying to put a unit in a MG nest (MG1) using "this moveInCargo MG1". But it's not working.

Any idea how I should proceed?

I tried to give a "get in" waypoint but it didn't work either.

Edited by 50.cal

Share this post


Link to post
Share on other sites

Wow thx for the quick answer! works perfect!!!

I'm playing around with the 3d editor, mostly to have easy getpos.

After converting the file back for 2d use I will merge it with a simple mission I've made. and thx to you now I will have some units to man those guns :D

Thx again for your help.

Share this post


Link to post
Share on other sites

Set up a trigger that runs a script like this:

_mypos = getpos player;
_myDir = getDir player;
_hint = format ["%1  %2", _mypos, _myDir];
hintSilent _hint;
copyToClipboard _hint;

Move to where you want a unit to be and run the trigger. It'll copy your current position and direction to the clipboard and display it as a hint. Then use it for your eventual setPos. You can even format it as a setPos command so you just paste in the code if you want.

Share this post


Link to post
Share on other sites

Thx for the hints. But how should I use it? shall I go in preview mode each time?

Share this post


Link to post
Share on other sites

Yeah, I actually use that as part of "Editor Dude", it's a custom unit that can teleport, slow time, drop to camera and is independent so I can just run around in a mission without really messing up any of the units. If I want a guy behind a window I'll move to where I want him, copy the location and paste it in as a setPos. This doesn't always work though, for whatever reason. Just remove that unit and set your player unit before packing up the mission.

Another great only-while-making-a-mission module is Virtual House Position. Place it as a module while making the mission and when you walk near buildings little bouncy balls appear in all the preset locations you can use buildingPos with which usually works better than trying to get units in specific locations. Just remove the module from the map before packing up the mission.

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  

×