Coding an Exploding Vehicle

Based on tutorial ***by silversound***

 Just don't honk the horn unless the guy in front of you really has it comming. **BOOM!**

### Editing the Objects.rfa directly

This is the small tweak done to the Lada Civilian Car. It turns the horn into a proper weapon. I simply slapped the;
 ObjectTemplate.ProjectileTemplate SCUD-BRocketS into the CarHorn FireArm.

From: c:\...\...\OBJECTS\vehicles\land\common\weapons.con

```
rem *** CarHorn ***
ObjectTemplate.create FireArms Carhorn
ObjectTemplate.setNetworkableInfo PlaneFireArmInfo
ObjectTemplate.loadSoundScript Sounds/CarHorn.ssc
**ObjectTemplate.projectileTemplate SCUD-BRocket**
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize -1
ObjectTemplate.numOfMag 1
ObjectTemplate.magType 0
ObjectTemplate.fireOnce 1
ObjectTemplate.reloadtime 1
ObjectTemplate.roundOfFire 1
ObjectTemplate.AmmoType   6
ObjectTemplate.velocity 0

rem *** HummerHorn ***
ObjectTemplate.create FireArms Hummerhorn
ObjectTemplate.setNetworkableInfo PlaneFireArmInfo
ObjectTemplate.loadSoundScript Sounds/HummerHorn.ssc
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize -1
ObjectTemplate.numOfMag 1
ObjectTemplate.magType 0
ObjectTemplate.fireOnce 1
ObjectTemplate.reloadtime 1
ObjectTemplate.roundOfFire 1
ObjectTemplate.AmmoType 6
ObjectTemplate.velocity 0

rem *** TruckHorn ***
ObjectTemplate.create FireArms Truckhorn
ObjectTemplate.setNetworkableInfo PlaneFireArmInfo
ObjectTemplate.loadSoundScript Sounds/TruckHorn.ssc
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.magSize -1
ObjectTemplate.numOfMag 1
ObjectTemplate.magType 0
ObjectTemplate.fireOnce 1
ObjectTemplate.reloadtime 1
ObjectTemplate.roundOfFire 1
ObjectTemplate.AmmoType 6
ObjectTemplate.velocity 0

```

I also beefed up the SCUD projectile splash effect from 50 to 150 so as to get one hell of a blast from the Lada. But that makes the real SCUD a MONSTER.

This works as a server-side script.

### Editing a map .rfa only

If you only want the carbomb on a certain map, the following code can be added to the bottom of your ObjectSpawnTemplates.con file in your map .rfa:

```
ObjectTemplate.Active Carhorn
ObjectTemplate.projectileTemplate SCUD-BRocket
ObjectTemplate.projectilePosition 0/0/0

```

FireDelay Option:

```
ObjectTemplate.Active Carhorn
ObjectTemplate.projectileTemplate SCUD-BRocket
ObjectTemplate.projectilePosition 0/0/0
ObjectTemplate.FireDelay 10

```

FireDelay will delay the ignition of the SCUD by the number of seconds

Increasing the Radius of the SCUD Explosion (NOTE: this affects the realk SCUD rocket too!)

```
ObjectTemplate.Active SCUD-BRocket
ObjectTemplate.radius 100

```

Some other projectiles to use besides the SCUDB-Rocket (From BF1942):

```
      Torpedo
      AircraftTorpedo
      FighterBomb
      DiveBomberBomb
      HeavyBomberBomb

```

### Changing the Damage SCUD does

This can be done to any of the above listed projectiles. Just follow the same procedure, but replace SCUD-BRocket with the Projectiles above.

Materials 854 and 852 are unused materials, and we go ahead and create them (server side only) and this will allow us to adjust the damage they do to certain materials (for more information, see the Tweaking the Damage System).

The following code can be added to the end of your ObjectSpawnTemplates.con file in your map rfa. The values are the normal SCUD values

```
ObjectTemplate.Active Carhorn
ObjectTemplate.projectileTemplate SCUD-BRocket
ObjectTemplate.projectilePosition 0/0/0

rem Modify SCUD Projectile to unused materials
ObjectTemplate.Active SCUD-BRocket
ObjectTemplate.material 854
ObjectTemplate.material2 852

MaterialManager.material 852
MaterialManager.materialAttGroup 852
MaterialManager.materialDefGroup 852
MaterialManager.materialDamage 10

MaterialManager.material 854
MaterialManager.materialAttGroup 854
MaterialManager.materialDefGroup 854
MaterialManager.materialDamage 10

rem *
rem * ***** Scud explosion SPLASH DAMAGE*****
rem *

rem * *************************************************
rem *      Infantry target
rem * *************************************************
MaterialManager.attGroup 852
MaterialManager.setCell 40 15
MaterialManager.setCell 41 15
MaterialManager.setCell 42 15

rem * *************************************************
rem *      scout cars target
rem * *************************************************

MaterialManager.attGroup 852
MaterialManager.defGroup 43
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 44
MaterialManager.damageMod 50

rem * *************************************************
rem *      Light Vehicle target
rem * *************************************************

MaterialManager.attGroup 852
MaterialManager.defGroup 45
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 46
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 47
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 48
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 49
MaterialManager.damageMod 50

rem * *************************************************
rem *      Heavy Vehicle target
rem * *************************************************

MaterialManager.attGroup 852
MaterialManager.defGroup 50
MaterialManager.damageMod 40

MaterialManager.attGroup 852
MaterialManager.defGroup 51
MaterialManager.damageMod 40

MaterialManager.attGroup 852
MaterialManager.defGroup 52
MaterialManager.damageMod 30

MaterialManager.attGroup 852
MaterialManager.defGroup 53
MaterialManager.damageMod 30

MaterialManager.attGroup 852
MaterialManager.defGroup 54
MaterialManager.damageMod 15

rem * *************************************************
rem *      Ship target
rem * *************************************************

rem *** BUNKER MATERIAL ****
MaterialManager.attGroup 852
MaterialManager.defGroup 55
MaterialManager.damageMod 30

MaterialManager.attGroup 852
MaterialManager.defGroup 56
MaterialManager.damageMod 10

MaterialManager.attGroup 852
MaterialManager.defGroup 57
MaterialManager.damageMod 5

MaterialManager.attGroup 852
MaterialManager.defGroup 58
MaterialManager.damageMod 5

MaterialManager.attGroup 852
MaterialManager.defGroup 59
MaterialManager.damageMod 5

rem  *************************************************
rem *      Planes target
rem * *************************************************

MaterialManager.attGroup 852
MaterialManager.defGroup 60
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 61
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 62
MaterialManager.damageMod 50

MaterialManager.attGroup 852
MaterialManager.defGroup 63
MaterialManager.damageMod 50

rem * *************************************************
rem *      Default
rem * *************************************************

MaterialManager.attGroup 852
MaterialManager.defGroup 0
MaterialManager.damageMod 0.0

MaterialManager.attGroup 852
MaterialManager.defGroup 1
MaterialManager.damageMod 0.0

rem ***************************************************
rem * ***** Artillary gun explosion - DIRECT DAMAGE *****
rem ***************************************************

rem * *************************************************
rem *      Infantry target
rem * *************************************************
MaterialManager.attGroup 854
MaterialManager.defGroup 40
MaterialManager.damageMod 5
MaterialManager.setEffectTemplate BombSmallNS_Expl

MaterialManager.attGroup 854
MaterialManager.defGroup 41
MaterialManager.damageMod 5
MaterialManager.setEffectTemplate BombSmallNS_Expl

MaterialManager.attGroup 854
MaterialManager.defGroup 42
MaterialManager.damageMod 5
MaterialManager.setEffectTemplate BombSmallNS_Expl

rem * *************************************************
rem *      scout cars target
rem * *************************************************

MaterialManager.attGroup 854
MaterialManager.defGroup 43
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate MajorImpact_Metal

MaterialManager.attGroup 854
MaterialManager.defGroup 44
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate MajorImpact_Metal

rem * *************************************************
rem *      Light Vehicle target
rem * *************************************************

MaterialManager.attGroup 854
MaterialManager.defGroup 45
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 46
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 47
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 48
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 49
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

rem * *************************************************
rem *      Heavy Vehicle target
rem * *************************************************

MaterialManager.attGroup 854
MaterialManager.defGroup 50
MaterialManager.damageMod 40
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 51
MaterialManager.damageMod 30
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 52
MaterialManager.damageMod 30
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 53
MaterialManager.damageMod 30
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 54
MaterialManager.damageMod 9.9
MaterialManager.setEffectTemplate e_ExplArmor

rem * *************************************************
rem *      Ship target
rem * *************************************************

rem *** BUNKER MATERIAL ***
MaterialManager.attGroup 854
MaterialManager.defGroup 55
MaterialManager.damageMod 30
MaterialManager.setEffectTemplate e_ExplBoatArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 56
MaterialManager.damageMod 15
MaterialManager.setEffectTemplate e_ExplBoatArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 57
MaterialManager.damageMod 10
MaterialManager.setEffectTemplate e_ExplBoatArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 58
MaterialManager.damageMod 7
MaterialManager.setEffectTemplate e_ExplBoatArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 59
MaterialManager.damageMod 5
MaterialManager.setEffectTemplate e_ExplBoatArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 65
MaterialManager.damageMod 5
MaterialManager.setEffectTemplate e_ExplBoatArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 66
MaterialManager.damageMod 5
MaterialManager.setEffectTemplate e_ExplBoatArmor

rem  *************************************************
rem *      Planes target
rem * *************************************************

MaterialManager.attGroup 854
MaterialManager.defGroup 60
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 61
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 62
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 63
MaterialManager.damageMod 50
MaterialManager.setEffectTemplate e_ExplArmor

MaterialManager.attGroup 854
MaterialManager.defGroup 64
MaterialManager.damageMod 100
MaterialManager.setEffectTemplate e_ExplArmor

rem * *************************************************
rem *      Default
rem * *************************************************

MaterialManager.attGroup 854
MaterialManager.defGroup 0
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate BombSmallNS_Expl

MaterialManager.attGroup 854
MaterialManager.defGroup 1
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_WaterImpact

rem * *************************************************
rem *      Material Effects
rem * *************************************************
rem * *************************************************
rem *      Other Materials
rem * *************************************************

rem * *** Dry Grass (yellow) ***
MaterialManager.attGroup 854
MaterialManager.defGroup 2
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Juicy Grass (Green) ***
MaterialManager.attGroup 854
MaterialManager.defGroup 3
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Dry Dirt ***
MaterialManager.attGroup 854
MaterialManager.defGroup 4
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wet Dirt ***
MaterialManager.attGroup 854
MaterialManager.defGroup 5
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Mud ***
MaterialManager.attGroup 854
MaterialManager.defGroup 6
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Deep Mud ***
MaterialManager.attGroup 854
MaterialManager.defGroup 7
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Gravel ***
MaterialManager.attGroup 854
MaterialManager.defGroup 8
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Frozen ground ***
MaterialManager.attGroup 854
MaterialManager.defGroup 9
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Dry Sand ***
MaterialManager.attGroup 854
MaterialManager.defGroup 10
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wet Sand ***
MaterialManager.attGroup 854
MaterialManager.defGroup 11
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Rock ***
MaterialManager.attGroup 854
MaterialManager.defGroup 12
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Forest Floor ***
MaterialManager.attGroup 854
MaterialManager.defGroup 13
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Dirt Road ***
MaterialManager.attGroup 854
MaterialManager.defGroup 14
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Paved Road ***
MaterialManager.attGroup 854
MaterialManager.defGroup 15
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Solid Wood ***
MaterialManager.attGroup 854
MaterialManager.defGroup 80
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wood ***
MaterialManager.attGroup 854
MaterialManager.defGroup 81
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Thin Wood ***
MaterialManager.attGroup 854
MaterialManager.defGroup 82
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Hollow Wood ***
MaterialManager.attGroup 854
MaterialManager.defGroup 83
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Solid Metal ***
MaterialManager.attGroup 854
MaterialManager.defGroup 84
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Metal ***
MaterialManager.attGroup 854
MaterialManager.defGroup 85
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Thin Metal ***
MaterialManager.attGroup 854
MaterialManager.defGroup 86
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Hollow Metal ***
MaterialManager.attGroup 854
MaterialManager.defGroup 87
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Solid Stone (Rock) ***
MaterialManager.attGroup 854
MaterialManager.defGroup 88
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Concrete ***
MaterialManager.attGroup 854
MaterialManager.defGroup 90
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Concrete ***
MaterialManager.attGroup 854
MaterialManager.defGroup 92
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Reinforced Concrete ***
MaterialManager.attGroup 854
MaterialManager.defGroup 93
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Flesh ***
MaterialManager.attGroup 854
MaterialManager.defGroup 94
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Exterior Stone Wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 100
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Interior Stone Wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 101
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Exterior brick Wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 102
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Interior brick Wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 103
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Exterior wooden Wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 104
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Interior wooden Wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 105
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wooden Fence ***
MaterialManager.attGroup 854
MaterialManager.defGroup 106
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Sandbags ***
MaterialManager.attGroup 854
MaterialManager.defGroup 107
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Grate ***
MaterialManager.attGroup 854
MaterialManager.defGroup 108
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wooden Fence ***
MaterialManager.attGroup 854
MaterialManager.defGroup 109
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wire Fence ***
MaterialManager.attGroup 854
MaterialManager.defGroup 110
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Grated Fence ***
MaterialManager.attGroup 854
MaterialManager.defGroup 111
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Mesh Fence ***
MaterialManager.attGroup 854
MaterialManager.defGroup 112
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Bamboo Exterior wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 113
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Bamboo Interior wall ***
MaterialManager.attGroup 854
MaterialManager.defGroup 114
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Bamboo Fence ***
MaterialManager.attGroup 854
MaterialManager.defGroup 115
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Bamboo Fence ***
MaterialManager.attGroup 854
MaterialManager.defGroup 116
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wooden Floor ***
MaterialManager.attGroup 854
MaterialManager.defGroup 117
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Stone Floor ***
MaterialManager.attGroup 854
MaterialManager.defGroup 118
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Glass Pane ***
MaterialManager.attGroup 854
MaterialManager.defGroup 119
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Tree Trunk ***
MaterialManager.attGroup 854
MaterialManager.defGroup 165
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Tree Trunk ***
MaterialManager.attGroup 854
MaterialManager.defGroup 166
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *************************************************
rem *      Special items
rem * *************************************************

rem * *** Wooden door ***
MaterialManager.attGroup 854
MaterialManager.defGroup 190
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Metal Door ***
MaterialManager.attGroup 854
MaterialManager.defGroup 191
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Wooden Ladder ***
MaterialManager.attGroup 854
MaterialManager.defGroup 192
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Metal Ladder ***
MaterialManager.attGroup 854
MaterialManager.defGroup 193
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Switch/control panel ***
MaterialManager.attGroup 854
MaterialManager.defGroup 194
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

rem * *** Climbing net ***
MaterialManager.attGroup 854
MaterialManager.defGroup 195
MaterialManager.damageMod 0.0
MaterialManager.setEffectTemplate e_Explani03

```