OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: crisbal on 13 Jan 2011, 13:39:18

Title: How can i do change player's postion (pilot/gunner) inside an helo IN FLIGHT?
Post by: crisbal on 13 Jan 2011, 13:39:18
Is tah possible , thanks
Title: Re: How can i do change player's postion (pilot/gunner) inside an helo IN FLIGHT?
Post by: Lone~Wolf on 13 Jan 2011, 17:16:11
Simply, use moveingunner or movindriver as a command for the person in question.

If you want something more complicated you can manually manipulate the animations to simulate physically changing seats.

If you need script examples, ask.
Title: Re: How can i do change player's postion (pilot/gunner) inside an helo IN FLIGHT?
Post by: Aldo15 on 13 Jan 2011, 23:52:59
The Lone Wolf has said is true.
 Here's an example of the commands:

-MoveinDriver (http://www.ofpec.com/COMREF/index.php?action=details&id=224&game=All)
-MoveinGunner (http://www.ofpec.com/COMREF/index.php?action=details&id=225&game=All)

REgards....

-Aldo
Title: imposible whit moveingunner/moveindriver when the helo is in flight
Post by: crisbal on 14 Jan 2011, 12:40:43
Even using a trigger , I think i need scripting examples, thanks
Title: Re: imposible whit moveingunner/moveindriver when the helo is in flight
Post by: Aldo15 on 14 Jan 2011, 18:00:01
Hi Friend ...

1. It is possible to make the unit goes from driver to gunner in flight.
 
See this example:
Title: Re: How can i do change player's postion (pilot/gunner) inside an helo IN FLIGHT?
Post by: pertplus on 15 Jan 2011, 00:58:43
1. Give the unit you want to move a name -  p1
2. give the heli a name - h1n1
2. assuming you have waypoints for tyhe helicopter, click on the waypoint you want the switch to happen on and enter the following in the "On Activation" field:

p1 moveingunner h1n1;


Then when it reaches that waypoint the switch will occur. You could do the same thing with a trigger if you want. just set it however you want and put the same command in the on activation field
Title: Re: How can i do change player's postion (pilot/gunner) inside an helo IN FLIGHT?
Post by: Aldo15 on 15 Jan 2011, 01:30:30
Hi pertplus

what you're trying to say is fine, but the unit does not change position in flight. On example I've uploaded I did this:

1. Place names of units:

-Uh = Helo ----> (empty and Flying)
-aP = Driver ---> (uh moveindriver )----> init:
Code: [Select]
this moveindriver uh-aGun = Gunner ---> (Moveingunner uh) ----> init:
Code: [Select]
this moveingunner uh-"1" = Marker ----> (Empty)
-"2" = Marker ---> (Empty)

2. Place a trigger:

Parameters:

Call alfa-radio
-On Activation:
Code: [Select]
aP setPos getMarkerPos "1" ; aGun setPos getMarkerPos "2" ; aP moveinGunner uh ; aGun moveindriver uh
With this trigger aP changes from driver to be a gunner, and aGun changes from gunner  to be driver

The way you have offered don't work .Look at my example

~Aldo
Title: Re: How can i do change player's postion (pilot/gunner) inside an helo IN FLIGHT?
Post by: savedbygrace on 23 Jan 2011, 08:16:48
One of the side effects of moving units around in positions like this, is that it confuses their orders.

For example, HELO:
You can place an empty unit and name each crew member before moving them into position via their Init field.
Using those names(global variables) at anytime during the mission with a single trigger,
Code: [Select]
o1 setpos getpos temppos1; b1 setpos getpos temppos1; {unassignvehicle _x} foreach [o1,b1]; o1 moveingunner t1; b1 moveindriver t1 you can setposition them to another place and immediately move them back into different positions of that same aircraft without effecting the position of the aircraft. However, this causes them to immediately disregard their current waypoint order. The solution is to order them to move to another position somewhere(perhaps along the way) and then they will continue to their current waypoint.

Ground vehicles are different. You can use the same way to switch units around but they don't seem to respond after the switch, even after ordering them to move somewhere else. However, the better way to switch in ground vehicles is to use the code below in the OnActivation field of a trigger.
Code: [Select]
o1 action ["eject",t1]; b1 action ["eject",t1]; {unassignevehicle _x} foreach [o1,b1]; o1 moveindriver t1; b1 moveingunner t1 This will not work for aircraft because as soon as you eject a unit from an aircraft, they are moved into a parachute vehicle.

To do this without having to name units, a script should be used to perform the switch. Using a script may allow you a chance to use the eject action for aircraft by ejecting them from the aircraft, unassigning them, ejecting them from their current vehicle(which will be the parachute), unassigning them from that chute and then move them back into position. Not sure what that would like visually(may leave behind a floating chute).

Hope this helps some.
Title: Re: How can i do change player's postion (pilot/gunner) inside an helo IN FLIGHT?
Post by: Raptorsaurus on 08 Feb 2011, 07:35:59
You can do it using the unassignVehicle command and the setPos command. Like this:

Code: [Select]
_gunner = gunner _craft
_driver = driver _craft
unassignVehicle _gunner
_gunner setPos [0,0,1000]
unassignVehicle _driver
_driver setPos [0,0,2000]
_driver assignAsGunner _craft
_gunner assignAsDriver _craft
_gunner moveInDriver _craft
_driver moveInGunner _craft

As others have mentioned, existing waypoints may be messed up when you do this swap.