PR:BF2 Developer
Join Date: May 2012
Posts: 2,814
![Australia](https://www.realitymod.com/forum/images/flags/au.gif) Australia
|
Converting vehicles to one-man
Hey all. It's time to make a tutorial on how to make the one-manned/_bf2 variants for COOP against bots.
Firstly, find the land vehicle you want to convert to one-man.
For this example, we will take the mec_aav_gopher.
You would need: - Copying pr folder, renaming it to pr_edit (all lower-case), going to pr_edit/bin, make a shortcut of PRLauncher.exe in the desktop and renamed.
- Windowed Profile in PRLauncher to test for errors or you can modify any offline or online profile to run on windowed mode. 1280x1080 is recommended.
- WinRar, WinZip or any zip program of choice.
- Notepad++
- Notepad to write down notes of special folders that need to be renamed back to the original name.
Steps: - Make a copy of mec_aav_gopher and rename it to mec_aav_gopher_bf2, including the .tweak and .con files. If you want, you can move the .con and .tweak files into the original vehicle directory which it is done for v1.6, but to prevent confusion, we are making a seperate folder.
- Delete any folders with Meshes, Textures, Animations, .inc files and take note of any special folders like antenna, crowsmg etc in Notepad which is noted below:
- Add in notepad/Make a note that the mec_aav_lwheel and mec_aav_rwheel since you will need to change it back to mec_aav_lwheel etc. Any vehicle that has folders inside, you would need to make sure that they aren't renamed.
The reason is that there's a GeometryTemplate.create & CollisionManager.createTemplate code that allows you to reference the model name without making a copy of it. It's found in the .con files of the original file reference. This nifty feature of DICE saves on hard-disk space and prevents having to make duplicates of the same files.
- Open both .con and .tweak files in Notepad++, find mec_aav_gopher and replace with mec_aav_gopher_bf2, Replace All.
- Remove GeometryTemplate., CollisionManager. codes in .con file since they are not needed, rename ObjectTemplate.geometry, ObjectTemplate.collisionMesh & ObjectTemplate.setCollisonMesh in .con and .tweak back to mec_aav_gopher. Do the same for /sounds/ path, animationSystem.inc path, any folder that you noted that shouldn't be having the _bf2 prefix added and checking _bf2 in the search results to make sure projectileTemplate and other similar names is not accidentally renamed too.
- Replace mec_aav_gopher_bf2_Gunner with mec_aav_gopher_Turret and add up both ObjectTemplate.setPosition together. So -0.0011/0.8218/-1.2306 + 0/1.0510/0.410 = -0.0011/1.8728?/0.8206 (For Adding a - value with a non - value, deduct the minus value with the difference between the non-minus value. So 0.410 - 1.2306 since the - value means to sink down.
- Highlight mec_aav_gopher_bf2_Lwheel (without the _numbers) and press 'Ctrl + F'. Replace mec_aav_gopher_bf2_Lwheel and mec_aav_gopher_bf2_Rwheel with mec_aav_gopher_Lwheel and mec_aav_gopher_Rwheel in both .con and .tweak. Leave the drivewheels as the same. Press 'Ctrl + Shift + S' to Save All.
- Go to the mec_aav_gopher_bf2.tweak and remove the following code:
Code:
ObjectTemplate.addTemplate apc_horn_m113_noammocounter
ObjectTemplate.setPosition 0/0.6/2.5
ObjectTemplate.addTemplate mec_aav_gopher_bf2_Camera
ObjectTemplate.setPosition -0.675491/1.01435/1.53283
Basically we don't want any camera code including armor_commander ones since we are using the Turret/Gunner Camera that's specified in the RotationalBundle ass ObjectTemplate.addTemplate mec_aav_gopher_gunner_Camera (Search for ObjectTemplate.create Camera to find full list).
OPTIONAL: Look in Objects/Vehicles/Common/ZoomGun and add any template inside to have zoom in your turret. For example, add ObjectTemplate.addTemplate zoomGun_5-8x10x. What the 5-8x10 means is there's 8x when pressing X, then afterwards 10x before it changes back to normal view.
- Go to Line 175, highlight ObjectTemplate.activeSafe PlayerControlObject mec_aav_gopher_bf2_Gunnermec_aav_gopher_bf2_Gunner and drag until Line 233 and delete.
- Go to Line 58 'rem ---BeginComp:VehicleHud ---' and under ObjectTemplate.vehicleHud.miniMapIconLeaderSize Medium, add ObjectTemplate.vehicleHud.hasTurretIcon 1.
Make sure ObjectTemplate.vehicleHud.useSelectionIcons is 0 otherwise it will show a white icon when pressing the number buttons.
- Go to Line 87 ObjectTemplate.aiTemplate apc_driver_tracked_6010_ai and replace with ObjectTemplate.aiTemplate apc_driver_tracked_705_bf2_ai.
What this does is enable bots to control both the turret and the vehicle the same way as in Battlefield 2 (The reason why it's called _bf2).
All ai templates (Objects.ai and Weapons.ai) are located in objects\vehicles\Land\weapon_ranges_land.
Objects.ai = For PlayerControlObject -> ObjectTemplate.aiTemplate
Weapons.ai = For GenericFirearm -> ObjectTemplate.aiTemplate
- As a final check before testing, search for /sounds/ to make sure the vehicle's folder sounds haven't been modified.
Also search for ObjectTemplate.seatAnimationSystem to do the same.
- Go to levels and find the level that you want to test it in. Personally depending on the vehicle, I like desert maps since they are bright
So click on fallujah_west folder, press S to go to server.zip and open it. Navigate to gamemodes, gpm_insurgency, 64 and then double-click on gameplayobjects.con.
- Find ObjectTemplate.setObjectTemplate 2 or 1 and replace the vehicle with mec_aav_gopher_bf2. Save. Winrar will say a file is modified, do you wish to update it in the archive. Click on Yes or press enter.
- Make a shortcut in pr_edit/bin/PRLauncher.exe in the desktop and rename it pr_edit launcher so you know it's the editable version. Make a new profile that's windowed so you can view any errors when loading it. Load Fallujah West Insurgency 64/Standard layer and if everything is correct, it should load in the spawn screen.
- Bring up the chat box, type in 'rcon debug' and then 'rcon spawner mec_aav_gopher_bf2' without quotations. It will spawn. Check to make sure everything is good. If the turret is sinked in, that means the .con ObjectTemplate.position /Y/ is not set correctly.
Tips: - Do not leave a copy of the .con and .tweak files in the folder. The game may complain about too many networkable states because it's essentially double-loading the files.
If it's not triggering the above error, then it will essentially duplicate turrets, wheels etc and your vehicle may look like something out of a steampunk novel. ![Mr. Green](https://www.realitymod.com/forum/images/smilies/icon_mrgreen.gif)
- If the game crashes with no error message, and/or just as a general practice, use PRDebugger. Tutorial for that is here.
- You do not need to delete the PlayerControlObject code in the .tweak and the driver Camera code, although it's a good habit to do so you have all code that's in use rather than leftover code. This is what's usually done by me when making the _bf2 etc vehicles.
To recap/Summarize: - Make a copy of the vehicle folder you want to convert to _bf2.
- Take note of any folders inside, remove Meshes, Textures, Sounds and .inc folders as these aren't needed.
- Rename each .con and .tweak file to add the _bf2 suffix. You can use Bulk Rename Utility to do this.
- Rename everything, but fix ObjectTemplate.geometry, ObjectTemplate.collisionMesh, ObjectTemplate.animationSystem, /Sounds/, any special folder inside like vehiclename_antenna.
- Replace gunner PCO seat with Turret (RotationalBundle), add up the position to the existing one or if there's no position line in the gunner section, simply copy the value over to the turret section.
- Rename things like bf2_wheel to wheel, keep the RotationalBundle as is. You can probably live with the bf2. You can try leaving it as is as a test to see if renaming it is needed.
- Delete the PlayerControlObject code and the reference in ObjectTemplate.addTemplate.
- Remove all camera, armor_commander etc stuff and add ZoomGun_x8 or any other template using existing _bf2 values. All zoom gun template is found in Objects/Vehicles/Common/ZoomGun.
- Replace AITemplate with BF2 version - Found in vehicles\Land\weapon_ranges_land. Search for .ai and load all.
Note: Template contents have been added as a name for each ai template for v1.6, meaning you don't need to open all Objects.ai and Weapons.ai since the filename has the Vehicle_Objects.ai and Weapon_Weapons.ai inside.
- Add ObjectTemplate.hasTurretIcon 1, disable ObjectTemplate.useSelectionIcons 1 or add rem before it. So rem ObjectTemplate.useSelectionIcons 1 which will disable the line, and the engine will therefore see it as off if there's no line.
- Add vehicle to GPO (GamePlayObjects.con) of level, run PRLauncher in Windowed mode to catch errors, run debugger, go to mods/pr_edit/logs and search for 'Asserts' and find the issues at the bottom then resolve.
- Spawn the vehicle using rcon debug, rcon spawner [vehicle name]. Make sure you spawn the correct vehicle otherwise if it's not matching what's in the GPO, the game will crash. If it crashes, then usually there's a typo with the collisionMesh/geometry.
Anyways I hope this helps. Each vehicle may be easy or difficult depending on it's model layout but this will cover the foundations.
|