Hello all! This tutorial was made by request, so enjoy!
I was asked to do a tutorial for Generals Zero Hour modding so I’ll start with the basics and then go up to some more advanced things in other tutorials:
To start off let's take a look at some of the easiest things to code: Weapons and Locomotors as well as some other things.
one of the first things you need to know is that ; marks a comment in the code. for example if you want to explain a bit of code you would do this: ;
this has to be done per line, for example
comment <-- this is going to crash the game because theres now ; in front of it.
anothe important thing is where the codes are located. you can find them in a file called INIZH.big
use this program to extract them to your main ZH directory (it won't overwrite anything unless you have code in the Data\INI folder already) then you can go into the INI folder in the Data folder and edit the code
weapons coding is incredibly easy to do. Here's an example of a weapon code below:
PrimaryDamage = 60.0 <-- the amount of damage it does
PrimaryDamageRadius = 5.0 <-- the splash damage, if this was 9999 then anything in that radius would take 60 damage
ScatterRadiusVsInfantry = 10.0 <--When this weapon is used against infantry, it can randomly miss by as much as this distance.
AttackRange = 170.0 <-- the range of the weapon
MinTargetPitch = -15 <--the more advanced code, a unit has to be withing the pitch to be fired on
MaxTargetPitch = 15 <--ditto
DamageType = ARMOR_PIERCING <-- the damage type, in this case it will do more damage to vehicles then infantry
DeathType = NORMAL <-- if a unit is killed what death type should it use? eg. explosive damage type for bombs
WeaponSpeed = 300 <--dist/sec, a gun is 9999 because it kills instantly, the higher it is the faster the projectile moves.
WeaponRecoil = 10 <-- the amount of recoil, the higher this is the more the unit will move when the weapon is fired
ProjectileObject = MarauderTankShell <-- the projectile fired by the weapon
FireFX = WeaponFX_GenericTankGunNoTracer <-- the tracer's going out the back of the projectile so you know it's there.
VeterancyFireFX = HEROIC WeaponFX_HeroicGenericTankGunNoTracer <-- same as above but used for level 3 veterancy
ProjectileDetonationFX = WeaponFX_GenericTankShellDetonation <-- the particles to use when the projectile hits a target
FireSound = MarauderTankWeapon <-- the sound that's made when it's fired
RadiusDamageAffects = ALLIES ENEMIES NEUTRALS <-- which sides this weapon can damage
DelayBetweenShots = 2000 <--time between shots, in milliseconds
ClipSize = 0 <-- how many shots in a Clip (0 == infinite)
ClipReloadTime = 0 <--how long to reload a Clip, in milliseconds
; note, these only apply to units that aren't the explicit target
; (ie, units that just happen to "get in the way"... projectiles
; always collide with the Designated Target, regardless of these flags
ProjectileCollidesWith = STRUCTURES WALLS
some other weapon codes are:
ContinuousFireOne = 6 <--How many shots at the same target constitute "Continuous Fire" the unit fires faster
ContinuousFireTwo = 12 <--How many shots at the same target constitute "Continuous Fire Two" even faster
ContinuousFireCoast = 1000 <-- the unit can fire the long at a unit after that unit has left its range
WeaponBonus = CONTINUOUS_FIRE_MEAN RATE_OF_FIRE 200% <--When the object achieves this state, this weapon gets double the rate of fire.
WeaponBonus = CONTINUOUS_FIRE_FAST RATE_OF_FIRE 300% <-- same as above only faster
WeaponBonus = PLAYER_UPGRADE DAMAGE 125% <-- an upgrade to damage for example: ChainGun upgrade
AntiAirborneVehicle = No <-\
AntiAirborneInfantry = No <---\
AntiGround = No <-----------------|> These dictate what the unit can fire at
AntiSmallMissile = No <------/
AntiBallisticMissile = No <-----/
Locomotor coding, like weapon coding, is easy to do. let's take a look at some code:
Surfaces = GROUND RUBBLE <-- the surfaces the unit can walk on
Speed = 20 <-- in dist/sec how fast the unit goes
SpeedDamaged = 10 <-- in dist/sec, how fats hte unit goes when damaged
TurnRate = 500 <-- in degrees/sec how fast the unit turns
TurnRateDamaged = 500 <-- in degrees/sec how fast the unit turns when damaged
Acceleration = 100 <--in dist/(sec^2) how fast the unit accelerates
AccelerationDamaged = 50 <--in dist/(sec^2) how fast the unit accelerates when damaged
Braking = 100 <--in dist/(sec^2) how fast the unit brakes (stops)
MinTurnSpeed = 0 <-- in dist/sec the minimum turn speed
ZAxisBehavior = NO_Z_MOTIVE_FORCE < whether or not the unit can move on the Z axis (up and down) i'm pretty sure this is for planes only
Appearance = TWO_LEGS <-- how they appear to move
StickToGround = Yes <-- to prevent infantry from flying if they run off a hill, im pretty sure this is for light vehicles only (liek the bike)
GroupMovementPriority = MOVES_FRONT <-- Moves in the front of a group, behind small arms, ahead of artillery. where the unit moves in a group
for aircraft there are a couple lines added:
Surfaces = AIR <-- changed to air
MinSpeed = 60 <-- in dist/sec the minimum airspeed, it must not be reduced below 60 or the game will glitch
Lift = 120 <-- in dist/(sec^2) how fast the unit lifts off
LiftDamaged = 80 <-- in dist/(sec^2) how fast the unit lifts off when damaged
PreferredHeight = 100 <-- the height the aircraft stay at
AllowAirborneMotiveForce = Yes <-- i honestly don't know what this does, keep it at Yes :P
ZAxisBehavior = SURFACE_RELATIVE_HEIGHT <-- the unit will stay at 100 (or whatever the prefferedheight is) when it changes terrain heights
CirclingRadius = 100 <-- the radius in which the unit circles (when idle or guarding)
Appearance = WINGS <-- how it appears to move
PitchInDirectionOfZVelFactor = 1.0 <--how much to pitch according to our z-vel. 0=none, 1=lots (0=default)
PitchStiffness = 0.5 <-- stiffness of the "springs" in the suspension forward & back.
RollStiffness = 0.4 <-- stiffness of the "springs" in the suspension side to side.
PitchDamping = 0.9 <-- How fast it damps. 0=perfect spring, bounces forever. 1=glued to terrain.
RollDamping = 0.8 <-- How fast it damps. 0=perfect spring, bounces forever. 1=glued to terrain.
ForwardVelocityPitchFactor = 0 <-- How much velocity will cause the front to lift/dip
LateralVelocityRollFactor = 0.2 <-- How much cornering will cause the chassis to roll.
Apply2DFrictionWhenAirborne = Yes <-- the firction applied when the unit is in the air
AirborneTargetingHeight = 30 <-- the height the unit will attack targets at
LocomotorWorksWhenDead = Yes <-- when the unti dies it continues moving, it doesn't just stop and fall
Jet's also require a taxiing locomotor for moving around the airport, it's basically the same as the ground locomotor
rank.ini is the file which has the number of generals pints and required EXP to get them.
RankName = INI:RankLevel1 <-- the name of it in the code
SkillPointsNeeded = 0 <-- EXP needed to get this rank. you get EXP by destroying infantry, vehicles and buildings
SciencesGranted = SCIENCE_Rank1 <-- the scinece rank granted (from Science.ini)
SciencePurchasePointsGranted = 1 <-- the amount of points you get
editing this file is useful for testing or cheating. It's also possible to add more ranks but that's more advanced stuff.
Colour and Money
Multiplayer.ini has all the code for ingame colours and money choices. the name of the ini file is misleading in a way. I'm not gonna post the entire ini here but ill post a couple things:
MultiplayerColor ColorRed <-- the colour
RGBColor = R:255 G:0 B:0 <-- the colour (it's in number form but bascially R is red, G is green and B is blue. the highest number for them is 255 so Red 255 is the solid red colour.)
RGBNightColor = R:255 G:0 B:0 <-- the colour... at night
TooltipName = Color:Red <-- the tooltip name from Generals.str which stores all the text for the game
MultiplayerStartingMoneyChoice <-- a money choice
Value = 10000 <-- how much money it is
Default = Yes <-- when you start the game it'll automatically pick this choice
last but not leat Gamedata.ini this has a few noteable lines of code in, most are used for cheating purposes though.
BuildSpeed = 1.0 <-- how fast you build
MinDistFromEdgeOfMapForBuild = 30.0 <-- buildings may not be constructed this close to a map edge. make this 0 and you can build closer to the edge of the map
SupplyBuildBorder = 20.0 <-- min dist you can put a supply center from a supply source. make this 0 and you can build your supply depot right beside a supply pile.
AllowedHeightVariationForBuilding = 10.0 <-- how "flat" the terrain has to be to be buildable. The higher the number is the more variation. so if it was 9999999 then you could build on the side of a cliff. NOTE you'll need to edit the dozers or workers locomotor so he can walk up cliffs otherwise you won't be able to build on them.
MinLowEnergyProductionSpeed = 0.5 <-- the minimum speed you can build with no energy
MaxLowEnergyProductionSpeed = 0.8 <-- the maximum speed you can build with no energy
for the above 2 lines of code: if this is higher than one then you'll build faster with no power than if you had power! so if these were 2 then you'll build 2 times faster without power!
CommandCenterHealRange = 500.0 <-- the range your command ceneter heals your and allied units. the higher this is then the bigger the range.
CommandCenterHealAmount = 0.01 <-- the amount of health it heals, the higher this is the more it heals.
RefundPercent = 50.0% <----\
SellPercentage = 50% <-|> change these 2 to 100% to get the full amount of money back when you sell a bulding. change them to higher than 100% to get more money back. for example is a building costs 1000 and these numbers are 200% when you sell tht building you'll get 2000 back instead of the regular 500.
UnlookPersistDuration = 5000 <-- How long after you stop looking until the fog grows back, the higher this is the slower the fog grows back. for example if this number was 99999999999999999999999999999999999999999999999999999999999999999999 then technically the fog wouldn't grow back for the entire match (unless the match was like 5 hours :P)
that's all for my basic tutorial. I'll make an Intermediate one later and then eventually an Advanced one :D i hope this was informative to new modders!