Using Custom Vehicles

## Using customveh

The FA option customveh allows for using vehicles other than a droideka for `MB_CLASS_DROIDEKA`.

## Example FA file

```
//Siege class def file.

ClassInfo
{
    name          "example\_ATAT"    //this should match the name of the .mbch

    weapons       WP\_MELEE          //WP\_MELEE is taken away from droideka class anyway,

                                    // so it's not truly necessary

    attributes    //no attributes are necessary...

    model         "workermb"        //you should use this with MB\_CLASS\_DROIDEKA

    skin          "default"         //you should use this with MB\_CLASS\_DROIDEKA

    uishader            "models/players/FA\_icons/example\_ATAT"
    MBClass             MB\_CLASS\_DROIDEKA    //note that modelscale doesn't play nicely with droidekas

    classNumberLimit    1                    //only 1 ATAT I think...

    customveh           mb2fa\_mini\_atat      //this is the name of the .veh that's being used. NB that you

                                             // should have mb2fa\_ at the start of the vehicle name if you

                                             // want the vehicle to be unboardable by other players

    extralives    6    //look, lots of extra lives

description    "All Terrain Armored Transport

Abilities:
Guns (big)
Armour (heavy)

The All Terrain Armored Transport (AT-AT) walker was a major part of the Galactic Empire's army.

It was one of the most heavily armored land vehicles in the Imperial Army,
but was also known for its relatively slow speed.

This is a mini version of an AT-AT that might be able to be used in a map."

```

## Setting up the .veh file

For now, this isn't going to go into all the options you have in a .veh file. There's a useful description of them here.

You will generally be able to just use the basic .veh file from the vehicle you're using. However, you might want to scale the vehicle or something along those lines.

### MovieBattles specific .veh options

#### Vehicle States

```
VEHICLE_MODE_RUNNING   = 1
VEHICLE_MODE_WALKING   = 2
VEHICLE_MODE_BACKWARDS = 4
VEHICLE_MODE_STILL     = 8
VEHICLE_MODE_TURNING   = 16
VEHICLE_MODE_CROUCHING = 32

```

#### MBFstopprimaryfiring

Primary firing is not possible whilst in these states. The value you should put is the sum of the numbers of the modes that you shouldn't be able to fire in, e.g., if you don't want to be able to fire when running or turning, use a value of 17 (1+16).

#### MBFstopaltfiring

Secondary firing is not possible whilst in these states. The value you should put is the sum of the numbers of the modes that you shouldn't be able to fire in, e.g., if you don't want to be able to fire when running or turning, use a value of 17 (1+16).

#### MBFdisableshields

Shields are turned off whilst in these states. The value you should put is the sum of the numbers of the modes that you shouldn't be able to fire in, e.g., if you don't want to have shields when running or turning, use a value of 17 (1+16).

#### AllWeaponsDoDamageToArmor

Value is either 0/1. If 1, all weapons do damage to armour - if 0, just heavy weapons.

#### AllWeaponsDoDamageToShields

Value is either 0/1. If 1, all weapons do damage to shields - if 0, just heavy weapons.

#### NoDamageWalls

Value is either 0/1. If 1, the vehicle doesn't lose hp when it hits a wall or other types of entities.

#### ResistsMarking

Value is either 0/1. If 1, doesn't get marked by shots etc.

#### RamDamage

Amount of damage done when ramming into players.

#### SpeedMultiplierForRamDamage

If there isn't a RamDamage, the speed of the vehicle is multiplied by this to decide how much damage is done.

#### CantKnockoutShields

Value is either 0/1. If 1, shields will always regenerate.

### Scaling your vehicle

In the .veh file, you'll notice lines similar to these.

```
    length    60
    width     60
    height    60

```

If you want to scale the vehicle, multiply these values by the scale factor (e.g. for 2x size, use length, width and height twice the original values.

For actually scaling the model,

```
    VehicleScale    70

```

means that the vehicle is scaled to 70% of its normal size.

If you want your double-size vehicle, this should be set to 200 (200% of normal size).

You should also scale the height/width values you find in the vehicle's corresponding .npc file.

Here is a more extensive guide Frenzy created.

*Note, not every single line has been tested. Use with caution:*

```
// FILL OUT EVERY # OR LEAVE BLANK

NAMEOFVEHICLE    // This is the vehicle name, spawned with /npc spawn vehicle NAMEOFVEHICLE
{
    name               namehere         //unique name of the vehicle (this is what is read in the .mbch file!)
    type               VH_SPEEDER       //what kind of vehicle, VH_SPEEDER VH_WALKER VH_ANIMAL VH_FIGHTER VH_DEKA
    numhands           #                //if 2 hands, no weapons, if 1 hand, can use 1-handed weapons, if 0 hands, can use 2-handed weapons
    lookPitch          #.#              //How far you can look up and down off the forward of the vehicle
    LookYaw            #.#              //How far you can look left and right off the forward of the vehicle

    length             #                //how long it is - used for body length traces when turning/moving?
    width              #                //how wide it is - used for body length traces when turning/moving?
    height             #                //how wide it is - used for body length traces when turning/moving?
    centerOfGravity    "#.# #.# #.#"    //offset from origin: {forward, right, up} as a modifier on that dimension (-1.0f is all the way back, 1.0f is all the way forward)

    // Speed
    SpeedMax          #.#    //Top speed
    TurboSpeed        #.#    //Turbo speed
    SpeedMin          #.#    //If < 0, can go in reverse
    SpeedIdle         #.#    //What speed it drifts to when no accel/decel input is given
    accelIdle         #.#    //If speedIdle > 0, how quickly it goes up to that speed
    acceleration      #.#    //When pressing on accelerator
    decelIdle         #.#    //When giving no input, how quickly it drops to speedIdle
    throttleSticks    0/1    //If true, speed stays at whatever you accel/decel to, unless you turbo or brake
    strafePerc        #.#    //Multiplier on current speed for strafing.  If 1.0f, you can strafe at the same speed as you're going forward, 0.5 is half, 0 is no strafing

    // Handling
    bankingSpeed             #.#    //How quickly it pitches and rolls (not under player control)
    pitchLimit               #.#    //How far it can roll forward or backward
    rollLimit                #.#    //How far it can roll to either side
    braking                  #.#    //when pressing on decelerator
    mouseYaw                 #.#    //The mouse yaw override.
    mousePitch               #.#    //The mouse yaw override.
    turningSpeed             #.#    //How quickly you can turn
    turnWhenStopped          0/1    //Whether or not you can turn when not moving
    traction                 #.#    //How much your command input affects velocity, only VH_Speeder makes use of this
    friction                 #.#    //How much velocity is cut on its own
    maxSlope                 #.#    //The max slope that it can go up with control
    speedDependantTurning    0/1    //Vehicle turns faster the faster it's going
    landingHeight            #.#    // The max height before this ship (?) starts (auto)landing.

    // Durability
    mass                     #      //For momentum and impact force (player mass is 10)
    armor                    #      //Total points of damage it can take
    shields                  #      //Energy shield damage points
    shieldRechargeMS         #      //Energy shield milliseconds per point recharged
    toughness                #.#    //Modifies incoming damage, 1.0 is normal, 0.5 is half, etc.  Simulates being made of tougher materials/construction
    malfunctionArmorLevel    #      //When armor drops to or below this point, start malfunctioning
    surfDestruction          0/1    //Can this vehicle be broken apart

    // Misc
    gravity             #       //Controls rate of desent when not moving, default gravity is 800
    hoverHeight         #.#     //If 0, it's a ground vehicle
    hoverStrength       #.#     //How hard it pushes off ground when less than hover height... causes "bounce", like shocks
    waterProof          0/1     //Can drive underwater if it has to
    bouyancy            #.#     //when in water, how high it floats (1 is neutral bouyancy)
    fuelMax             #       //How much fuel it can hold (capacity)
    fuelRate            #       //How quickly is uses up fuel
    turboDuration       #       //How long turbo lasts
    turboRecharge       #       //How long turbo takes to recharge
    visibility          #       //For sight alerts
    loudness            #       //For sound alerts
    explosionRadius     #.#     //Range of explosion
    explosionDamage     #       //Damage of explosion

    maxPassengers       0-10    //The max number of passengers this vehicle may have (Default = 0), (Max = 10)
    hideRider           0/1     //Rider (and passengers?) should not be drawn
    killRiderOnDeath    0/1     //If rider is on vehicle when it dies, they should die
    flammable           0/1     //Whether or not the vehicle should catch on fire before it explodes
    explosionDelay      #       //How long the vehicle should be on fire/dying before it explodes in msec

    // MB2 additions, first 3 used mostly only for Deka
    // Vehicle states: CROUCHING = 32, TURNING = 16, STILL = 8,  BACKWARDS = 4, WALKING = 2, RUNNING = 1,
    // Bit flag varibles: 5  = 000101 which tranlates to BACKWARDS and RUNNING
    // Bit flag varibles: 49 = 110001 which translates to CROUCHING TURNING and RUNNING
    // (disabling for running and walking would be 3 (000011) as an example

    MBFstopprimaryfiring           0      //Stop primary firing in the above-listed
    MBFstopaltfiring               0      //Stop alt firing in these modes
    MBFdisableshields              0      //Disable shields in these modes

    CantKnockoutShields            0/1    // Used for Deka shield toggle (Deka?)
    AllWeaponsDoDamageToArmor      0/1    // If damage do direct damage to Health (Deka?)
    AllWeaponsDoDamageToShields    0/1    // If damage do direct damage to Shields (Deka?)
    ResistsMarking                 0/1    // Whether to paint damage marks on vehicle
    SpeedMultiplierForRamDamage    #.#    // Damage multiplyer for Ramming, (Default is 10.0)
    RamDamage                      #      // Base Line ramming damage, may override SpeedMultiplierForRamDamage if non 0
    VehicleScale                   #      // Override size of vehicle, default = 100
    NoDamageWalls                  0/1    // Whether this vehicle suffers damage on wall impacts (?)

    // Visuals
    model        modelname       //What model to use - if make it an NPC's primary model, don't need this?
    skin         skin_name       //What skin to use - if make it an NPC's primary model, don't need this?
    g2radius     #               //Render radius (really diameter, but...) for the ghoul2 model
    riderAnim    BOTH_VS_IDLE    //What animation the rider uses
    droidNPC     npc_name        //NPC to attach to *droidunit tag (if it exists in the model), used only for VH_FIGHTER (R2D2)

    // Hud and Radar
    radarIcon             "directory/nameoffile"    //What icon to show on radar in MP
    dmgIndicFrame         "directory/nameoffile"    //What image to use for the frame of the damage indicator
    dmgIndicShield        "directory/nameoffile"    //What image to use for the shield of the damage indicator
    dmgIndicBackground    "directory/nameoffile"    //What image to use for the background of the damage indicator
    icon_front            "directory/nameoffile"    //What image to use for the front of the ship on the damage indicator
    icon_back             "directory/nameoffile"    //What image to use for the back of the ship on the damage indicator
    icon_right            "directory/nameoffile"    //What image to use for the right of the ship on the damage indicator
    icon_left             "directory/nameoffile"    //What image to use for the left of the ship on the damage indicator
    crosshairShader       "directory/nameoffile"    //What image to use as the crosshair
    shieldShader          "directory/nameoffile"    //What shader to use when drawing the shield shell

    // Sounds
    soundOn             "sound/directory/nameofsound.mp3"    //Sound to play when get on it
    soundOff            "sound/directory/nameofsound.mp3"    //Sound to play when get off
    soundLoop           "sound/directory/nameofsound.mp3"    //Sound to loop while riding it
    soundTakeOff        "sound/directory/nameofsound.mp3"    //Sound to play when ship takes off
    soundEngineStart    "sound//nameofsound.mp3"             //Sound to play when ship's thrusters first activate
    soundSpin           "sound/directory/nameofsound.mp3"    //Sound to loop while spiraling out of control
    soundTurbo          "sound/directory/nameofsound.mp3"    //Sound to play when turbo/afterburner kicks in
    soundHyper          "sound/directory/nameofsound.mp3"    //Sound to play when hits hyperspace
    soundLand           "sound/directory/nameofsound.mp3"    //Sound to play when ship lands
    soundFlyBy          "sound/directory/nameofsound.mp3"    //Sound to play when they buzz you
    soundFlyBy2         "sound/directory/nameofsound.mp3"    //Alternate sound to play when they buzz you
    soundShift1         "sound/directory/nameofsound.mp3"    //Sound to play when changing speeds
    soundShift2         "sound/directory/nameofsound.mp3"    //Sound to play when changing speeds
    soundShift3         "sound/directory/nameofsound.mp3"    //Sound to play when changing speeds
    soundShift4         "sound/directory/nameofsound.mp3"    //Sound to play when changing speeds

    // Effects
    exhaustFX       "directory/nameofeffect"    //Exhaust effect, played from "*exhaust" bolt(s)
    turboFX         "directory/nameofeffect"    //Turbo exhaust effect, played from "*exhaust" bolt(s) when ship is in "turbo" mode
    turboStartFX    "directory/nameofeffect"    //Turbo start effect, played from "*exhaust" bolt(s) when ship is in "turbo" mode
    trailFX         "directory/nameofeffect"    //Trail effect, played from "*trail" bolt(s)
    impactFX        "directory/nameofeffect"    //Impact effect, for when it bumps into something
    explodeFX       "directory/nameofeffect"    //Explosion effect, for when it blows up (should have the sound built into explosion effect)
    wakeFX          "directory/nameofeffect"    //Effect it makes when going across water
    dmgFX           "directory/nameofeffect"    //Effect to play on damage from a weapon or something

    injureFX        "directory/nameofeffect"    //Effect to play on partially damaged ship surface
    noseFX          "directory/nameofeffect"    //Effect for nose piece flying away when blown off
    lwingFX         "directory/nameofeffect"    //Effect for left wing piece flying away when blown off
    rwingFX         "directory/nameofeffect"    //Effect for right wing piece flying away when blown off
    armorLowFX      "directory/nameofeffect"    //Effect to play on damage from a weapon or something
    armorGoneFX     "directory/nameofeffect"    //Effect to play on damage from a weapon or something

    noFireball    0/1    //Whether to play death effects
    HanHack       0/1    //Special indicator to make boarding the vehicle impossible
    GroundTrace   0/1    //Enabled by Droidekas, allows swoops and fighters to keep their natural base physics.

    PlayerAsVehicleEject    0/1    //Allows ejecting from custom FA vehicles which players auto board at spawn (unless VH_DEKA).

    //Individual "area" health
    health_front    #    //Amount of health for VH_FIGHTER parts
    health_back     #    //Amount of health for VH_FIGHTER parts
    health_right    #    //Amount of health for VH_FIGHTER parts
    health_left     #    //Amount of health for VH_FIGHTER parts

    // Primary Attack
    weap1                  veh_wpn_name    //Name of weapon (must be inside ext_data/vehicles/weapons or it won't be read)
    weap1Aim               0/1             //Whether or not to auto-aim the projectiles at the thing under the crosshair when we fire
    weap1Delay             #               //The delay between shots for this weapon, in msec
    weap1Link              0/1/2           //0 for unlinkable, 1 for linkable, 2 for always linked (linked delay = weapon delay * number of muzzles linked!)
    weap1AmmoMax           #               //Max amount of ammo
    weap1AmmoRechargeMS    #               //Ammo recharge rate - milliseconds per unit (minimum of 100, which is 10 ammo per second)
    weap1SoundNoAmmo    "sound/directory/nameofsound.mp3"    //Sound to play when try to fire weapon 1 with no ammo

    // Secondary Attack
    weap2                  veh_wpn_name    //Name of weapon 2 (must be inside ext_data/vehicles/weapons or it won't be read)
    weap2Aim               0/1             //Whether or not to auto-aim the projectiles at the thing under the crosshair when we fire
    weap2Delay             #               //The delay between shots for this weapon, in msec
    weap2Link              0/1/2           //0 for unlinkable, 1 for linkable, 2 for always linked (linked delay = weapon delay * number of muzzles linked!)
    weap2AmmoMax           #               //Max amount of ammo
    weap2AmmoRechargeMS    #               //Ammo recharge rate - milliseconds per unit (minimum of 100, which is 10 ammo per second)
    weap2SoundNoAmmo    "sound/directory/nameofsound.mp3"    //Sound to play when try to fire weapon 2 with no ammo

    // Where the vehicle fires from, must have tags in model. Up to 10 (has to match one of the weapons this vehicle has).
    weapMuzzle1     veh_wpn_name
    weapMuzzle2     veh_wpn_name
    weapMuzzle3     veh_wpn_name
    weapMuzzle4     veh_wpn_name
    weapMuzzle5     veh_wpn_name
    weapMuzzle6     veh_wpn_name
    weapMuzzle7     veh_wpn_name
    weapMuzzle8     veh_wpn_name
    weapMuzzle9     veh_wpn_name
    weapMuzzle10    veh_wpn_name

    // Camera
    cameraOverride                    0/1    //Override the third person camera with the below values - normal is 0 (off)
    cameraRange                       #.#    //How far back the camera should be - normal is 80
    cameraVertOffset                  #.#    //How high over the vehicle origin the camera should be - normal is 16
    cameraHorzOffset                  #.#    //How far to left/right (negative/positive) of of the vehicle origin the camera should be - normal is 0
    cameraPitchOffset                 #.#    //A modifier on the camera's pitch (up/down angle) to the vehicle - normal is 0
    cameraFOV                         #.#    //Third person camera FOV, default is 80
    cameraAlph                        #.#    //Fade out the vehicle to this alpha (0.1-1.0f) if it's in the way of the crosshair
    cameraPitchDependantVertOffset    0/1    //Use the hacky AT-ST pitch dependant vertical offset

    firstPersonCameraMode             #      //Enable first person camera, 1 = eyeview, 2 = offset
    firstPersonCameraRange            #.#    //How far back the camera should be
    firstPersonCameraVertOffset       #.#    //How high over the vehicle origin the camera should be
    firstPersonCameraHorzOffset       #.#    //How far to left/right (negative/positive) of of the vehicle origin the camera should be - normal is 0
    firstPersonCameraPitchOffset      #.#    //A modifier on the camera's pitch (up/down angle) to the vehicle
    firstPersonCameraFOV              #.#    //First person camera FOV, default is 80
    firstPersonHideBone1              #      //Hide these bones if in first person.
    firstPersonHideBone2              #
    firstPersonHideBone3              #
    firstPersonHideBone4              #
}    //required to end .veh

```