Jump to content


[info] Breaking down the code


6 replies to this topic

#1 Slightly Wonky Robob

    Not a Wonky Gent.

  • Administrator
  • 9337 posts

Posted 30 October 2006 - 20:12

in my first zero hour based tutorial, i am going to try and break the code used for the crusader into meaningful chunks, that are easier to handle than one massive lump of code,i know that was what i found most daunting when i first started

before i go any further, i would like to remind you that i will not be teaching you how to add anything, altough the idea is to inform you how you might go about adding something, or at least understanding it :)

First off here is the code used for the USA crusader, it is found in the INIZH.big, in the americavehilce.ini

;------------------------------------------------------------------------------
Object AmericaTankCrusader

 &#59; *** ART Parameters ***
  SelectPortrait		 = SACLeopard_L
  ButtonImage			= SACLeopard
  
  UpgradeCameo1 = Upgrade_AmericaBattleDrone
  UpgradeCameo2 = Upgrade_AmericaScoutDrone
  UpgradeCameo3 = Upgrade_AmericaHellfireDrone
  UpgradeCameo4 = Upgrade_AmericaAdvancedTraining
  UpgradeCameo5 = Upgrade_AmericaCompositeArmor
  
  Draw = W3DTankDraw ModuleTag_01
	DefaultConditionState
	  Model			   = AVLeopard
	  Turret			  = Turret
	  WeaponFireFXBone	= PRIMARY TurretMS
	  WeaponRecoilBone	= PRIMARY Barrel
	  WeaponMuzzleFlash   = PRIMARY TurretFX
	  WeaponLaunchBone = PRIMARY TurretMS
	End
	ConditionState	   = REALLYDAMAGED
	  Model			  = AVLeopard_D
	End
	ConditionState	   = RUBBLE
	  Model			  = AVLeopard_D
	End

	TrackMarks		   = EXTnkTrack.tga
	TreadAnimationRate	  = 2.0 &#59; amount of tread texture to move per second
	TreadDriveSpeedFraction = 0.3 &#59; fraction of locomotor speed below which treads stop moving.
	TreadPivotSpeedFraction = 0.6 &#59; fraction of locomotor speed below which we allow pivoting.
	OkToChangeModelColor = Yes
  End

 &#59; ***DESIGN parameters ***
  DisplayName	  = OBJECT:Crusader
  Side				   = America
  EditorSorting		  = VEHICLE
  TransportSlotCount	 = 3
  WeaponSet
	Conditions		   = None 
	Weapon			   = PRIMARY CrusaderTankGun
   &#59; Uncomment this when we want the crusader to have a machine too again
   &#59;Weapon			   = SECONDARY CrusaderMachineGun
  End
  ArmorSet
	Conditions		   = None
	Armor				= TankArmor
	DamageFX			 = TankDamageFX
  End
 &#59;ArmorSet
 &#59;  Conditions		   = PLAYER_UPGRADE
 &#59;  Armor				= UpgradedTankArmor
 &#59;  DamageFX			 = TankDamageFX
 &#59;End
  BuildCost			  = 900
  BuildTime			  = 10.0		 &#59;in seconds	
  VisionRange			= 150
  ShroudClearingRange = 300
  Prerequisites
	Object = AmericaWarFactory
  End
  ExperienceValue		= 100 100 200 400&#59;Experience point value at each level
  ExperienceRequired	 = 0 200 300 600&#59;Experience points needed to gain each level
  IsTrainable			= Yes &#59;Can gain experience
  CrusherLevel		   = 2 &#59;What can I crush?: 1 = infantry, 2 = trees, 3 = vehicles
  CrushableLevel		 = 2 &#59;What am I?:		0 = for infantry, 1 = for trees, 2 = general vehicles
  CommandSet			 = AmericaTankCrusaderCommandSet
  
 &#59; *** AUDIO Parameters ***
  VoiceSelect		   = CrusaderTankVoiceSelect
  VoiceMove			 = CrusaderTankVoiceMove
  VoiceGuard			= CrusaderTankVoiceMove
  VoiceAttack		   = CrusaderTankVoiceAttack
  SoundMoveStart		= CrusaderTankMoveStart
  SoundMoveStartDamaged = CrusaderTankMoveStart
  UnitSpecificSounds
   &#59; These have the syntax of SomeNameSomewhereInCode = SomeNameSomewhereInLookupINIs
	VoiceCreate		 = CrusaderTankVoiceCreate
	VoiceEnter			 = CrusaderTankVoiceMove
	TurretMoveStart	 = NoSound
	TurretMoveLoop	  = TurretMoveLoop
	SoundEject		  = PilotSoundEject
	VoiceEject		  = PilotVoiceEject
	VoiceCrush		  = CrusaderTankVoiceCrush
  End

 &#59; *** ENGINEERING Parameters ***
  RadarPriority		  = UNIT
  KindOf				 = PRELOAD SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT CAN_CAST_REFLECTIONS VEHICLE SCORE
  
  Body				   = ActiveBody ModuleTag_02
	MaxHealth	   = 480
	InitialHealth   = 480

   &#59; Subdual damage "Subdues" you (reaction defined by BodyModule) when it passes your max health.
   &#59; The cap limits how extra-subdued you can be, and the other numbers detemine how fast it drains away on its own.
	SubdualDamageCap = 960
	SubdualDamageHealRate = 500
	SubdualDamageHealAmount = 50
  End

  Behavior = AIUpdateInterface ModuleTag_03
	Turret
	  TurretTurnRate	   = 180&#59;60   // turn rate, in degrees per sec
	  ControlledWeaponSlots= PRIMARY
	End
	AutoAcquireEnemiesWhenIdle = Yes
  End
  Locomotor			= SET_NORMAL CrusaderLocomotor
  Behavior = PhysicsBehavior ModuleTag_04
	Mass				 = 50.0
  End

  Behavior = ObjectCreationUpgrade ModuleTag_05
	UpgradeObject = OCL_AmericanBattleDrone
	TriggeredBy   = Upgrade_AmericaBattleDrone
	ConflictsWith = Upgrade_AmericaScoutDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_06
	UpgradeObject = OCL_AmericanScoutDrone
	TriggeredBy   = Upgrade_AmericaScoutDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_20
	UpgradeObject = OCL_AmericanHellfireDrone
	TriggeredBy   = Upgrade_AmericaHellfireDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaScoutDrone
  End
  Behavior = ProductionUpdate ModuleTag_07
	MaxQueueEntries = 1; So you can't build multiple upgrades in the same frame
  End

  Behavior = ExperienceScalarUpgrade ModuleTag_08
	TriggeredBy   = Upgrade_AmericaAdvancedTraining
	AddXPScalar   = 1.0&#59;Increases experience gained by an additional 100%
  End
  Behavior = MaxHealthUpgrade ModuleTag_09
	TriggeredBy   = Upgrade_AmericaCompositeArmor
	AddMaxHealth  = 100.0
	ChangeType	= ADD_CURRENT_HEALTH_TOO  &#59;Choices are PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, and SAME_CURRENTHEALTH
  End

 &#59; Turret fly off death
  Behavior = SlowDeathBehavior ModuleTag_10
	DeathTypes = ALL -CRUSHED -SPLATTED
	ProbabilityModifier  = 50
	DestructionDelay  = 500
	DestructionDelayVariance  = 100
	FX  = INITIAL  FX_GenericTankDeathEffect
	OCL = MIDPOINT OCL_GenericTankDeathEffect
	FX  = FINAL	FX_GenericTankDeathExplosion
	OCL = FINAL	OCL_CrusaderTurret
  End

 &#59; Catch fire, and explode death
  Behavior = SlowDeathBehavior ModuleTag_11
	DeathTypes = ALL -CRUSHED -SPLATTED
	ProbabilityModifier  = 50
	DestructionDelay  = 2000
	DestructionDelayVariance  = 300
	FX  = INITIAL  FX_CrusaderCatchFire
	OCL = FINAL	OCL_GenericTankDeathEffect  
	FX  = FINAL	FX_GenericTankDeathExplosion
  End

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

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

 &#59; A crushing defeat
  Behavior = FXListDie ModuleTag_14
	DeathTypes = NONE +CRUSHED +SPLATTED
	DeathFX = FX_CarCrush
  End

  Behavior = CreateObjectDie ModuleTag_15
	DeathTypes = NONE +CRUSHED +SPLATTED
	CreationList = OCL_CrusaderTank_CrushEffect
  End

  Behavior					= CreateCrateDie ModuleTag_CratesChange
   CrateData			 = SalvageCrateData
  &#59;CrateData			 = EliteTankCrateData
  &#59;CrateData			 = HeroicTankCrateData
  End

  Behavior = EjectPilotDie ModuleTag_17
	GroundCreationList = OCL_EjectPilotOnGround
	AirCreationList = OCL_EjectPilotViaParachute
	ExemptStatus = HIJACKED
	VeterancyLevels =  ALL -REGULAR&#59;only vet+ gives pilot
  End

  Behavior = MaxHealthUpgrade ModuleTag_18
	TriggeredBy   = Upgrade_AmericaCompositeArmor
	AddMaxHealth  = 100.0
	ChangeType	= ADD_CURRENT_HEALTH_TOO  &#59;Choices are PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, and SAME_CURRENTHEALTH
  End

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

  Geometry			   = BOX
  GeometryMajorRadius	= 15.0
  GeometryMinorRadius	= 10.0
  GeometryHeight		 = 10.0	 
  GeometryIsSmall		= Yes	
  Shadow = SHADOW_VOLUME
  ShadowSizeX = 45 &#59; minimum elevation angle above horizon. Used to limit shadow length

End


now that might seem mighty confusing, so lets try and split it up, so its easier to understand

first off the object is defined with the following
;------------------------------------------------------------------------------
Object AmericaTankCrusader

NOTE: the semi-colon followed by dashes is not part of the code, it is usally placed there to help coders easily find where one object starts and the other finishes
NOTE2: anything following a semi-colon(:) is a note and is there to give a description, and is not part of the code

The actual object is already split up into sections, the sections are headed with a semi-colon(:) followed by 3 stars, the name and a final 3 stars

the first we come across is the art paramters section

 &#59; *** ART Parameters ***
  SelectPortrait		 = SACLeopard_L
  ButtonImage			= SACLeopard
  
  UpgradeCameo1 = Upgrade_AmericaBattleDrone
  UpgradeCameo2 = Upgrade_AmericaScoutDrone
  UpgradeCameo3 = Upgrade_AmericaHellfireDrone
  UpgradeCameo4 = Upgrade_AmericaAdvancedTraining
  UpgradeCameo5 = Upgrade_AmericaCompositeArmor
  
  Draw = W3DTankDraw ModuleTag_01
	DefaultConditionState
	  Model			   = AVLeopard
	  Turret			  = Turret
	  WeaponFireFXBone	= PRIMARY TurretMS
	  WeaponRecoilBone	= PRIMARY Barrel
	  WeaponMuzzleFlash   = PRIMARY TurretFX
	  WeaponLaunchBone = PRIMARY TurretMS
	End
	ConditionState	   = REALLYDAMAGED
	  Model			  = AVLeopard_D
	End
	ConditionState	   = RUBBLE
	  Model			  = AVLeopard_D
	End

	TrackMarks		   = EXTnkTrack.tga
	TreadAnimationRate	  = 2.0 &#59; amount of tread texture to move per second
	TreadDriveSpeedFraction = 0.3 &#59; fraction of locomotor speed below which treads stop moving.
	TreadPivotSpeedFraction = 0.6 &#59; fraction of locomotor speed below which we allow pivoting.
	OkToChangeModelColor = Yes
  End


this section is used to define anything visual about the object, i will split this section up even more to give a more detailed description:
  SelectPortrait		 = SACLeopard_L
  ButtonImage			= SACLeopard

these two settings define the portrait (the large image you see in the bottom-right hand corner of a game, when you select the object and the button image, the image on the button you press to train the vehicle

  UpgradeCameo1 = Upgrade_AmericaBattleDrone
  UpgradeCameo2 = Upgrade_AmericaScoutDrone
  UpgradeCameo3 = Upgrade_AmericaHellfireDrone
  UpgradeCameo4 = Upgrade_AmericaAdvancedTraining
  UpgradeCameo5 = Upgrade_AmericaCompositeArmor


next are the upgrade cameos, these are the pictures that are placed around the edge of the portrait picture and IIRC, the positions are as follows
[ ] [ ] [1]
[ ] [ ] [2]
[5][4][3]

  Draw = W3DTankDraw ModuleTag_01
	DefaultConditionState
	  Model			   = AVLeopard
	  Turret			  = Turret
	  WeaponFireFXBone	= PRIMARY TurretMS
	  WeaponRecoilBone	= PRIMARY Barrel
	  WeaponMuzzleFlash   = PRIMARY TurretFX
	  WeaponLaunchBone = PRIMARY TurretMS
	End
	ConditionState	   = REALLYDAMAGED
	  Model			  = AVLeopard_D
	End
	ConditionState	   = RUBBLE
	  Model			  = AVLeopard_D
	End

next are the model properties
DefaultConditionState is exactly what it says, the default condition, when you buy a tank and it rolls out of the war factory, its in its default condition
'Model' defines the model, this model needs to be in the W3DZH.BIG
The next properties can either use parts of the model or bones on the model. In short bones, are positions in relation to the object, that can't be seen in-game, these tell the game where the shell should shoot from where the tracks appear from,etc. In most cases either can be used. WeaponMuzzleFlash, is the part of the object that should be hidden from view until that brief moment when the tank fires, a flame like object appears at the end of the barrel, that is the muzzle.

Next other condition states can be defined, usually they are just the damaged or dead condition states, but they can also include snow conditions (for example in shockwave, some vehicles on snow maps have special wheels, and therefore require a different model, or when a particaulr upgrade is purchased, a new model may need to be defined, or simply part of a model needs to be hidden/unhidden

the next section is the design paramter section

; ***DESIGN parameters ***
  DisplayName	  = OBJECT:Crusader
  Side				   = America
  EditorSorting		  = VEHICLE
  TransportSlotCount	 = 3
  WeaponSet
	Conditions		   = None 
	Weapon			   = PRIMARY CrusaderTankGun
   &#59; Uncomment this when we want the crusader to have a machine too again
   &#59;Weapon			   = SECONDARY CrusaderMachineGun
  End
  ArmorSet
	Conditions		   = None
	Armor				= TankArmor
	DamageFX			 = TankDamageFX
  End
 &#59;ArmorSet
 &#59;  Conditions		   = PLAYER_UPGRADE
 &#59;  Armor				= UpgradedTankArmor
 &#59;  DamageFX			 = TankDamageFX
 &#59;End
  BuildCost			  = 900
  BuildTime			  = 10.0		 &#59;in seconds	
  VisionRange			= 150
  ShroudClearingRange = 300
  Prerequisites
	Object = AmericaWarFactory
  End
  ExperienceValue		= 100 100 200 400&#59;Experience point value at each level
  ExperienceRequired	 = 0 200 300 600&#59;Experience points needed to gain each level
  IsTrainable			= Yes &#59;Can gain experience
  CrusherLevel		   = 2 &#59;What can I crush?: 1 = infantry, 2 = trees, 3 = vehicles
  CrushableLevel		 = 2 &#59;What am I?:		0 = for infantry, 1 = for trees, 2 = general vehicles
  CommandSet			 = AmericaTankCrusaderCommandSet


The display name field refers to the 'generals.csf' found in the englishzh.big, this file contains the names,descriptions,etc of every object in the game (well most), and the filed specified looks up the value in that file

'Side' is the side you want the object to be associated with

'EditorSorting' is the type of object, in this case it is a vehicle

'TransportSlotCount' is the number of spaces that the object takes up when in a transport vehilce

  WeaponSet
	Conditions		   = None 
	Weapon			   = PRIMARY CrusaderTankGun
   &#59; Uncomment this when we want the crusader to have a machine too again
   &#59;Weapon			   = SECONDARY CrusaderMachineGun
  End

weaponset is the section that specifies the type of weapon the object has

'conditions', similarly to the condition sate mentioned before, sets the condions for that weapon, when 'none' is specified the weaponset is the default weapon. One example of a condition that can be applied is an upgrade purchased. The start of the value need to specify which weapon it is (PRIMARY, SECONDARY or TERITARY) followed by a wepaon specified in the weapon.ini

  ArmorSet
	Conditions		   = None
	Armor				= TankArmor
	DamageFX			 = TankDamageFX
  End


ArmorSet follows the same format as the weaponset, except for thre vital deifferneces; 1) Only one armour can be specified at a time (i.e. there cant be a primary and a secondary), 2) DamageFX needs to be specified, this specifies the particles that are created when a weapon hits the object and 3) this specifies armour not weapons :)

and to finish off this section:

BuildCost = 900
BuildTime = 10.0 ;in seconds
VisionRange = 150
ShroudClearingRange = 300
Prerequisites
Object = AmericaWarFactory
End
ExperienceValue = 100 100 200 400 ;Experience point value at each level
ExperienceRequired = 0 200 300 600 ;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 = AmericaTankCrusaderCommandSet

'BuildCost' specifies the price of the object

'BuilTime' Specifies the time that the object takes to build/train

'VisionRange' specifies the how far the unit can see

'ShroudClearingRange' Specifies the amount of shroud the object clears

'Prerequisites' specifes any objects or sciences that need to be purchased before the object can be built/trained

'IsTrainable' specifies whether the object can be premoted or not

'CrusherLevel' specfies what the object can crush, most tanks specify a value of 2, which means they can crush trees and infantry, heavier tanks, such as the overlord may specify 3, which me they can crush all smaller tanks, trees and infantry

'CrushableLevel' specfies where it is on the food chain, most of the time if its a tank, its a 2, if its an infantry its a 0, however there are exceptions, such as hero units, they cannot be crushed, and have a value of 2

and finally 'CommandSet', this specifies the command set that the object uses. (ingame) When you click on an object, a set of commands come up on the command bar, most tanks usally only have stop, guard and attack move, but other commands can be added, like switchable wepaons, or purchasing upgrades

thats is the end of the design section, now on to the sound paramters

 &#59; *** AUDIO Parameters ***
  VoiceSelect		   = CrusaderTankVoiceSelect
  VoiceMove			 = CrusaderTankVoiceMove
  VoiceGuard			= CrusaderTankVoiceMove
  VoiceAttack		   = CrusaderTankVoiceAttack
  SoundMoveStart		= CrusaderTankMoveStart
  SoundMoveStartDamaged = CrusaderTankMoveStart
  UnitSpecificSounds
   &#59; These have the syntax of SomeNameSomewhereInCode = SomeNameSomewhereInLookupINIs
	VoiceCreate		 = CrusaderTankVoiceCreate
	VoiceEnter			 = CrusaderTankVoiceMove
	TurretMoveStart	 = NoSound
	TurretMoveLoop	  = TurretMoveLoop
	SoundEject		  = PilotSoundEject
	VoiceEject		  = PilotVoiceEject
	VoiceCrush		  = CrusaderTankVoiceCrush
  End


these are pretty self-explantry, so i won't go into any detail, but each one of these specifies a (specific set of) sound(s), that is triggered by a specific action, for example, voice select is the sound that you hear when you select the unit, these usaully have more than one voice so a random voice is selected, but (for example) soundeject, only has one sound and will play that specific sound when that event happens

The next section is the engineering section
; *** ENGINEERING Parameters ***
  RadarPriority		  = UNIT
  KindOf				 = PRELOAD SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT CAN_CAST_REFLECTIONS VEHICLE SCORE
  
  Body				   = ActiveBody ModuleTag_02
	MaxHealth	   = 480
	InitialHealth   = 480

   &#59; Subdual damage "Subdues" you (reaction defined by BodyModule) when it passes your max health.
   &#59; The cap limits how extra-subdued you can be, and the other numbers detemine how fast it drains away on its own.
	SubdualDamageCap = 960
	SubdualDamageHealRate = 500
	SubdualDamageHealAmount = 50
  End

  Behavior = AIUpdateInterface ModuleTag_03
	Turret
	  TurretTurnRate	   = 180&#59;60   // turn rate, in degrees per sec
	  ControlledWeaponSlots= PRIMARY
	End
	AutoAcquireEnemiesWhenIdle = Yes
  End
  Locomotor			= SET_NORMAL CrusaderLocomotor
  Behavior = PhysicsBehavior ModuleTag_04
	Mass				 = 50.0
  End

  Behavior = ObjectCreationUpgrade ModuleTag_05
	UpgradeObject = OCL_AmericanBattleDrone
	TriggeredBy   = Upgrade_AmericaBattleDrone
	ConflictsWith = Upgrade_AmericaScoutDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_06
	UpgradeObject = OCL_AmericanScoutDrone
	TriggeredBy   = Upgrade_AmericaScoutDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_20
	UpgradeObject = OCL_AmericanHellfireDrone
	TriggeredBy   = Upgrade_AmericaHellfireDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaScoutDrone
  End
  Behavior = ProductionUpdate ModuleTag_07
	MaxQueueEntries = 1; So you can't build multiple upgrades in the same frame
  End

  Behavior = ExperienceScalarUpgrade ModuleTag_08
	TriggeredBy   = Upgrade_AmericaAdvancedTraining
	AddXPScalar   = 1.0&#59;Increases experience gained by an additional 100%
  End
  Behavior = MaxHealthUpgrade ModuleTag_09
	TriggeredBy   = Upgrade_AmericaCompositeArmor
	AddMaxHealth  = 100.0
	ChangeType	= ADD_CURRENT_HEALTH_TOO  &#59;Choices are PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, and SAME_CURRENTHEALTH
  End

 &#59; Turret fly off death
  Behavior = SlowDeathBehavior ModuleTag_10
	DeathTypes = ALL -CRUSHED -SPLATTED
	ProbabilityModifier  = 50
	DestructionDelay  = 500
	DestructionDelayVariance  = 100
	FX  = INITIAL  FX_GenericTankDeathEffect
	OCL = MIDPOINT OCL_GenericTankDeathEffect
	FX  = FINAL	FX_GenericTankDeathExplosion
	OCL = FINAL	OCL_CrusaderTurret
  End

 &#59; Catch fire, and explode death
  Behavior = SlowDeathBehavior ModuleTag_11
	DeathTypes = ALL -CRUSHED -SPLATTED
	ProbabilityModifier  = 50
	DestructionDelay  = 2000
	DestructionDelayVariance  = 300
	FX  = INITIAL  FX_CrusaderCatchFire
	OCL = FINAL	OCL_GenericTankDeathEffect  
	FX  = FINAL	FX_GenericTankDeathExplosion
  End

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

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

 &#59; A crushing defeat
  Behavior = FXListDie ModuleTag_14
	DeathTypes = NONE +CRUSHED +SPLATTED
	DeathFX = FX_CarCrush
  End

  Behavior = CreateObjectDie ModuleTag_15
	DeathTypes = NONE +CRUSHED +SPLATTED
	CreationList = OCL_CrusaderTank_CrushEffect
  End

  Behavior					= CreateCrateDie ModuleTag_CratesChange
   CrateData			 = SalvageCrateData
  &#59;CrateData			 = EliteTankCrateData
  &#59;CrateData			 = HeroicTankCrateData
  End

  Behavior = EjectPilotDie ModuleTag_17
	GroundCreationList = OCL_EjectPilotOnGround
	AirCreationList = OCL_EjectPilotViaParachute
	ExemptStatus = HIJACKED
	VeterancyLevels =  ALL -REGULAR&#59;only vet+ gives pilot
  End

  Behavior = MaxHealthUpgrade ModuleTag_18
	TriggeredBy   = Upgrade_AmericaCompositeArmor
	AddMaxHealth  = 100.0
	ChangeType	= ADD_CURRENT_HEALTH_TOO  &#59;Choices are PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, and SAME_CURRENTHEALTH
  End

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

  Geometry			   = BOX
  GeometryMajorRadius	= 15.0
  GeometryMinorRadius	= 10.0
  GeometryHeight		 = 10.0	 
  GeometryIsSmall		= Yes	
  Shadow = SHADOW_VOLUME
  ShadowSizeX = 45 &#59; minimum elevation angle above horizon. Used to limit shadow length


and this is the section that i know the least about and i usually just leave it alone :), but from what i can gather this section specifes how the object intracts with the surroundings, as well as specific types of death

i will try and explain the parts i do know, although these are quite basic and probably easy enough to figure out by yourself anyway :)
	MaxHealth	   = 480
	InitialHealth   = 480

'MaxHealth' Specifies the maximum helath the unit can obtain
'InitialHealth' Specfies the health the unit comes with when built, this is usaully kept the same as the max health

	Behavior = AIUpdateInterface ModuleTag_03
	Turret
	  TurretTurnRate	   = 180&#59;60   // turn rate, in degrees per sec
	  ControlledWeaponSlots= PRIMARY
	End
	AutoAcquireEnemiesWhenIdle = Yes
  End
  Locomotor			= SET_NORMAL CrusaderLocomotor
  Behavior = PhysicsBehavior ModuleTag_04
	Mass				 = 50.0
  End


'TurretTurnRate' specifies how the maximum angle the turret can turn in a second

'AutoAcquiteEnemiesWhenIdle' specifies whether the object aquries enemy positions when idle or not (can't explain this very well :lol:)

'Locomotor' Specifes a locomotor located in the locomotor.ini, this tells the game how the object moves, for example how fast, or whether the object uses wheels or tank treads and how many of them

'Mass' is exactly what is says on the tin, how heavy it is, and how it reacts to explosions, etc.

  Behavior = ObjectCreationUpgrade ModuleTag_05
	UpgradeObject = OCL_AmericanBattleDrone
	TriggeredBy   = Upgrade_AmericaBattleDrone
	ConflictsWith = Upgrade_AmericaScoutDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_06
	UpgradeObject = OCL_AmericanScoutDrone
	TriggeredBy   = Upgrade_AmericaScoutDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaHellfireDrone
  End
  Behavior = ObjectCreationUpgrade ModuleTag_20
	UpgradeObject = OCL_AmericanHellfireDrone
	TriggeredBy   = Upgrade_AmericaHellfireDrone
	ConflictsWith = Upgrade_AmericaBattleDrone Upgrade_AmericaScoutDrone
  End
  Behavior = ProductionUpdate ModuleTag_07
	MaxQueueEntries = 1; So you can't build multiple upgrades in the same frame
  End


In this case, this part specifies the building of the drones for USA tanks, you should be able to see that the firs three moduleTags are the three drones that can be built

'UpgradeObject' Specifes an OCL

'TriggeredBy' why this OCL happens, in this case it is triggered by an upgrade

'ConflictsWith' this specfies what the upgrade can't be built with, in this case, only one drone should be able to be built, so the two confilicting upgrades are the other two upgrades (the one not specifed in that ModuleTag)

The final module tag specfies how many things you can purchase at once, in this case it is one, meaning only one can be baught, because there is no other option (you either understand or you don't, i can't think of a way of explaining better)

  Behavior = ExperienceScalarUpgrade ModuleTag_08
	TriggeredBy   = Upgrade_AmericaAdvancedTraining
	AddXPScalar   = 1.0&#59;Increases experience gained by an additional 100%
  End
  Behavior = MaxHealthUpgrade ModuleTag_09
	TriggeredBy   = Upgrade_AmericaCompositeArmor
	AddMaxHealth  = 100.0
	ChangeType	= ADD_CURRENT_HEALTH_TOO  &#59;Choices are PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, and SAME_CURRENTHEALTH
  End


The first ModuleTag is 'triggered by' an upgrade (Upgrade_AmericaAdvancedTraining), which if you have played the game, you should know increases the amount of expericned gained, so thee 'AddXPScalar' changes the amount gained, in this case '1.0' means a 100% increase in experience gained

the next modula tag is triggered by an upgrade (Upgrade_AmericaCompositeArmor) which increases the maximum health (AddMaxHealth adds the specifed number to the max health)

 &#59; Turret fly off death
  Behavior = SlowDeathBehavior ModuleTag_10
	DeathTypes = ALL -CRUSHED -SPLATTED
	ProbabilityModifier  = 50
	DestructionDelay  = 500
	DestructionDelayVariance  = 100
	FX  = INITIAL  FX_GenericTankDeathEffect
	OCL = MIDPOINT OCL_GenericTankDeathEffect
	FX  = FINAL	FX_GenericTankDeathExplosion
	OCL = FINAL	OCL_CrusaderTurret
  End

 &#59; Catch fire, and explode death
  Behavior = SlowDeathBehavior ModuleTag_11
	DeathTypes = ALL -CRUSHED -SPLATTED
	ProbabilityModifier  = 50
	DestructionDelay  = 2000
	DestructionDelayVariance  = 300
	FX  = INITIAL  FX_CrusaderCatchFire
	OCL = FINAL	OCL_GenericTankDeathEffect  
	FX  = FINAL	FX_GenericTankDeathExplosion
  End

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

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

 &#59; A crushing defeat
  Behavior = FXListDie ModuleTag_14
	DeathTypes = NONE +CRUSHED +SPLATTED
	DeathFX = FX_CarCrush
  End

  Behavior = CreateObjectDie ModuleTag_15
	DeathTypes = NONE +CRUSHED +SPLATTED
	CreationList = OCL_CrusaderTank_CrushEffect
  End

  Behavior					= CreateCrateDie ModuleTag_CratesChange
   CrateData			 = SalvageCrateData
  &#59;CrateData			 = EliteTankCrateData
  &#59;CrateData			 = HeroicTankCrateData
  End

  Behavior = EjectPilotDie ModuleTag_17
	GroundCreationList = OCL_EjectPilotOnGround
	AirCreationList = OCL_EjectPilotViaParachute
	ExemptStatus = HIJACKED
	VeterancyLevels =  ALL -REGULAR&#59;only vet+ gives pilot
  End

  Behavior = MaxHealthUpgrade ModuleTag_18
	TriggeredBy   = Upgrade_AmericaCompositeArmor
	AddMaxHealth  = 100.0
	ChangeType	= ADD_CURRENT_HEALTH_TOO  &#59;Choices are PRESERVE_RATIO, ADD_CURRENT_HEALTH_TOO, and SAME_CURRENTHEALTH
  End

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


these specify different types of deaths a tank can go through, i am not going into detail ,because i will only be assuming :), but you can pretty much get the jist of things, when a certain death happens, an OCL is triggered (i.e. an event happens)

and finally the final bit (what a coinsidence :) )

  Geometry			   = BOX
  GeometryMajorRadius	= 15.0
  GeometryMinorRadius	= 10.0
  GeometryHeight		 = 10.0	 
  GeometryIsSmall		= Yes	
  Shadow = SHADOW_VOLUME
  ShadowSizeX = 45 &#59; minimum elevation angle above horizon. Used to limit shadow length


'Geometry' specifies the type of collision, in this case 'box' is specfied, imagine an invisible box is created around the object, this box can be used to calculate collisions, using boxs for collisions is much easier than using real shape collision as it takes much more time to calculate. NOTE: i'm not sure if you can actually specify anything else, i don't think i have seen anything else used

and i'm not entirely sure on how the next values work, but they basically specify how large the object is, so the box is neither too big, not too small

well that was my first tutorial, i hope you enjoyed it, and actually learnt something, i know it was amazing and i missed some parts out, but well, no-ones perfect. I also haven't checked spelling/grammar because i cn't be bothered, fell free to ask questions :)

thankyou for your time and goodbye :)

bob signing out :)
Posted Image
F O R T H E N S
Posted Image

#2 Jordan

    Crazy Modder

  • Gold Member
  • 2704 posts
  • Projects: C&C Crazy Mod Leader

Posted 30 October 2006 - 20:48

This is quite a good tutorial.

Just some notes:

With crusher and crushable levels, you can go as high as you want. You could have a level 5 crushing a level 3.

Also, heroes can be crushed by overlords.
C&C Crazy Mod Version 0.55
^^^^The True Crazy Mod Starts Here^^^^
Posted Image

#3 Slightly Wonky Robob

    Not a Wonky Gent.

  • Administrator
  • 9337 posts

Posted 30 October 2006 - 21:08

oh right never new that, that might come in handy sometime :)

and thanks for the feedback :)
Posted Image
F O R T H E N S
Posted Image

#4 Futschki

    Duh!

  • Member
  • 2835 posts

Posted 03 November 2006 - 16:58

Very Great Work And Helpful Tutorial ...
Posted Image

#5 Crazykenny

    Eternal Glow

  • Project Team
  • 7683 posts

Posted 03 November 2006 - 17:22

Indeed, very helpfull. A friend of my learned allot fro this :D
Posted Image

#6 Kris

    <Custom title available>

  • Project Team
  • 3825 posts

Posted 03 November 2006 - 18:00

;----------------------------------------------

Behavior = EjectPilotDie ModuleTag_17
	GroundCreationList = OCL_EjectPilotOnGround
	AirCreationList = OCL_EjectPilotViaParachute
	ExemptStatus = HIJACKED
	VeterancyLevels =  ALL -REGULAR;only vet+ gives pilot
  End


This module allows use of SoundEject and VoiceEject within UnitSpecificSounds section of the object
"GroundCreationList" and "AirCreationList" are self explainatory........KINDA >.>
"ExemptStatus" What status needs to be ignored so the module will not eject the pilot? sofar we have "HIJACKED" so when the hijacked vehicle (with a rank) dies, it will not spawn the Pilot.
"VeterancyLevels" -what kind of rank object needs before it ejects the pilot?
Rank list:

REGULAR
VETERAN
ELITE
HEROIC


  Behavior					= CreateCrateDie ModuleTag_CratesChange
   CrateData			 = SalvageCrateData&#59; independant CrateData listings will each produce a maximum of one crate, must be defined in Crate.ini
  End

This module is triggered when killed by a salvager unit (EG: the gla), The Crate should be defined in Crate.ini, see some crates there to see how the crate system works.


  Body				   = ActiveBody ModuleTag_XX
	MaxHealth	   = 480
	InitialHealth   = 480

&#59; Subdual damage &#34;Subdues&#34; you &#40;reaction defined by BodyModule&#41; when it passes your max health.
&#59; The cap limits how extra-subdued you can be, and the other numbers detemine how fast it drains away on its own.
	SubdualDamageCap = 960
	SubdualDamageHealRate = 500
	SubdualDamageHealAmount = 50
  End


'MaxHealth' Specifies the maximum health the unit can obtain, needs a bit higher values in order to get the "MaxHealthUpgrade" module to "properly" work.
'InitialHealth' Specfies the health the unit comes with when built.

The Subdual Code is triggered when a certain weapon uses a subdual weapon, see microwave tank as an example since it "disables" defence structures using a weapon using a Subdual damage type.

  Behavior = PhysicsBehavior ModuleTag_04
	Mass				 = 50.0
  End

Defines how the object interact with the game world.
"Mass" defines how heavy the object ingame, 0.0 mass will cause the game to crash.
NOTE: Theres more but limited tags can be used but i will not lift my ass to get the complete list :D

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


The "Geometry" tag have 3 options,

BOX
SPHERE
CYLINDER

"GeometryMajorRadius" - Defines the Collision's Lenght (eg: how long the object)
"GeometryMinorRadius" - Defines the collision's width (eg. how wide the object is)
"GeometryHeight" -Defines the height of the collision.
"GeometryIsSmall" - Self Explainatory.
"Shadow" - Defines what kind of shadow the obect can have (cant recall the shadow types)
"ShadowSizeX" -comments says all.


.....errr ok enough :D anyways...good tutorial bob :D

And yeah....heres a "somewhat" complete Module list :D

Clicky

Edited by Chris, 03 November 2006 - 18:11.








#7 MLRS

    Raining heavy metal!

  • Banned
  • 858 posts

Posted 20 November 2006 - 02:30

I think this will help me a lot :D
Posted Image



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users