project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding > Modding Tutorials
01 Nov 2024, 00:00:00 (PRT)
Register Developer Blogs Members List Search Quick Links
Modding Tutorials Information and tutorials related to modding BF2.

Reply
 
Thread Tools Display Modes
Old 2019-06-24, 11:55   #1
[R-DEV]​Arab
PR:BF2 Developer
Supporting Member

Arab's Avatar
Post 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:
  1. 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.

  2. 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:

  3. 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.

  4. Open both .con and .tweak files in Notepad++, find mec_aav_gopher and replace with mec_aav_gopher_bf2, Replace All.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. Go to Line 175, highlight ObjectTemplate.activeSafe PlayerControlObject mec_aav_gopher_bf2_Gunnermec_aav_gopher_bf2_Gunner and drag until Line 233 and delete.

  10. 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.

  11. 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


  12. 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.

  13. 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.

  14. 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.

  15. 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.

  16. 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.

  • 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:
  1. Make a copy of the vehicle folder you want to convert to _bf2.

  2. Take note of any folders inside, remove Meshes, Textures, Sounds and .inc folders as these aren't needed.

  3. Rename each .con and .tweak file to add the _bf2 suffix. You can use Bulk Rename Utility to do this.

  4. Rename everything, but fix ObjectTemplate.geometry, ObjectTemplate.collisionMesh, ObjectTemplate.animationSystem, /Sounds/, any special folder inside like vehiclename_antenna.

  5. 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.

  6. 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.

  7. Delete the PlayerControlObject code and the reference in ObjectTemplate.addTemplate.

  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. 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.

Arab is offline
Last edited by Arab; 2019-06-24 at 12:36..
Reply With Quote
Old 2019-06-24, 18:52   #2
[R-CON]​Fastjack
PR:BF2 Contributor

Fastjack's Avatar
Default Re: Converting vehicles to one-man

Nicely done, Arab.

What about 2nd way with the pcoID trick like you did with the ambush_pco ?
Could also be mentioned here for short term tests and using this trick via tmp.con

This tutorial morphs an deployment vehicle to a coop vehicle (1seater) and bots can use 1 seaters better because of the bf2_friendly_ai but there is ALWAYS A BUT .....
Those BUT's cannot be solved with nice objects.ai's and/or weapons.ai's.


Additional Info's
Excample a tank with 2 weapons - ItemIndex 1 AT and ItemIndex 2 HE.
The firecommand for both weapons are PIFire. Bots having a problem using a vehicle weapon on ItemIndex 2 on PIFire.

To get a _bf2 vehicle with those weaponsetups 100% working with the bot ai, you have to change the FireInput command of the ItemIndex 2 weapon to PIALTFire and have to change also the FireInput i the weapons.ai.

But than you have to think about your coax weapon because it already uses the PIALTFire command.
You could remove the smokelauncher from a _bf2 tank as excample and give the coax the PIFlareFire Firecommand.

Really Important
Remove (maybe its not in there depends on the aiTemplate you used) the line from the objects.ai aiTemplate.Secondary
You can drive the vehicle now but this ai-codeline tell the engines that it isn't the driver position.
That cause CTD's.

Sure, this vehicles are designed only for bots and should be locked (blackscreen) for humans because they have a complete different handling as the Deployment ones.
Fastjack is offline Reply With Quote
Old 2019-06-30, 18:50   #3
OrangeFr3ak
Default Re: Converting vehicles to one-man

Thanks, but how do I convert vehicles without "turret" such as the MTLB Shturm?
OrangeFr3ak is offline Reply With Quote
Old 2020-09-19, 22:15   #4
saulgoodman
Default Re: Converting vehicles to one-man

Is this guide still relevant?
saulgoodman is offline Reply With Quote
Old 2020-09-20, 05:04   #5
[R-DEV]​ALADE3N
PR:BF2 Developer

ALADE3N's Avatar
Default Re: Converting vehicles to one-man

Quote:
Originally Posted by saulgoodman View Post
Is this guide still relevant?
depends if you want some vehicles one-manned

ALADE3N is offline Reply With Quote
Reply


Tags
bf2 conversion, one man vehicle

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 17:29.