OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Swatdog on 09 Sep 2005, 06:20:03
-
Is there a script somewhere that will enable an AI chopper to land on top of a building? The pilots don't have to get out, just possibly fly low enough over the building, and then eject the units in transport.
Thanks a lot.
-
the architect achieved something similar in "deep water", where he landed a chopper on what appeared to be one of the LST ships, but which was actually a block of flats.
i suspect it was done by setposing a helicopter H in midair above the object and having the chopper head for it as usual. not sure if this works though as from memory the H tends to appear on the ground no matter what...
worth a try though ;)
EDIT - just had a wee play around with this - see attached missionette - needs some adjustment i think...
(requires general barron's editor addon (http://www.ofpec.com/editors/resource_view.php?id=612) for the buildings...)
-
There also the precise rappelscript from Snypir
With that you can rappel on the roof of a building.
http://www.ofpec.com/yabbse/index.php?board=27;action=display;threadid=6981;start=60
Second post on the page. ;)
PS : It requires SNYSptPack
Maybe you alter the code to make the chopper land on the roof.
-
BAS Blackhawks and Bas Pavelows have rappeling scripts that allow you to insert troops on roof tops. I have seen it done, but it takes a little fiddling around in the editor to find the right position of the waypoint. Check the readme of the blackhawks or the pavelow
Here's the addons...
BAS Blackhawks(MH60/SOAR) 1.00: http://www.gotf.net/download.asp?dl=78
BAS Pavelows 1.10: http://www.gotf.net/download.asp?dl=32
The helo's also requires...
BAS Air Weapons 1.00: http://www.gotf.net/download.asp?dl=19
-
Hehe, you don't need all of those fancy addons to get an AI helocopter to land on a building.
_helo = _this select 0
_building = _this select 1
_zpos = _this select 2
_height = (getpos _helo select 2)
_speedmode = speedmode _helo
dostop _helo
_helo flyinheight (_zpos + 10)
#MoveToBuilding
~1
_distance = _helo distance _building
? (_distance < 250) && (speedmode _helo != "Limited") : _helo setspeedmode "Limited"
_helo domove (getpos _building)
_speed = speed _helo
? (_distance > (_zpos + 15)) && ((abs _speed )> 2) : goto "MoveToBuilding"
_helo flyinheight (_zpos - 2)
@ (getpos _helo select 2 < 1)
#EjectCargo
~1
? count (crew _helo) <= 2 : goto "TakeOff"
_crew = crew _helo - [driver _helo,gunner _helo]
_troop = _crew select 0
_troop action ["GETOUT",_helo]
unassignvehicle _troop
goto "EjectCargo"
#TakeOff
? _height < (_zpos + 5) : _height = _zpos + 10
_helo flyinheight _height
_helo setspeedmode _speedmode
_helo dofollow (leader group driver _helo)
exit
That should do it, _zpos is the height of the roof that the helo is supposed to land on.
-
Thanks for all of your suggestions. I will try them all.
BTW, sorry bedges for posting it into the wrong section. It was "Advanced" to me. :P
-
Ok, before you go saying "it doesn't work", I know, thats why I worked on it some more and thoroughly tested it.
Ill attach the .sqs file and you can download it by clicking on it at the bottom there.
But first, I need to explain how to use it. Whenever you are ready to make the helicopter start its insertion run, execute the command like this:
[heloname,building,zpos,direction] exec "RoofInsertion.sqs"
Heloname is obvious, building can either be the name of one placed in an editor or one on the island (object ID#), direction is a number (0-360) that will tell the helicopter what direction to face before landing (0 = N, 90 = E, 180 = S, 270 = W), and zpos. Now, zpos is very important here, zpos is a number representing the height of the building, and you will need to figure it out depending on the building type (through trial and error), you will know if zpos is to small a number if the helicopter (when it reaches the building) doesn't attempt to land and just sits there, and if it is too large a number, the helicopter will attempt to land, but will stop short of the building and will hover higher than the roof, so then you know you need to decrease the number. Now, I have no idea what any other building's zpos should be, but for the small, 2 story nogova building with the green roof, its exactly 20, and I can assure you that the 4 story one is NOT 40 and the 8 story one is definatly NOT 80. If I were you I would start at 20 and if thats too low, go up by 1 each time, and you may (not sure) have to use a decimal.
Ok, hope it helps.
-
Thanks a lot Kyle. I will be using this script for my mission on the CAT_Afghanistan island, so I will need to determine the height a little differently being that it's not a Nogovan building. I will surely try this right now.
Thanks again, if it works. ;)
-
Ah, in that case, make sure the building has a Roadway LOD on its roof, or, in other words, if you try to walk/drive/land on the roof, it will "feel" like normal ground (unlike the original CWC buildings, where you'd get stuck and everything). Also, I am pretty sure most of the afgan buildings are either about the same height or lower than the 2 story apartment building, but like I said, its a whole lotta trial and error (don't worry, we all have to deal with that :-\).
-
Oh yea, I've done much trial and error. I have a pretty good sense of judement when it comes to how far or high things are, so it shouldn't be too bad.
The only thing I'm worried about is that the chopper that will be landing on the roof will be the new CH-53E Super Stallion released by Semper Fidelis just recently. That is a huge chopper and I don't know if it will conflict with anything. Also the fact that Semper Fidelis made the chopper very hard to maneuver, even the "Auto Hover" has a hard time stabilizing it. So I'm wondering if the AI will have the same difficulty maneuvering that thing around like I have.
Anyway, I will give this a go and get back to you.
-
Oh yea, I've done much trial and error. I have a pretty good sense of judement when it comes to how far or high things are, so it shouldn't be too bad.
The only thing I'm worried about is that the chopper that will be landing on the roof will be the new CH-53E Super Stallion released by Semper Fidelis just recently. That is a huge chopper and I don't know if it will conflict with anything. Also the fact that Semper Fidelis made the chopper very hard to maneuver, even the "Auto Hover" has a hard time stabilizing it. So I'm wondering if the AI will have the same difficulty maneuvering that thing around like I have.
Anyway, I will give this a go and get back to you.
Well considering the afgan buildings have alot more surface area on the roofs, and I was able to get an AI blackhawk to land on that tiny apartment building barely big enough to fit the chopper, then I would say your OK. The only potential problem I see is if the CH-53s have roadway LODs in the cargo bay that will cause the Zpos of the helicopter to be wrong, in which case, the script won't be able to detect when the helicopter has touched down... :-\ If that is the case, I can fix it, but it wouldn't be a great idea to use the modified one on other helicopters, so kind if like a special version just for the CH-53 and some other helicopters with the same problems (BAS MH-47E, etc..).
-
Well, the building can definately hold the chopper and the units just fine, and the height of it is exactly 7m. Now, when do I execute the script? I know that you said when I start the insertion run, but the insertion run will be initiated in the beginning. I guess my question is do I still have to set waypoints, and if so, in which waypoint do I execute the script in?
Also, is your script MP compatible? I don't see why it wouldn't be, but I just thought I'd ask just to make sure.
UPDATE:
Well, I tried giving it a "Move" waypoint to the building, but the stupid AI flies into the city extremely fast, regardless of the speedmode I assign it, and it goes WELL over where I want it to land (other side of the dumb city). I had the script executed when the waypoint was reached, and when it flew over the building, the script got activated and then the chopper lowered it's flyinheight command to I would imagine 17m (since the building is 7m and you had the command _helo flyinheight (_zpos + 10)) which was way too low and when the AI tried to fly itself over to the waypoint, it crashed into other buildings because it was flying too low. Is there a way to make the chopper have a precise landing sequence? Maybe using the script by SnYpir that Blanco refered me too, and possibly combining it with this (minus the rappel part of course)?
-
You don't have to assign any waypoints to the helicopter, simply run the script at the init and it will head to the building, but 7 seems kind of low, why don't you try something like 15? Im not sure if I mentioned this before but zpos is not the exact hight in meters that the roof is from the ground. Anyways try 15 or something and see how that works out, and if you still can't get it to work, take a screenshot of the building and I will try and figure out something.
-
Having executed your script at the beginning and not assigning any waypoints, it won't move at all, which is odd because you said you tested it out? The only thing it does is lower it's altitude.
-
Having executed your script at the beginning and not assigning any waypoints, it won't move at all, which is odd because you said you tested it out? The only thing it does is lower it's altitude.
What are the parameters you used? Can you copy/paste the line where you executed it?
-
[ch53e,object 19665,7,0] exec "RoofInsertion.sqs"
-
Well it should work unless you have the wrong object name. I tried with a different building and it worked, well, not sure about the CH53 though, you might want to try editing the scripts, more specificaly the places where it says (_zpos + #) or (_zpos - #), change the #'s.
-
OK I'll try and mess around with the script a bit.
-
Kyle,
Nice script but I cannot get it to work correctly! :'(
The chopper hovers over the building without dropping off the units long enough for my group to walk across half of Everon! It worked about 3 times out of 10, sometimes landing in the street between buildings! It is more than likely the combination of the _zpos + & - number along with a guess at the height of the building that is giving me trouble.
As a side note, it seems to work best if the units are not grouped to the chopper (tried both ways and the "grouped" units will re-boared the chopper).
Any chance for a simple demo mission?
I think this could also be used (modified) for troop extract as it hovers low enough to use the "Board chopper" action when I got on the roof of the building. Could you make an "extract version" that goes to a specific building (or maybe just the players pos) then, by way of a single map click, takes you to a new location? If not, I think there is a script or two in the Ed Depot that may do the same thing, but I just thought that it was so cool to be able to be picked up off the roof of a building!
Keep up the great work Kyle!
Wadmann