First things first is to follow the hanger tutorial by Ascertes up to the lua section. This can be done on ground maps and you do need need to be in a space map.
As quoted...
After following these steps in you Lua file add line (code below) before the function ScriptPostLoad() like so...Ascertes wrote:This method is not mine! It was developed by Maveritchell! I'm just making the tutorial. Some code contributions by AQT!
Hello fellow SWBF2 Modders! If you've ever played a space battle before, you know that you can land inside enemy hangars with a ship and make your enemies' lives miserable. Harassing the enemy inside their own ship is a quick way to destroy their internal systems without the hassle of having to knock out enemy shields.
...Except the AI don't do it. In singleplayer, it's a complete waste of time to put yourself on defense in the hangar, because you don't have to worry about sabotage or enemy infiltration. Of course, for those who like a bit more of a challenge, this is a let down. Today, I'm going to tell you how to make those foolish AI land in hangars.
Step by Step Guide
The first thing you'll want to do is read up on the FlyerSplineFollowing.txt file. This is located in C:/BF2_ModTools/documentation. If you don't have the mod tools...you shouldn't be reading this.
The text file itself is pretty long and overwhelming, so I'll only give information that's important in the guide:
1. Create a path, just like you would for a CP spawn. The AI fighter units will follow this line.
2. Name the path EntityPath XYZ, for example. EntityPath is important though. That needs to stay.
3. Now see that box in the lower left that let's you set properties? Go there next.
NOTE: Before I continue, here's some important information. Every flying vehicle has a PathFollowerClass variable in its ODF file. Go to the ODF you want the AI to be able to land with, and find its PathFollowerClass. For example, the Droid Gunship's variable is "transport".
4. In the property box, type Class. If you want more than 1 type of vehicle to follow this path, name them Class1, Class2, etc.
5. For the value, add the PathFollowerClass. In this case, transport. Hit Add Property, and it will apply what you've done to the spline, or path.
6. Next, set the path nodes so they start in the middle of space, and end inside the enemy hangar.
7. As a safety precaution, go back to the property boxes and add Direction for the property, and 1.0 for the value. This will ensure the AI will follow the path from node 0 to the end. Otherwise they may try to start from the other end, with disastrous results!
8. Now make a new region and put it inside the hangar. I recommend NOT using the hangar control region for this as if you have it covering the entire hangar, the AI will land the ship half inside and half outside the hangar. Name the region whatever you want. Make sure the Region Property is the same as the region name. So if you named your region Land1, the property must also be Land1. Make sure the path you placed goes inside the new region.
9. Alright, we're done with ZE for now. SAVE FIRST, then close. Open up your ABC_cmn(or _com/ctf).
Code: Select all
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")
EnableFlyerPath("gunship2",1) --RIGHT HERE instead of gunship2 write the name of the path
-- REP Attacking (attacker is always #1)
REP = 1;
CIS = 2;
-- These variables do not change
ATT = REP;
DEF = CIS;
function ScriptPostLoad()
Hidden/Spoiler:
Hidden/Spoiler:
Future Plans:
Currently, I have a finished video sitting here waiting for upload until I get back from vacation that goes over this and a few extra code varitiations so stick around till that comes out (0.0)_b
Discussion Threads About Gunships:
1) = http://www.gametoast.com/viewtopic.php? ... al#p410478
2) = http://www.gametoast.com/viewtopic.php? ... al#p365279
Ai Hangar Land Tutorial:
Tutorial: viewtopic.php?f=27&t=32640
Discussion: http://www.gametoast.com/viewtopic.php? ... al#p526550
Timer Tutorial:
Tutorial: http://www.gametoast.com/viewtopic.php?f=27&t=21511
Credits:
1. Maveritchell
2. Marth8880
3. thelegend
4. AnthonyBF2
5. AQT
6. Ascertes
7. YaNkFaN (Timer)