Jump to content


Photo

[GEN - ZH] Basic INI codding


  • Please log in to reply
No replies to this topic

#1 Gen.Kenobi

Gen.Kenobi

    I'm a doc, not an...

  • Undead
  • 1,429 posts
  • Location:Brazil
  • Projects:Survive Med School
  •  Your Doc
  • Division:Revora
  • Job:Hosting Admin

Posted 29 December 2009 - 10:15 PM

What this tutorial will cover?

* Basic INI codding
* Adding a new unit, making it buildable.

------------------------------------------------------------------------------------------

So...you have Generals Zh and want to get started with modding...

This GUIDE is for you!

Now to get started you'll need a BIG file extractor. We'll use Final BIG. If you don't have it donwload it here! http://commandandcon...ig_Editor;38034

So, today i'll teach you how to add a new unit for Vanilla US.

This will be called the CannonJeep. Basicaly a HUMVEE with the Crusader Tank weapon.
So let's get started.

First open Final BIG and open INIZH.big file. Them extract all files onto your Generals ZH directory. (They will be already in their positions, so just go to edit, extract all.)

The files we'll use for this tutorial will be:
* AmericaVeichle.ini (go to Data->INI-> Object)
* CommandButton.ini (go to Data->INI)
* CommandSet.ini (go to Data->INI)

AmericaVeichle.ini contains all veichles for vanilla US side.
CommandButton.ini contains all buttons in the game, and we'll need to use it to add a new button to buy the Cannon Jeep
CommandSet.ini basicaly puts the button you've made into the slot you want.

So let's get started, first open AmericaVeichle.ini

The first code you see is the AmericaVehicleHumvee.

Now copy all the code:

;------------------------------------------------------------------------------
Object AmericaVehicleHumvee

; *** ART Parameters ***
  SelectPortrait		 = SAHummer_L
  ButtonImage			= SAHummer
  
  UpgradeCameo1 = Upgrade_AmericaBattleDrone
  UpgradeCameo2 = Upgrade_AmericaScoutDrone
  UpgradeCameo3 = Upgrade_AmericaHellfireDrone
  UpgradeCameo4 = Upgrade_AmericaAdvancedTraining
  UpgradeCameo5 = Upgrade_AmericaTOWMissile
  
  Draw = W3DTruckDraw ModuleTag_01
	OkToChangeModelColor = Yes

	ConditionState = NONE
	  Model = AVHUMMER
	  Turret = Turret
	  ShowSubObject = Turret
	  HideSubObject = TurretUp01 Housecolor03 MuzzleFXUP01
	  WeaponFireFXBone = PRIMARY Muzzle
	  WeaponMuzzleFlash = PRIMARY MuzzleFX
	End

	ConditionState = REALLYDAMAGED
	  Model = AVHUMMER_d
	  Turret = Turret
	  ShowSubObject = Turret
	  HideSubObject = TurretUp01 Housecolor03 MuzzleFXUP01
	  WeaponFireFXBone = PRIMARY Muzzle
	  WeaponMuzzleFlash = PRIMARY MuzzleFX
	End

	ConditionState = WEAPONSET_PLAYER_UPGRADE
	  Model = AVHUMMER
	  Turret = TurretUp01
	  HideSubObject = Turret MuzzleFX01
	  ShowSubObject = TurretUp01 Housecolor03
	  WeaponFireFXBone = PRIMARY MuzzleUp
	  WeaponMuzzleFlash = PRIMARY MuzzleFXUp
	  WeaponFireFXBone = SECONDARY WeaponB
	  WeaponLaunchBone = SECONDARY WeaponB
	  WeaponFireFXBone = TERTIARY WeaponB
	  WeaponLaunchBone = TERTIARY WeaponB
	End

	ConditionState = REALLYDAMAGED WEAPONSET_PLAYER_UPGRADE
	  Model = AVHUMMER_d
	  Turret = TurretUp01
	  HideSubObject = Turret MuzzleFX01
	  ShowSubObject = TurretUp01 Housecolor03
	  WeaponFireFXBone = PRIMARY MuzzleUp
	  WeaponMuzzleFlash = PRIMARY MuzzleFXUp
	  WeaponFireFXBone = SECONDARY WeaponB
	  WeaponLaunchBone = SECONDARY WeaponB
	  WeaponFireFXBone = TERTIARY WeaponB
	  WeaponLaunchBone = TERTIARY WeaponB
	End

	TrackMarks = EXTireTrack.tga

	Dust = RocketBuggyDust
	DirtSpray = RocketBuggyDirtSpray
	PowerslideSpray = RocketBuggyDirtPowerSlide

 ; These parameters are only used if the model has a separate suspension, 
 ; and the locomotor has HasSuspension = Yes.
	LeftFrontTireBone = Tire01
	RightFrontTireBone = Tire02
	LeftRearTireBone = Tire03
	RightRearTireBone = Tire04
	TireRotationMultiplier = 0.2; this * speed = rotation.
	PowerslideRotationAddition = 1.25; This speed is added to the rotation speed when powersliding.

  End

; ***DESIGN parameters ***
  DisplayName		   = OBJECT:Humvee
  Side				  = America
  EditorSorting		 = VEHICLE
  TransportSlotCount	= 3		;how many "slots" we take in a transport (0 == not transportable)
  WeaponSet
	Conditions = None 
	Weapon = PRIMARY HumveeGun
	Weapon = SECONDARY HumveeMissileWeaponAirDummy
  End
  WeaponSet
	Conditions = PLAYER_UPGRADE 
	Weapon = PRIMARY HumveeGun
	Weapon = SECONDARY HumveeMissileWeapon
	Weapon = TERTIARY HumveeMissileWeaponAir
	PreferredAgainst = TERTIARY	 AIRCRAFT
  End
  ArmorSet
	Conditions	  = None
	Armor		   = HumveeArmor
	DamageFX		= TruckDamageFX
  End
  BuildCost	   = 700
  BuildTime	   = 10.0	;in seconds	
  VisionRange	 = 150
  ShroudClearingRange = 320
  Prerequisites
	Object = AmericaWarFactory
  End
  ExperienceValue = 50 50 100 150;Experience point value at each level
  ExperienceRequired = 0 100 150 300;Experience points needed to gain each level
  IsTrainable = Yes	;Can gain experience
  CrusherLevel		   = 2;What can I crush?: 1 = infantry, 2 = trees, 3 = vehicles
  CrushableLevel		 = 2;What am I?:		0 = for infantry, 1 = for trees, 2 = general vehicles
  CommandSet	  = AmericaVehicleHumveeCommandSet

; *** AUDIO Parameters ***
  VoiceSelect = HumveeVoiceSelect
  VoiceMove = HumveeVoiceMove
  VoiceGuard = HumveeVoiceMove
  VoiceAttack = HumveeVoiceAttack
  VoiceAttackAir = HumveeVoiceAttackTOW
  SoundMoveStart = HumveeMoveStart
  SoundMoveStartDamaged = HumveeMoveStart
  SoundEnter = HumveeEnter
  SoundExit = HumveeExit

  UnitSpecificSounds
 ; These have the syntax of SomeNameSomewhereInCode = SomeNameSomewhereInLookupINIs
 ;TurretMoveStart	= NoSound
	VoiceCreate		 = HumveeVoiceCreate
	TurretMoveLoop	  = TurretMoveLoop
	SoundEject		  = PilotSoundEject
	VoiceEject		  = PilotVoiceEject
	VoiceCrush		  = HumveeVoiceCrush
; Required for the W3DTruckDraw module
	TruckLandingSound = RocketBuggyLand
	TruckPowerslideSound = RocketBuggyPowerslide
	VoiceUnload = HumveeVoiceUnload
	VoiceEnter = HumveeVoiceMove
  End


; *** ENGINEERING Parameters ***
  RadarPriority = UNIT
  KindOf = PRELOAD SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT CAN_CAST_REFLECTIONS VEHICLE SCORE TRANSPORT

  Body = ActiveBody ModuleTag_02
	MaxHealth	   = 240.0
	InitialHealth   = 240.0

 ; Subdual damage "Subdues" you (reaction defined by BodyModule) when it passes your max health.
 ; The cap limits how extra-subdued you can be, and the other numbers detemine how fast it drains away on its own.
	SubdualDamageCap = 480
	SubdualDamageHealRate = 500
	SubdualDamageHealAmount = 50
  End
  Behavior = TransportAIUpdate ModuleTag_03
	Turret
	  TurretTurnRate = 180
	  RecenterTime = 5000; how long to wait during idle before recentering
	  ControlledWeaponSlots = PRIMARY SECONDARY TERTIARY
	End
	AutoAcquireEnemiesWhenIdle = Yes
	MoodAttackCheckRate		= 250
  End
  Locomotor = SET_NORMAL HumveeLocomotor

  Behavior = PhysicsBehavior ModuleTag_04
	Mass = 50.0
  End

  Behavior = TransportContain  ModuleTag_05
	PassengersAllowedToFire = Yes
	Slots			 = 5
;	EnterSound		  = GarrisonEnter
;	ExitSound		   = GarrisonExit
	DamagePercentToUnits = 100%;10%
	AllowInsideKindOf  = INFANTRY
	ExitDelay = 250
	NumberOfExitPaths = 3; Defaults to 1.  Set 0 to not use ExitStart/ExitEnd, set higher than 1 to use ExitStart01-nn/ExitEnd01-nn
	GoAggressiveOnExit = Yes; AI Will tell people to set their mood to Aggressive on exiting
  End

  Behavior = ObjectCreationUpgrade ModuleTag_06
	UpgradeObject = OCL_AmericanBattleDrone
	TriggeredBy   = Upgrade_AmericaBattleDrone
	ConflictsWith = Upgrade_AmericaScoutDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_07
	UpgradeObject = OCL_AmericanScoutDrone
	TriggeredBy   = Upgrade_AmericaScoutDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_14
	UpgradeObject = OCL_AmericanHellfireDrone
	TriggeredBy   = Upgrade_AmericaHellfireDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaScoutDrone
  End

  Behavior = ProductionUpdate ModuleTag_08
	MaxQueueEntries = 1; So you can't build multiple upgrades in the same frame
  End

  Behavior = WeaponSetUpgrade ModuleTag_09
	TriggeredBy = Upgrade_AmericaTOWMissile
  End
  Behavior = ExperienceScalarUpgrade ModuleTag_10
	TriggeredBy = Upgrade_AmericaAdvancedTraining
	AddXPScalar = 1.0;Increases experience gained by an additional 100%
  End

  Behavior = SlowDeathBehavior ModuleTag_11
	DeathTypes = ALL -CRUSHED -SPLATTED
	ProbabilityModifier = 25
	DestructionDelay = 1
	OCL = INITIAL  OCL_InitialHumveeDebris
	FX  = FINAL	FX_BattleMasterExplosionOneFinal
	OCL = FINAL	OCL_FinalHumveeDebris
  End

  Behavior = DestroyDie ModuleTag_12
	DeathTypes = NONE +CRUSHED +SPLATTED
  End

  Behavior = FXListDie ModuleTag_13
	DeathTypes = NONE +CRUSHED +SPLATTED
	DeathFX = FX_CarCrush
  End

  Behavior = CreateCrateDie ModuleTag_CratesChange
	CrateData = SalvageCrateData
 ;CrateData = EliteTankCrateData
 ;CrateData = HeroicTankCrateData
  End

; This is commented out per hotlist request 10/9 ML
;  Behavior = CreateObjectDie ModuleTag_15
;	DeathTypes = ALL -CRUSHED -SPLATTED
;	CreationList = OCL_AmericanRangerDebris01
;	ExemptStatus = HIJACKED
;  End

  Behavior = EjectPilotDie ModuleTag_16
	DeathTypes = ALL -CRUSHED -SPLATTED
	ExemptStatus = HIJACKED
 ; The following added out per hotlist request 10/9 as above ML
	VeterancyLevels =  ALL -REGULAR;only vet+ gives pilot
	GroundCreationList = OCL_EjectPilotOnGround
	AirCreationList = OCL_EjectPilotViaParachute
  End

  Behavior = TransitionDamageFX ModuleTag_17
	ReallyDamagedParticleSystem1 = Bone:Smoke RandomBone:Yes PSys:SmokeSmallContinuous01
	ReallyDamagedFXList1 = Loc: X:0 Y:0 Z:0 FXList:FX_BattleMasterDamageTransition
  End

  Behavior = FlammableUpdate ModuleTag_21
	AflameDuration = 5000; If I catch fire, I'll burn for this long...
	AflameDamageAmount = 3	; taking this much damage...
	AflameDamageDelay = 500	; this often.
  End

  Geometry = BOX
  GeometryMajorRadius = 14.0
  GeometryMinorRadius = 7.0
  GeometryHeight = 11.5	 
  GeometryIsSmall = Yes 
  Shadow = SHADOW_VOLUME
  ShadowSizeX = 45; minimum elevation angle above horizon. Used to limit shadow length

End

And paste it in the end of the file. Now let's get started with the true modding!

Fist we need to change the object name to

Object AmericaVehicleCannonJeep

Good now we have our new unit! Now we need to change it's weapons and cost and build time!

; ***DESIGN parameters ***
  DisplayName		   = OBJECT:Humvee
  Side				  = America
  EditorSorting		 = VEHICLE
  TransportSlotCount	= 3		;how many "slots" we take in a transport (0 == not transportable)
  WeaponSet
	Conditions = None
	Weapon = PRIMARY CrusaderTankGun
	Weapon = SECONDARY HumveeMissileWeaponAirDummy
  End
  WeaponSet
	Conditions = PLAYER_UPGRADE
	Weapon = PRIMARY CrusaderTankGun
	Weapon = SECONDARY HumveeMissileWeapon
	Weapon = TERTIARY HumveeMissileWeaponAir
	PreferredAgainst = TERTIARY	 AIRCRAFT
  End

What we've done? We've changed the PRIMARY weapon of the Cannon Jeep to the CrusaderTankGun weapon. How can i add my own and new weapon? YOu'll need to edit the Weapons.ini (go to Data->INI) but we'll not cover it today. Let's make our CannonJeep Cost less? and build faster?

ArmorSet
	Conditions	  = None
	Armor		   = HumveeArmor
	DamageFX		= TruckDamageFX
  End
  BuildCost	 = 100
  BuildTime	= 5.0	 ;in seconds   
  VisionRange	 = 150
  ShroudClearingRange = 320
  Prerequisites
	Object = AmericaWarFactory
  End



Now it's done!!!! We now need to add the buttons! For this open CommandButton.ini and find HUMMER.

The code that you'll find will be this one:


CommandButton Command_ConstructAmericaVehicleHumvee
  Command	   = UNIT_BUILD
  Object		= AmericaVehicleHumvee
  TextLabel	 = CONTROLBAR:ConstructAmericaVehicleHumvee
  ButtonImage   = SAHummer
  ButtonBorderType		= BUILD; Identifier for the User as to what kind of button this is
  DescriptLabel		   = CONTROLBAR:ToolTipUSABuildHumvee
End

Again copy it and paste on the end of the file. Them we need to change the object name.

CommandButton Command_ConstructAmericaVehicleCannonJeep
  Command	   = UNIT_BUILD
  Object		= AmericaVehicleCannonJeep
  TextLabel	 = CONTROLBAR:ConstructAmericaVehicleHumvee
  ButtonImage   = SAHummer
  ButtonBorderType		= BUILD; Identifier for the User as to what kind of button this is
  DescriptLabel		   = CONTROLBAR:ToolTipUSABuildHumvee
End

Now the button is done! We need to setup the slot in the CommandSet.ini. Open it!!!!

Search for AmericaWarFactoryCommandSet:

Them you'll find this:

CommandSet AmericaWarFactoryCommandSet
  1  = Command_ConstructAmericaTankCrusader
  2  = Command_ConstructAmericaVehicleTomahawk
  3  = Command_ConstructAmericaVehicleHumvee
  4  = Command_ConstructAmericaVehicleMedic
  5  = Command_ConstructAmericaVehiclePaladin
  6  = Command_ConstructAmericaVehicleSentryDrone
  7  = Command_ConstructAmericaVehicleAvenger
  8  = Command_ConstructAmericaVehicleMicrowave
  9  = Command_UpgradeAmericaSentryDroneGun
  11 = Command_UpgradeAmericaTOWMissile
  13 = Command_SetRallyPoint
  14 = Command_Sell
End

As you can see, the max limit of buttons in a place (like war factory) is 14 slots. But if you see you'll notice that the slot 10 is clear we just need to add the slot 10 and put the button code!

CommandSet AmericaWarFactoryCommandSet
  1  = Command_ConstructAmericaTankCrusader
  2  = Command_ConstructAmericaVehicleTomahawk
  3  = Command_ConstructAmericaVehicleHumvee
  4  = Command_ConstructAmericaVehicleMedic
  5  = Command_ConstructAmericaVehiclePaladin
  6  = Command_ConstructAmericaVehicleSentryDrone
  7  = Command_ConstructAmericaVehicleAvenger
  8  = Command_ConstructAmericaVehicleMicrowave
  9  = Command_UpgradeAmericaSentryDroneGun
  10 = Command_ConstructAmericaVehicleCannonJeep
  11 = Command_UpgradeAmericaTOWMissile
  13 = Command_SetRallyPoint
  14 = Command_Sell
End

Done! Your new unit is added with the buttons and the commands needed. To end this tutorial you MUST test it to see if you really modded the game!!!!

Go test it and sucess!!! We got it!
If there's something wrong, you must review your codes to see what's wrong!!!

Modding takes time but is very fun!

Hope you liked it and enjoyed! More tutorials comming soon!
Happy modding!

-Gen.Kenobi out

Edited by Gen.Kenobi, 29 December 2009 - 10:17 PM.

kudos to Pasidon for this awesome avvy and siggy!





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users