CSM - BF2/BFV Style Auto Hover for helos...

Lots of cool and useful tips to mod either serverside or clientside
Post Reply
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

CSM - BF2/BFV Style Auto Hover for helos...

Post by Apache Thunder »

The following I have posted at SSM forums. But I'm sure it should be alright to post it here too. :D Because this involves creating a fourth engine, this probably isn't server side.

Firstly, it's actually really simple. All you have to do is adjust the minRotation setting on all 3 hover engines (NOT The dummy engines!) to match the mass of the vehicle your doing this on.

You also have to zero the differential setting on the dummy engines as they will cause your helo to drop in altitude if you leave them at default settings.

Here's some code that should show you how to do this.

First up is the adjustments to the dummy engines so they won't counter act the hovering:

Physics.con

Code: Select all

rem *** AH64DummyEngine ***
ObjectTemplate.create Engine AH64DummyEngine
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.setNetworkableInfo AH64_engine_info
ObjectTemplate.loadSoundScript Sounds/AH64Engine.ssc
rem -------------------------------------
ObjectTemplate.addTemplate lodAH64Propeller
ObjectTemplate.setPosition 0/0/0
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/50
ObjectTemplate.setMaxRotation 0/0/1000
ObjectTemplate.setMaxSpeed 0/0/9500
ObjectTemplate.setAcceleration 0/0/15000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 0.001
ObjectTemplate.setDifferential 0
ObjectTemplate.setNoPropellerEffectAtSpeed 50


rem *** AH64DummyRearEngine ***
ObjectTemplate.create Engine AH64DummyRearEngine
ObjectTemplate.setNetworkableInfo AH64_engine_info
rem -------------------------------------
ObjectTemplate.addTemplate lodAH64RearPropeller
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.setRotation -90/0/0
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/50
ObjectTemplate.setMaxRotation 0/0/500
ObjectTemplate.setMaxSpeed 0/0/1
ObjectTemplate.setAcceleration 0/0/100
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 0
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 0.001
ObjectTemplate.setDifferential 0
ObjectTemplate.setNoPropellerEffectAtSpeed 100
Simply set the differentioal to zero and reduce torque to 0.001. Do NOT set both to zero otherwise the engine sounds will not rev up when you apply throttle! Only do this to the differential setting!


Now for the 3 hover engines. Be sure the settings are the same on ALL of them:

Physics.con:

Code: Select all

rem *** AH64HoverEngine1 ***
ObjectTemplate.create Engine AH64HoverEngine1
ObjectTemplate.setNetworkableInfo AH64_engine_info
rem -------------------------------------
rem ObjectTemplate.addTemplate lodAH64Propeller
rem ObjectTemplate.setPosition 0/0/0
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/3170
ObjectTemplate.setMaxRotation 0/0/5000
ObjectTemplate.setMaxSpeed 0/0/12500
ObjectTemplate.setAcceleration 0/0/15000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 19.5
ObjectTemplate.setDifferential 4.6

rem *** AH64HoverEngine2 ***
ObjectTemplate.create Engine AH64HoverEngine2
ObjectTemplate.setNetworkableInfo AH64_engine_info
rem -------------------------------------
rem ObjectTemplate.addTemplate lodAH64Propeller
rem ObjectTemplate.setPosition 0/0/0
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/3170
ObjectTemplate.setMaxRotation 0/0/5000
ObjectTemplate.setMaxSpeed 0/0/12500
ObjectTemplate.setAcceleration 0/0/15000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 19.5
ObjectTemplate.setDifferential 4.6

rem *** AH64HoverEngine3 ***
ObjectTemplate.create Engine AH64HoverEngine3
ObjectTemplate.setNetworkableInfo AH64_engine_info
rem -------------------------------------
rem ObjectTemplate.addTemplate lodAH64Propeller
rem ObjectTemplate.setPosition 0/0/0
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/3170
ObjectTemplate.setMaxRotation 0/0/5000
ObjectTemplate.setMaxSpeed 0/0/12500
ObjectTemplate.setAcceleration 0/0/15000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 19.6
ObjectTemplate.setDifferential 12
Stock DC has the first two numbers on the min/max number set to something other then zero. I'm pretty sure they are not needed and you can just zero them out. But if this causes issues for you (as I have not tested this on "stock" DC helos!), then simply leave the first two numbers alone.

The MinRotation setting is the magic number. Match it to the mass of the aircraft and when no throttle is being applied the engine will apply just enough power for (almost) perfact verticle hovering. The aircraft will still very slowly drift down, but this is natural as it occurs in BFV/BF2 as well. You can also be able to roll/pitch the aircraft even when your are not putting any thrust in. Just like with BFV/BF2.

Now your wondering, how are you going to land if the helo hovers on no thrust? You add a fourth hover engine!. This engine does not provide upward thrust. Instead it provides down thrust to force the aircraft down. It's set so it only works when your using reverse thrust. You can then use reverse thrust to land quickly when the need arises.

Physics.con:

Code: Select all

ObjectTemplate.create Engine AH64DropEngine
ObjectTemplate.setNetworkableInfo AH64_engine_info
ObjectTemplate.setMinRotation 0/0/0
ObjectTemplate.setMaxRotation 0/0/3200
ObjectTemplate.setMaxSpeed 0/0/15000
ObjectTemplate.setAcceleration 0/0/-15000
ObjectTemplate.setInputToRoll c_PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETPlane
ObjectTemplate.setTorque 19.6
ObjectTemplate.setDifferential 12
This time it's the maxRotation setting that matches the vehicle mass! It's the reverse of a normal enigine. You also set acceleration to a negative number. Be sure minRotation is set to zero other wise you risk the engine providing thrust when positive thrust controls are used.

You can match it's torque and differential to the main engines or adjust them if you want to change how quickly you want the chopper to descend on reverse thrust. Since you will only be addTemplating one of these to the aircraft you won't have to worry about someone using this to hover upside down. They won't beable to control the aircraft and will die. Plus it doesn't provide enough thrust to maintain a upside down hover on top of the backwards control scheme from doing so. ;)


You now add the drop engine to the 3rd engine rack. This is normally the center engine. Don't put it on the others or you risk flipping the chopper when trying to land. :P

Objects.con:

Code: Select all

rem *** AH64EngineRack3 ***
ObjectTemplate.create RotationalBundle AH64EngineRack3
rem ObjectTemplate.setNetworkableInfo AH64EngineRack3Info
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.hasResponsePhysics 1
rem -------------------------------------
ObjectTemplate.addTemplate AH64DropEngine
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.setRotation 0/-270/0
ObjectTemplate.addTemplate AH64HoverEngine3
ObjectTemplate.setPosition 0/0/0
ObjectTemplate.setRotation 0/270/0
rem -------------------------------------
ObjectTemplate.setMinRotation 0/-20/-20
ObjectTemplate.setMaxRotation 0/20/20
ObjectTemplate.setMaxSpeed 0/150/-150
ObjectTemplate.setAcceleration 0/150/-150
ObjectTemplate.setInputToRoll c_PIRoll
ObjectTemplate.setInputToPitch c_PIPitch
ObjectTemplate.setAutomaticReset 1
Notice that the rotation setting for the drop engine is a negative number. This insures the engine is "upside" down. The engine doesn't have true downwards thrust. So you must flip it upside down. It still works the same as intended so no worries!

Also be sure the engine has network info. If you get a too many statemasks error when doing network tests, you may need to rem out network info for the dummy engines, dummy engine racks, and/or any visible wing flaps that are cosmetic. (not wing objects! Only rotational bundles that put a wing geometry on that makes it look like a wing).

I didn't have any issues with the fourth engine in network play. but I tested it on a aircraft that has network info remmed out for the dummy engines. So I can't say for sure if you need to go this route or not.

That's pretty much how you do it. Just make copies of the code and adjust them to match the specs of the choppers your doing this on. Also make sure the network info on the drop engine matches the info used on the main engines!

Also, you can reduce the minRotation below that of the mass of the vehicle if you want to add a tad more natural drop to the aircraft. Be ready for a huge change when you try this out! Hovering is now dead easy. So even noobs can do it. :D

Update: As it turns out the minRotation settings need to be increased if your doing this on DC helos. That is the helos have no wing objects and such. So I adjusted the settings above to match that of the Apache that uses DC flight physics. You will need to tweak the setting for other helos as the same setting won't work on all of them. It also turns out that it isn't directly related to vehicle mass. The number just happened to match the mass for the helo I did this on in the BF242 mod. :P
ImageImageImage
I have cameras in your head!
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: CSM - BF2/BFV Style Auto Hover for helos...

Post by freddy »

i was thinking i should update the chopper coral map i did with these settings, that map never really got finished anyway :oops:
LightSpeed///
Posts: 44
Joined: Sun Oct 18, 2009 3:06 pm

Re: CSM - BF2/BFV Style Auto Hover for helos...

Post by LightSpeed/// »

if you don't have the map I can upload it
AKA WhatThe
Post Reply