Making the 120mm HEAT round toggle activated

From WiCWiki

Jump to: navigation, search



This tutorial is here to specifically show you the technical process I went through to make the 120mm HEAT rounds on the M1A1 toggle activated, but this tutorial is also here to discuss the thought process I went through in order to realize that idea.

With that, I'm going to assume that you already have installed WiC and the Modkit successfully on your computer. If you haven't, check out Phazon's beginner's tutorial here. In addition to linking you to the necessary files, it will acquaint you with the basics of WiC modding and juice files.

The Thought Process

When playing WiC, the fact that HEAT rounds were a 'special ability' always bothered me, because in reality, tank crews would switch between different types of ammunition, depending on the situation. Understandably, the gamedevs were trying to create a semi-realistic, yet balanced game, thus they did what was best in terms of gameplay.

1) It's important to understand why/how they wrote the code the way they did.

2) It's important to understand how we want to rewrite the code.

3) It's important to look for and use any precedents that may exist.

Now, let's go ahead and fire up a few instances of Juicemaker.

BUT WAIT! Before you do anything, backup any files that you will be editing. I cannot stress this enough!

Specifically, you want to backup

(modkit directory)/units/unittypes_wic.juice

(modkit directory)/juice/wic_states.juice

Now, open up both files in two different instances of Juicemaker. You can also open up the backups if you want to use those as references, but just make sure not to save any changes to those, as they are... well, your backups.

The Developer's Method


In the unittypes_wic.juice, if you scroll down to the US_Tank_Abrahms entry, this is what you should see. For the purpose of this tutorial, you should ignore everything inside this entry, except for MultipleShooter(0) and SpecialAbility(0), which are expanded under myParasites.


Here's a quick overview of shooters. Shooters are weapons. There are three types of shooters.

  • myPrimaryShooter: Your 120mm main cannon
  • mySecondaryShooter: Your 50 cal machinegun
  • mySpecialAbilityShooter: In this case, the HEAT round, but more appropriately would be ToW Missiles.

Here's a quick overview of SpecialAbilities. You can have two SpecialAbilities (to my knowledge. You may be able to have more if modded correctly). These are defined by their type (Offensive/Defensive).

  • M1A1_HEAT: This is your offensive ability. Notice the attributes in the list under it

- myRechargeTime = 30

- myShooterName = M1A1_HEAT_Round (This is the shooter under mySpecialAbilityShooter. Notice the connection.)

- myType = OFFENSIVE

  • Smoke: Ignore this... we're not interested

So, to sum this up. M1A1_HEAT is an offensive SpecialAbility that fires an M1A1_HEAT_Round (mySpecialAbilityShooter) and has a 30 second recharge time. So why does this SpecialAbility require what can technically be seen as an entirely new weapon, in order to fire a single shot? Let's take a look at myPrimaryShooter and mySpecialAbilityShooter, side by side.


So while the mySpecialAbilityShooter is technically an entirely different weapon, it uses mostly the same parts as the myPrimaryShooter, thus mimicing an ammo change within the same turret. Take the time to notice the important differences between the two shooters though. They should explain the functionality differences.


Also important are the myAmmoTypes directly under the head of the shooter. Digest the differences, we'll come back to these in a minute.

Our Method

Now that we understand the gamedevs' method, we need to figure out exactly what we want to achieve. Breaking down the task into specific components can help to simplify the process. Here is a layout of some attribute differences:

Vanilla WiC

  • SpecialAbility shooter
  • SingleShot
  • recharge: 30 sec


  • SpecialAbility state change
  • duration: Infinite
  • recharge time: 0 sec

The Logic

  • In terms of WiC's engine, a shooter is an entirely new weapon. What we want is more literally defined as a StateChange. More specifically, a change in ammo type.
  • In vanilla WiC, the duration is 0 seconds because the tank loads a single HEAT round, fires, then returns to SABOT rounds. We want to change this to where HEAT rounds are fired continuously, until we tell the tank to stop, thus an infinite duration.
  • 0 seconds, because why would it take them 30 seconds to figure out which is a HEAT round and which is a SABOT round...

Looking for a Precedent

The most important lesson of this tutorial is that you should always look for a precedent. So what exactly is this precedent? In our terms, a precedent is a segment of working code that contains some attribute of the effect we want to achieve. This precedent will shed light on how to go about and properly rewrite code.

So what is the mighty precedent for our M1A1 ammo change? The Humvee.

If you will recall the SpecialAbility for the humvee, it's an offensive ability that switches the 50 cal to armor piercing rounds. It does have a time limit, but this isn't a problem. It's a perfect match for our HEAT rounds.


Here's the entry in unittypes for the Humvee. Again, we're interested only in the MultipleShooter and SpecialAbility under myParasites.


Here is a comparison of the special abilities for both the M1A1 and the Humvee. Please notice the highlighted boxes. I would like to take this time to point out that these two SpecialAbility entries are very different. Your biggest clue to this is in the upper boxes, inside the brackets. Now, right click on mySpecialAbilities. The following should come up. Click on add, and then the following. These are different templates for the script class, mySpecialAbilities.

2.3.JPG 2.4.JPG

Play around with the different options to familiarize yourself with them. You can always just click on the entry and delete it later.


I would also like to take this time to introduce the wic_states.juice file. This image consists of the entirity of WiC States. Most important of course, is the SPECIAL_ArmorPiercingBullets. This is the myName value for the SPECIAL_ArmorPiercingBullets [State]. It is also the value for the myStateName under the AP_Bullets SpecialAbility for the Humvee. Note this connection.

Explaining how the AP rounds work

This will involve a little jumping around, but bare with me.


AP_Bullets is a SpecialAbility for the Humvee that triggers a state change. This state change is referenced by the myStateName variable, whose value is SPECIAL_ArmorPiercingRounds. This value is defined under the wic_states.juice file.

The only other value of note is that the recharge time is 30 seconds.


Take note that the duration is 12 seconds, but more important are the myShooterName and myAmmoType, found under myModifiers/StateModifier_AmmoType(0). These two variables reference back to the humvee entry in the unittypes_wic.juice file.


The value for myShooterName (wic states) is the same as the entry under myPrimaryShooter (unit types).

The value for myAmmoType (wic states) is the same as the second entry under myAmmoTypes (unit types).

Brief Summary At this point, you should understand the difference between the two special abilities of the M1A1 HEAT round and the Humvee 50cal AP rounds.

  • The HEAT round is a SpecialAbility that changes a myShooterType to result in the firing of a singleshot HEAT round.
  • The 50 cal AP rounds are a SpecialAbility that effects a stateChange. This stateChange is a switch in ammo type that lasts for 12 seconds.

Doing It

From here, images and brief explanations should be more than enough to show you how to make the HEAT round special ability into a toggleable state change.

Creating the wic_states.juice entry


Under the 'Instance' menu, click on 'New'

Select 'State'

Under name, SPECIAL_HEAT_Rounds


Change the values as indicated. When adding the StateModifier_AmmoType under myModifiers, don't worry about entering a name.

You can now save and close out of the wic_states.juice file. Our work here is done.

Editing the US_Tank_Abrahms entry under unittypes_wic. juice

Creating the New Special Ability


Right Click on mySpecialAbilities

Add new ModeAbility

Name - M1A1_HEAT_Rounds


Delete the old M1A1_HEAT [ShooterAbility]

Copy the values as such to the new M1A1_HEAT_Rounds [ModeAbility]

Creating the New AmmoType


Under mySpecialAbilityShooter, delete the old M1A1_HEAT_round [StraightShooter]

myPrimaryShooter > primary01 > myAmmoTypes | Right Click on myAmmoTypes, add new ammoType, name: 120mm_HEAT


Copy the values above into the new 120mm_HEAT [AmmoType] entry. Of note, these values were copied from the original -

mySpecialAbilityShooter > M1A1_HEAT_round > myAmmoTypes > 120mm_HEAT [AmmoType]

You can grab these from your backup if you wish.


There is no recap, since you can just read the tutorial again, but if you have any questions, if anything doesn't make sense, drop me a PM over in massgate.

- Lt. Sherpa

Personal tools
User Created Content