[Code] HandBrake
Posted: 2009-05-03 16:46
I found this a long time ago and have been using it on PR SP for months and it is rather useful and fun. I don't know who the original creator is but you can see their names in the "modified by user" lines in the code since i didn't changed anything and don't want to take credit for something i didn't do. However i don't remember exactly where i got this from since it was a long time ago.
This would definitely be a great feature for PR.
It is very easy to use specially in vehicles that don't have any feature assigned to the right mouse button. Of course you can choose which button will activate the hand brake in case you want to use it in vehicles that already have something on the right mouse button (dropping ammo for example).
I don't advise messing around with BF2 or PR, so only do this in the PR Single Player Mod!
Let's take the American Buggy (FAAV) for example. Create the following files in notepad:
Handbrake.con
objects_server.zip/Vehicles/Common/Handbrake
Then go into the vehicle you want to change, for example the FAAV:
objects_server.zip/Vehicles/Land/jeep_faav folder
open the jeep_faav tweak file in the notepad
search for "car_horn"
as paste the following line in bold under the above two lines of the car_horn code:
Drive the FAAV through the streets of Ramiel and test the handbrake first by going straight and braking and then by making a curve and braking. When going straight the handbrake will stop the vehicle immediately and slowly move backwards while when making a turn, the handbrake will make the vehicle drift to the side.
If you want to use another key instead of the right mouse button, change this line in the handbrake.tweak file:
This is both fun and useful and im sure you will enjoy it.
Have Fun !
EDIT 1: forgot about some lines of code needed, just added them.
EDIT 2: Some FAAV Examples
Video 1: Forward Braking Example - http://www.xfire.com/video/b17e8/
Video 2: Hand Brake Driving - http://www.xfire.com/video/b17f6/
EDIT 3: Some HMMWV & Stryker Examples
Forward HMMWV Hand Brake Example: http://www.xfire.com/video/b1915/
First i try to brake with the S key and Second i use the Hand Brake. As you can see the S key doesn't stop the vehicle in time because it doesn't work until the vehicle is almost stopped while the HB stops the vehicle right away.
Driving the HMMWV with the HandBrake: http://www.xfire.com/video/b193c/
Forward Stryker Hand Brake Example: http://www.xfire.com/video/b19ab/
Hope you can see from the vids a bit how the vehicle reacts with the hand brake.
This would definitely be a great feature for PR.
It is very easy to use specially in vehicles that don't have any feature assigned to the right mouse button. Of course you can choose which button will activate the hand brake in case you want to use it in vehicles that already have something on the right mouse button (dropping ammo for example).
I don't advise messing around with BF2 or PR, so only do this in the PR Single Player Mod!
Let's take the American Buggy (FAAV) for example. Create the following files in notepad:
Handbrake.con
Handbrake.tweakObjectTemplate.create GenericFireArm Handbrake
ObjectTemplate.createdInEditor 1
include Handbrake.tweak
Create a Handbrake folder and put this 2 files inside it then search for the objects_server.zip inside the PR_SP_08/Objects folder. Open that zip and paste the Handbrake folder inside the Vehicles/Common folder so that it looks as below:rem ***** Handbrake *****
rem ---------------------
ObjectTemplate.create GenericFireArm handbrake
ObjectTemplate.modifiedByUser cheese
ObjectTemplate.setNetworkableInfo BasicInfo
ObjectTemplate.saveInSeparateFile 1
ObjectTemplate.createdInEditor 1
rem ---BeginComp:WeaponHud ---
ObjectTemplate.createComponent WeaponHud
ObjectTemplate.weaponHud.guiIndex -1
ObjectTemplate.weaponHud.hasMag 0
ObjectTemplate.weaponHud.hasFireRate 0
ObjectTemplate.weaponHud.showAmmo 0
ObjectTemplate.weaponHud.showClips 0
ObjectTemplate.weaponHud.showInfo 0
rem ---EndComp ---
rem ---BeginComp:SingleFireComp ---
ObjectTemplate.createComponent SingleFireComp
ObjectTemplate.fire.fireInput PIAltFire
ObjectTemplate.fire.roundsPerMinute 900
rem ---EndComp ---
rem ---BeginCompefaultAmmoComp ---
ObjectTemplate.createComponent DefaultAmmoComp
ObjectTemplate.ammo.nrOfMags -1
ObjectTemplate.ammo.magSize -1
ObjectTemplate.ammo.reloadWithoutPlayer 1
rem ***** This is required to work *****
rem ------------------------------------
rem ---BeginComp:WeaponBasedRecoilComp ---
ObjectTemplate.createComponent WeaponBasedRecoilComp
ObjectTemplate.recoil.recoilForce 50
rem ---EndComp ---
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
rem -------------------------------------
ObjectTemplate.projectileTemplate Handbrake_Projectile
ObjectTemplate.keepProjectiles 5
ObjectTemplate.velocity 1
ObjectTemplate.create GenericProjectile Handbrake_Projectile
ObjectTemplate.modifiedByUser cheese
ObjectTemplate.createNotInGrid 1
ObjectTemplate.createdInEditor 1
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Point
ObjectTemplate.collisionGroups 8
rem -------------------------------------
ObjectTemplate.timeToLive CRD_NONE/0.01/0/0
ObjectTemplate.material -1
ObjectTemplate.hasOnTimeEffect 1
ObjectTemplate.minDamage 0.2
ObjectTemplate.damage 0
objects_server.zip/Vehicles/Common/Handbrake
Then go into the vehicle you want to change, for example the FAAV:
objects_server.zip/Vehicles/Land/jeep_faav folder
open the jeep_faav tweak file in the notepad
search for "car_horn"
as paste the following line in bold under the above two lines of the car_horn code:
Add these lines to the end of the jeep_faav.tweak file:ObjectTemplate.addTemplate Car_horn12
ObjectTemplate.setPosition 0/0.0937172/1.72664
ObjectTemplate.addTemplate jeep_faav_HandBrakeRotation
ObjectTemplate.setPosition 0/-0.25/-1.28
Save it and load up a map that has the FAAV or replace one of the vehicles with the FAAV in the GamePlayObjects.con of the mapObjectTemplate.create RotationalBundle jeep_faav_HandbrakeRotation
ObjectTemplate.modifiedByUser "Bill"
ObjectTemplate.setNetworkableInfo BasicInfo
ObjectTemplate.createdInEditor 1
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
rem -------------------------------------
ObjectTemplate.addTemplate Handbrake
rem -------------------------------------
ObjectTemplate.setMinRotation -45/0/0
ObjectTemplate.setMaxRotation 45/0/0
ObjectTemplate.setMaxSpeed 1/0/0
ObjectTemplate.setAcceleration 150/0/0
ObjectTemplate.setInputToYaw PIYaw
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.snapToZeroOnNoInput 1
Drive the FAAV through the streets of Ramiel and test the handbrake first by going straight and braking and then by making a curve and braking. When going straight the handbrake will stop the vehicle immediately and slowly move backwards while when making a turn, the handbrake will make the vehicle drift to the side.
If you want to use another key instead of the right mouse button, change this line in the handbrake.tweak file:
PIAltFire is the right mouse button so just replace that will the correct name of the other button you want to use.ObjectTemplate.fire.fireInput PIAltFire
This is both fun and useful and im sure you will enjoy it.
Have Fun !
EDIT 1: forgot about some lines of code needed, just added them.
EDIT 2: Some FAAV Examples
Video 1: Forward Braking Example - http://www.xfire.com/video/b17e8/
Video 2: Hand Brake Driving - http://www.xfire.com/video/b17f6/
EDIT 3: Some HMMWV & Stryker Examples
Forward HMMWV Hand Brake Example: http://www.xfire.com/video/b1915/
First i try to brake with the S key and Second i use the Hand Brake. As you can see the S key doesn't stop the vehicle in time because it doesn't work until the vehicle is almost stopped while the HB stops the vehicle right away.
Driving the HMMWV with the HandBrake: http://www.xfire.com/video/b193c/
Forward Stryker Hand Brake Example: http://www.xfire.com/video/b19ab/
Hope you can see from the vids a bit how the vehicle reacts with the hand brake.