OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Tom on 24 Aug 2006, 09:08:40

Title: player boarding chopper
Post by: Tom on 24 Aug 2006, 09:08:40
I made a mission where the player has to hold his position until a blackhawk arrives to pick him up. But i dont know how to make the chopper land and allow the player to board, then fly off. (i want the player to be able to man the machinegun when the helo arrives). Whats more, is that when the helo reaches a certain point, it starts to take damage and the player and the crew have to bail out and reach the designated point on foot. And again, i have no idea how to do all this. Do i make the player join the helo crew so that he/she is under their command? Or do i use that assign script? Or any other method? Any help is appreciated.

Thanks in advance.
Title: Re: player boarding chopper
Post by: THobson on 24 Aug 2006, 21:07:07
I suspect the reason you have had no replies is that getting an ai chopper to land for a human player is notoriously difficult to do reliably.  Could you not go to a cutscene as the chopper arrives and lands, fade to black, move the player into the chopper then fade from black?

EDIT:

I  have just had a play with this and think I have a solution.  The problem is that to get a chopper to land for the player the player has to be at a GetIn waypoint and you cannot guarantee that the player will go to exactly the correct place.  My solution is to move the waypoint to the player.

Try this:

Chopper has a waypoint where it waits until it is called in (set the condition field to  ChopperNeeded)
The next waypoint is a Load waypoint that is placed next to an invisible H.
The next WP is some distance away

The player has a GetIn waypoint that is synchronised with the chopper's Load WP

Create a radio trigger that is used to call the chopper.  The on Activation field should be:

ChopperNeeded = true;[group player,1]  setWPPos getPos player

This will release the chopper from the WP where it is waiting and will move the player's GetIn WP to the player's location.


(NB this assumes that the GetIn WP is the player's first wp. )

Have a look at the attached missionette
Title: Re: player boarding chopper
Post by: Tom on 25 Aug 2006, 12:13:47
thanks mate, its appreciated. I will try this tonight and see if it works. Thanks again!
Title: Re: player boarding chopper
Post by: Tom on 28 Aug 2006, 06:16:47
I played around with the triggers and stuff, and it works. It even works when the player has more than one waypoint AND a squad with him. Which is good. But I was trying something.

The helo that comes to pickup the player only has one pilot. I had an empty UH60-MG with its name as 'chop1' and the pilot's init field was "this moveindriver chop1". It works, but instead of landing to pickup the player when the helo is called in, the chopper reaches the LOAD waypoint then flies off without bothering to land. I want the player to be able to get aboard the chopper and man the machinegun while the helo continues along it path. What am i doing wrong?
Title: Re: player boarding chopper
Post by: XCess on 28 Aug 2006, 06:49:02
Try making it a normal manned helicopter and on the init ass the following deleteVehicle heloNameG. where heloName is the name of the helicopter, adding the letter G to the name would define the helicopter's gunner, and therefore, the command would delete the gunner, if i remember correctly anyway...

Also, you could try adding pilotName assignAsDriver heloName

The OFP AI is very strange sometimes :p
Title: Re: player boarding chopper
Post by: THobson on 28 Aug 2006, 09:23:49
Doing a deleteVehicle on a unit that is inside a vehicle does not work correctly.  It may in this case, I have not tried it, but is some cases I have had real problems.  I suggest you use the method that I have found to work with no problems.  In the init field of the chopper put:
[this] exec "RemoveGunner.sqs"

RemoveGunner.sqs should look something like:

Code: [Select]
_veh = _this select 0
_gunner = gunner _veh
unassignVehicle _gunner
_gunner setPos [0,0,0]
deleteVehicle _gunner
exit
Title: Re: player boarding chopper
Post by: Tom on 29 Aug 2006, 12:59:24
hmmm i'll try that instead. Should work, and if it doesnt, then ive done something wrong lol. Will let you know.
Title: Re: player boarding chopper
Post by: PetriHonka on 16 Sep 2006, 22:06:11
Have you tried using the hold waypoint method on a pilot, and when the radio is sent, have the pilot get in the chopper and carry on. Should work.
Title: Re: player boarding chopper
Post by: sharkattack on 17 Sep 2006, 13:49:19
i have a script created to do just that ... it used to be in the editors depot on the old site.. sharkshelo.sqs
if it isnt there i could  send you a demo mission of how to use the scripts..