OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Clayborne on 30 Mar 2009, 01:44:18

Title: MoveInCargo from one vehicle to another?
Post by: Clayborne on 30 Mar 2009, 01:44:18
I did a search for this, but it's hard to know how to word it. I'm not so sure this can be done, so I thought it was quicker to ask.

I would like the player group to start out riding in a chopper, then when they reach a trigger, I want them to teleport to a different vehicle. Basically I am trying to simulate a zodiac being dropped from the back of a chinook over the water, with the player group inside. Everything works except for the group loading into the boat.

I tried messing around with UnassignVehicle and AssignAsCargo and things like that, but they didn't do anything, at least not in the order I was doing it.

As I said, everything works except for the group switching vehicles. If I don't have my group loaded in the chopper at the start, we are teleported into the zodiac as planned when the trigger is activated. It just doesn't work when I have been cargo in another vehicle.

I'd be grateful for any help!
Title: Re: MoveInCargo from one vehicle to another?
Post by: zwobot on 30 Mar 2009, 06:58:13
Did you try to eject the units of the group prior to moveInCargo'ing them into the zodiac?
Code: [Select]
"_x action [""eject"", chopper_name]" forEach units your_groupname
"_x unassignVehicle chopper_name" forEach units your_groupname
"_x moveInCargo zodiac" forEach units your_groupname
Title: Re: MoveInCargo from one vehicle to another?
Post by: Clayborne on 30 Mar 2009, 20:50:40
Thanks alot zwobot, that worked great. UnassignVehicle or Unassign doesn't seem to work in the context of a group command, but I just removed that line and it still works anyway.

Thanks again!
Title: Re: MoveInCargo from one vehicle to another?
Post by: zwobot on 30 Mar 2009, 21:12:39
Ah you are right, I did a bubu with the syntax on unassignVehicle (http://community.bistudio.com/wiki/unassignVehicle)
It should be:
Code: [Select]
"unassignVehicle _x" forEach units groupnameI recommend to use unassignVehicle after ejecting the units and before moveInCargo'ing them into the next vehicle, otherwise there is a slight possibility of the AI becoming confused and trying to board the first vehicle again.
Title: Re: MoveInCargo from one vehicle to another?
Post by: Clayborne on 30 Mar 2009, 21:32:26
Ok I guess I'll do that then, as in this case if they tried to reboard the first vehicle they'd run into the sea.

Thank you for the help.
Title: Re: MoveInCargo from one vehicle to another?
Post by: Clayborne on 18 Jan 2010, 20:57:24
Hi again,

This shoud probably be in the MP section but I remembered I had made the thread. I have only recently been able to test this in multiplayer, and there are some problems.

If a client is the group leader, everyone in the group is simply ejected from the chopper and falls into the sea, except for the server player who is transported into the zodiac.

If the server is group leader, everyone including him is moved into the zodiac, except client players who are dropped in the drink! Here's my script. R1 is the zodiac, ch1 is the chopper, sarge is the group leader.


Code: [Select]
~0.1

"unassignVehicle _x" forEach units group1
"_x action [""eject"", ch1]" forEach units group1

~0.1

"_x moveincargo r1" foreach [ sas1, sas2, sas3, sas4 ]
sarge moveindriver r1

~2


Would it work if I assigned everyone as cargo to the zodiac before moveincargoing them? Should I moveincargo the units individually with a short delay in between?

Any help appreciated!