Post tutorial RSS Coding Basics #2

(Coding Basic:Editing Units) this tutorial is made by:Opsnyder From gamereaplys(dot)org i uploaded this here because some tutorials from this web is have broken links not only this web also cnclabs(dot)com they got alot of tutorials thier uploaded sometime in 2009-2010 then suddenly gone or disappear same as the gamereaplys(dot)org.

Posted by on - Basic Client Side Coding

Unit Editing Tutorial For C&C Generals Zero Hour

Tutorial made by: Opsnyder

Welcome to the newest Tip of the Week for Zero Hour written by Opsnyder. This week will be about modding the game. Don’t worry, in this TotW I will not explain how to make entire mods. I will explain how to edit the units that are already in Zero Hour. As you will discover, this editing is actually quite easy to do and even though it’s not that hard, you will be able to create lots of cool stuff. Although I got no experience with editing CCG I think it works the same.

post 10016 1243884789

A Few Steps Before We Can Start

Before you can start editing your Zero Hour there are a few things you have to do.

  1. Copy your ‘Command & Conquer Generals Zero Hour directory, which is located at: C/program files/EA games. Then paste this with a completely different name in the same directory. From now on this new directory will be for your edited stuff so your game remains compatible for online gaming and watching replays. Do not edit anything in your ‘Command & Conquer Generals Zero Hour’ directory else you have to reinstall your game to play online.
  2. Download Finalbig. This program will make the .ini files visible in which we’re going to do all the editing work.
  3. Use Finalbig to open INIZH.big in your edited Zero Hour directory and extract the files in that same directory. You now have a INI directory in your Data directory. In this folder you will find a lot of .txt documents and more folders which have more .txt document inside them. Take a look at them, this is how your game has been build up by EA. In most files you can still see some notes and sometimes even some names of the people that made this game. And there are also some other weapons and abilities in the files which were edited out before the games release. Like a Red Guard bayonet ability or neutron Tank Hunters. Don’t edit any files if you don’t know what it does. If you do something the game doesn’t understand, it will error at the loading screen. If you can’t remember what you’ve changed or what it was supposed to be you can start all over again at step one

In this TotW we’re only going to use the weapon.ini file and some files in the Object map. Here is a short explanation of what these files do within the game: In the weapon.ini you see a huge list of weapon types. Every form of attacking or abilities units, buildings and general abilities have is created here. In the object map there are different files for all the armies you have in this game. All the units and buildings a army possesses are put together here giving them their stats and references to other files to create the unit. Here is also pointed out which attack types in the weapon.ini a unit should use and what the requirements are to use that attack.

Let The Editing Begin

Now it is time to actually start editing some files and make some fun units. Let’s start with a flamethrower red guard. All you have to do for this is scrolling trough the weapons in weapon.ini until you reach the flamethrower weapon of the dragon tank. It will take you a lot of searching, so here is the weapon I was aiming for: DragonTankFlameWeapon. Now you got to open the ChinaInfantry.ini file so you can edit the infantry of Chinav. Immediately on top you will find the Red Guard with some code that looks like this:

; ***DESIGN parameters ***

DisplayName = OBJECT <--- Redguard This tells what skins should be used for this unit. These skins are made in another INI file much like the weapon.ini file.

Side = China <--- This tells which faction/side is able to use this unit

EditorSorting = INFANTRY <--- This tells what type of unit it is. It doesn’t always makes sense though. A black lotus is a vehicle for example so it can’t be crushed.

TransportSlotCount = 1 <--- This tells how much space this unit will take in a transport. 0 means the unit isn’t transportable.

Weapon.Set.Conditions.= None <--- This tells what the requirements are before a unit can use this weapon. A sentry drone has to buy a upgrade to get it’s machine gun for example. (i put (dots) because the sentence suddenly broke. Can u explain what is going on?. Dont put (dots))

Weapon = PRIMARY RedguardMachineGun<--- This is the weapon the unit will have which refers to code in the weapon.ini file.

By replacing RedguardMachineGun for DragonTankFlameWeapon you will now have a flamethrower as standard Chinese infantry unit. From now one your enemy will fear your troopcrawlers.

post 10016 1243884801

The True Battlemaster

Because the battlemaster isn’t really master in anything besides giving the enemy experience, I’ve decided to buff it a bit.... By shooting tomahawks from a distance of 600 (a normal tomahawk in Generals has a maximum range of 350).

This basically works the same as before. In the weapon.ini file you will find that the tomahawk weapon is called: TomahawkMissileWeapon. Only this time we’re not satisfied with the stats the tomahawk has. So in the weapon.ini you got to copy the follow code and paste it somewhere else in the file. Adding a 2 behind TomahawkMissileWeapon is enough to not effect the tomahawk itself.

Weapon TomahawkMissileWeapon2

PrimaryDamage = 150.0 <--- change it to 300.0

PrimaryDamageRadius = 10.0 <--- change it to 50.0

SecondaryDamage = 50.0

SecondaryDamageRadius = 25.0

ScatterRadiusVsInfantry = 20.0

AttackRange = 350.0 <--- change it to 600

PreAttackDelay = 250

PreAttackType = PER_SHOT

MinimumAttackRange = 100.0

DamageType = EXPLOSION

DeathType = EXPLODED

FireFX = FX_TomahawkIgnition

ProjectileObject = TomahawkMissile

ProjectileExhaust = TomahawkMissileExhaust

VeterancyProjectileExhaust = HEROIC HeroicTomahawkMissileExhaust

; ProjectileDet />ProjectileDet />RadiusDamageAffects = SELF ALLIES ENEMIES NEUTRALS NOT_SIMILAR

FireSound = TomahawkWeapon

DelayBetweenShots = 1

ClipSize = 1 <--- change it to 3

ClipReloadTime = 7000 <--- change it to 3000

First we change the damage it does to 300 and the blast radius to 50 so our battlemaster gets some big muscles. The attack range is of course not sufficient and will be improved to 600. I'm also not happy with the rate of fire. So the clipsize will be changed to 3 so my beautiful tank has 3 tomahawks to shoot before reloading. And off course the reloading gets reduced to 3000.

post 10016 1243884812

Now you open the ChinaVehicle file and edit BattleMasterTankGun for TomahawkMissileWeapon2 and your battlemaster is now truly a master of battle. Because it might be slightly overpowered now, i’m going to do some balancing EA style.

In the same file you will find this for the battlemaster:
BuildCost = 800
BuildTime = 10.0

If you change this to:
BuildCost = 900
BuildTime = 15.0
Then we got a perfectly balanced unit.

With the files in the object map and the weapon.ini you can make loads of fantastic units. If you want even more advanced changes to your own personal generals game, just look at the other files and experiment a bit. I’ve also did it this way and learned how most files work myself. For questions you can always PM me. I’m not a expert though and have no idea how to actually make models for new units.

---------------------------------(THE END)-------------------------------------

Edited/Fixed some Words/Links By: Kenlv

The Original:


The scatter radius of the GLA buggy doesn't seem to work. In the beta, the missles didn't hit one single target but an area. Do you know a way to make this work again?

Reply Good karma Bad karma+1 vote
Kenlv Author

IDK man

Reply Good karma+1 vote

You can ctrl+f to find specific terms and it would be much easier than scrolling a lot of settings. Coding is different with games this kind of coding is straightforward so I call it settings

Reply Good karma Bad karma+1 vote
Kenlv Author


Reply Good karma+1 vote

Hello everyone. Super, will there be a sequel? Tell us in detail about KINDOF in the code?

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.