Jump to content


DaedraWarrior

Member Since 13 Jun 2018
Offline Last Active May 12 2021 05:15 PM

Topics I've Started

Unit special powers doesn't work

21 July 2020 - 05:58 PM

Hey everyone!

I created new unit for Men faction, based on the Angmar Dark Dunedain. Everything works fine except of charge attack. Somehow it's icon inactive, and I can't use this ability. I faced same issue with few other units and their abilities and don't know how to fix it. Here are the codes for both unit and horde:

 

Unit code

Object CityCohortTwohander
	// *** ART Parameters ***

	SelectPortrait         = UPCityCohortTH
	ButtonImage         = BGBarracks_CityCohortTH

	Draw = W3DHordeModelDraw ModuleTag_01
		OkToChangeModelColor = Yes	
		StaticModelLODMode = Yes
		
		// specify options for static LODs
		LodOptions							= LOW
			AllowMultipleModels				= ALLOW_MULTIPLE_MODELS_LOW
			MaxRandomTextures				= MAX_RANDOM_TEXTURES_LOW
			MaxRandomAnimations				= MAX_RANDOM_ANIMATIONS_LOW
			MaxAnimFrameDelta				= MAX_ANIM_FRAME_DELTA_LOW
		End
		
		LodOptions							= MEDIUM
			AllowMultipleModels				= ALLOW_MULTIPLE_MODELS_MED
			MaxRandomTextures				= MAX_RANDOM_TEXTURES_MED
			MaxRandomAnimations				= MAX_RANDOM_ANIMATIONS_MED
			MaxAnimFrameDelta				= MAX_ANIM_FRAME_DELTA_MED
		End
		
		LodOptions							= HIGH
			AllowMultipleModels				= ALLOW_MULTIPLE_MODELS_HIGH
			MaxRandomTextures				= MAX_RANDOM_TEXTURES_HIGH
			MaxRandomAnimations				= MAX_RANDOM_ANIMATIONS_HIGH
			MaxAnimFrameDelta				= MAX_ANIM_FRAME_DELTA_HIGH
		End

		WadingParticleSys = WaterRipplesTrail  // used when the unit is wading in shallow water.
//================ MODELS =================================================================
		DefaultModelConditionState
			Model							= guccthr_skn
			Skeleton						= KUDrkDun_SKL
		End

		ModelConditionState WEAPONSET_PLAYER_UPGRADE
			Model							= guccthr_skn
			Skeleton						= KUDrkDun_SKL
		End
		

//=============== ANIMATIONS ===============================================================

//======= FALLING & FLYING

		AnimationState						= PASSENGER
			Animation						= Grabbed
				AnimationName				= KUDrkDun_FLYA
				AnimationMode				= LOOP
			End
		End
		
		AnimationState        				= THROWN_PROJECTILE
			Animation           			= FlyA
				AnimationName      	 		= KUDrkDun_FLYA
				AnimationMode       		= LOOP
			End
		End
		
		AnimationState						= FREEFALL
			Animation						= Falling
				AnimationName				= KUDrkDun_FLYA
				AnimationMode				= LOOP
				AnimationBlendTime			= 10
			End
			Animation						= Falling
				AnimationName				= KUDrkDun_FLYA
				AnimationMode				= LOOP
				AnimationBlendTime			= 10
				AnimationSpeedFactorRange	= 0.5	0.5
			End
		End

		
		
		AnimationState        				= STUNNED_FLAILING 
			Animation           			= FlyA
				AnimationName       		= KUDrkDun_FLYA
				AnimationMode       		= LOOP
				AnimationSpeedFactorRange	= 0.4 0.6
			End
		End

		AnimationState						= DYING BURNINGDEATH
			Animation ;,;
				AnimationName				= KUDrkDun_DIEA
				AnimationMode				= ONCE
				AnimationBlendTime			= 10
			End
			Animation
				AnimationName				= KUDrkDun_DIEB
				AnimationMode				= ONCE
				AnimationBlendTime			= 10
			End
			Animation
				AnimationName				= KUDrkDun_DIEC
				AnimationMode				= ONCE
				AnimationBlendTime			= 10
			End
			Animation
				AnimationName				= KUDrkDun_DIED
				AnimationMode				= ONCE
				AnimationBlendTime			= 10
			End
			Animation
				AnimationName				= KUDrkDun_DIEE
				AnimationMode				= ONCE
				AnimationBlendTime			= 10
			End
		End
		AnimationState 						= DYING SPLATTED
			Animation 						= Splatted_On_Ground
				AnimationName 				= KUDrkDun_LNDA
				AnimationMode 				= ONCE
			End
			EnteringStateFX					= FX_OrcHitGround
		End
		;,;AnimationState						= DYING AFLAME
		;,;	Animation						= MFDA
		;,;		AnimationName				= KUDrkDun_MFDA
		;,;		AnimationMode				= LOOP
		;,;	End
		;,;End
		AnimationState						= DYING
			Animation						= DIEA	;,;
				AnimationName				= KUDrkDun_DIEA
				AnimationMode				= ONCE
			End
			Animation						= DIEB
				AnimationName				= KUDrkDun_DIEB
				AnimationMode				= ONCE
			End
			Animation						= DIEC
				AnimationName				= KUDrkDun_DIEC
				AnimationMode				= ONCE
			End
			Animation						= DIED
				AnimationName				= KUDrkDun_DIED
				AnimationMode				= ONCE
			End
			Animation						= DIEE
				AnimationName				= KUDrkDun_DIEE
				AnimationMode				= ONCE
			End
		End

		AnimationState						= BURNINGDEATH
			Animation
				AnimationName				= KUDrkDun_MFDA
				AnimationMode				= LOOP
				Distance					= 50
			End
		End

		AnimationState						= PARALYZED
			Animation
				AnimationName				= KUDrkDun_IDLB
				AnimationMode				= LOOP
			End
		End

//======= LANDING & STANDING

		AnimationState						= STUNNED_STANDING_UP
			Animation						= GTPA
				AnimationName				= KUDrkDun_GTPA
				AnimationMode				= ONCE
				AnimationSpeedFactorRange	= 2.0 2.0
			End
			Animation						= GTPB
				AnimationName				= KUDrkDun_GTPA
				AnimationMode				= ONCE
				AnimationSpeedFactorRange	= 2.0 2.0
			End
		End


	
		AnimationState			=	 STUNNED
			Animation			=	 Slatted_On_Ground
			AnimationName 				= KUDrkDun_LNDA
				AnimationMode 				= ONCE
			End
			EnteringStateFX					= FX_OrcHitGround

       End 
       
		AnimationState        = MOVING FIRING_OR_PREATTACK_A
			ShareAnimation		= Yes
			Animation           = RunAndFire
				AnimationName       = KUDrkDun_RUNC ;,; GUMAArms_SKL.GUManMocap_ATRA
				AnimationMode       = LOOP
			End
			Flags               = RANDOMSTART  
		End
		
//====== TERROR
		
		AnimationState						= MOVING EMOTION_TERROR EMOTION_LOOK_TO_SKY
			//@@@KM Add distance
			Animation					= TerrorFromTheSky
				AnimationName			= KUDrkDun_RUND
				AnimationMode			= LOOP
			End
			Animation					= TerrorFromTheSky
				AnimationName			= KUDrkDun_RUNE
				AnimationMode			= LOOP
			End
			Flags = RANDOMSTART
		End
		AnimationState						= MOVING EMOTION_TERROR
			//@@@KM Add distance
			Animation						= TerrorFromTheSky
				AnimationName				= KUDrkDun_RUND
				AnimationMode				= ONCE
			End
			Animation						= TerrorFromTheSky
				AnimationName				= KUDrkDun_RUNE
				AnimationMode				= ONCE
			End
			Flags							= RESTART_ANIM_WHEN_COMPLETE
		End
		
//======= BACK UP
		
		AnimationState						= MOVING BACKING_UP
			//@@@KM Add distance
			Animation						= BAKA
				AnimationName				= KUDrkDun_BAKA
				AnimationMode				= LOOP
			End
			Animation						= BAKB ;,;
				AnimationName				= KUDrkDun_BAKB
				AnimationMode				= LOOP
			End
			Flags = RANDOMSTART
		End

		AnimationState						= MOVING PANICKING
			//@@@KM - Add Distance
			Animation						= MFDA
				AnimationName				= KUDrkDun_MFDA
				AnimationMode				= LOOP
			End
			Flags							= RANDOMSTART
			//ParticleSysBone				= None InfantryDustTrails
		End
		
		AnimationState						= MOVING ATTACKING
			ShareAnimation					= Yes//
			Animation					= RUNC
				AnimationName				= KUDrkDun_RUNC
				AnimationMode				= LOOP
				;,;Distance				= 55
			End
			Animation					= RUND
				AnimationName				= KUDrkDun_RUND
				AnimationMode				= LOOP
				;,;Distance				= 55
			End
			Flags						= RANDOMSTART
			//ParticleSysBone				= None InfantryDustTrails
		End
		
		;,;AnimationState				= MOVING ALTERNATE_FORMATION
		;,;	Animation
		;,;		AnimationName				= GUMAArms_SKL.GUMAArms_SPCA
		;,;		AnimationMode				= LOOP
		;,;		Distance					= 20
		;,;	End
		;,;	Flags							= RANDOMSTART
		;,;End

		
		AnimationState						= MOVING
			//@@@KM - Add Distance
			ShareAnimation					= Yes//
			Animation						= RUNA
				AnimationName				= KUDrkDun_RUNA
				AnimationMode				= LOOP
				;,;Distance					= 30
			End
			Animation						= RUNB
				AnimationName				= KUDrkDun_RUNB
				AnimationMode				= LOOP
				;,;Distance					= 30
			End
			Flags							= RANDOMSTART
			//ParticleSysBone				= None InfantryDustTrails
		End
//======= UNCONTROLLABLY AFRAID
	// This is before Attacking so it overrides it.  Normal fear is below so you don't go to little-fear in between swings.
		AnimationState						= EMOTION_UNCONTROLLABLY_AFRAID
			Animation						= FERA
				AnimationName				= KUDrkDun_FERA
				AnimationMode				= LOOP
			End 
		End
//---------------------- ATTACKING ----------------------------------------------------------------
		AnimationState						= FIRING_OR_PREATTACK_A
			Animation						= ATA1
				AnimationName				= KUDrkDun_ATKA
				AnimationMode				= ONCE
				UseWeaponTiming				= Yes
			End
			Animation						= ATA2
				AnimationName				= KUDrkDun_ATKB
				AnimationMode				= ONCE
				UseWeaponTiming				= Yes
			End
			Animation						= ATA3
				AnimationName				= KUDrkDun_ATKC
				AnimationMode				= ONCE
				UseWeaponTiming				= Yes
			End
;			Flags							= RANDOMSTART
			//ParticleSysBone				= None MeleeDust
		End
		
		;AnimationState						= ATTACKING
		;	Animation						= ALERT_1
		;		AnimationName				= GUManMocap_IDLA
		;		AnimationMode				= LOOP
		;	End
		;End
//----------------- HIT REACTIONS -------------------------------------------------------------------------

		AnimationState						= HIT_REACTION
			Animation						= HITA ;,; 
				AnimationName				= KUDrkDun_HITA ;,; GUManMocap_HITA
				AnimationMode				= ONCE
			End
		End
;			Animation						= HITB
;				AnimationName				= GUManMocap_HITB
;				AnimationMode				= ONCE
;			End
;		End

//----------------- EMOTIONS ----------------------------------------------------------------
//======= APPREHENSIVE dark dun dont have anims for this and this emotion is unused
;,;
;,;		AnimationState						= EMOTION_ALERT EMOTION_AFRAID
;,;			Animation						= APPA
;,;				AnimationName				= GUMAArms_SKL.GUManMocap_APPA
;,;				AnimationMode				= ONCE
;,;			End
;,;			Animation						= APPB
;,;				AnimationName				= GUMAArms_SKL.GUManMocap_APPB
;,;				AnimationMode				= ONCE
;,;			End
;,;			Flags							= RANDOMSTART RESTART_ANIM_WHEN_COMPLETE
;,;		End
;,;		
//======= AFRAID

		AnimationState						= EMOTION_AFRAID
			Animation						= FERA
				AnimationName				= KUDrkDun_FERA
				AnimationMode				= LOOP
			End 
			Flags							= RANDOMSTART
		End
		
//======== POINTING

		AnimationState						= EMOTION_POINTING
			Animation						= Pointing1
				AnimationName				= KUDrkDun_PNTA
				AnimationMode				= LOOP
			End
			Animation						= Pointing1 ;,;
				AnimationName				= KUDrkDun_PNTB
				AnimationMode				= LOOP
			End
			Flags							= RANDOMSTART
		End
		
//======= TAUNTING

		AnimationState						= EMOTION_TAUNTING
			Animation						= Taunting1
				AnimationName				= KUDrkDun_TNTA
				AnimationMode				= ONCE
			End
			Animation						= Taunting2
				AnimationName				= KUDrkDun_TNTB
				AnimationMode				= ONCE
			End
			Animation						= Taunting3
				AnimationName				= KUDrkDun_TNTC
				AnimationMode				= ONCE
			End
			;,;Animation						= Taunting4
			;,;	AnimationName				= KUDrkDun_IDLC
			;,;	AnimationMode				= ONCE
			;,;End
			;,;Animation						= Taunting5
			;,;	AnimationName				= KUDrkDun_IDLA
			;,;	AnimationMode				= ONCE
			;,;End
			;,;Animation						= Taunting6
			;,;	AnimationName				= KUDrkDun_IDLH
			;,;	AnimationMode				= ONCE
			;,;End
			Flags							= RANDOMSTART RESTART_ANIM_WHEN_COMPLETE
		End

//======= CELEBRATING

		AnimationState						= EMOTION_CELEBRATING
			Animation						= CHRA ;,;
				AnimationName				= KUDrkDun_CHRA
				AnimationMode				= ONCE
			End
			Animation						= CHRB
				AnimationName				= KUDrkDun_CHRB
				AnimationMode				= ONCE
			End
			Animation						= CHRC
				AnimationName				= KUDrkDun_CHRC
				AnimationMode				= ONCE
			End
			;,;Animation						= IDLD
			;,;	AnimationName				= KUDrkDun_IDLD
			;,;	AnimationMode				= ONCE
			;,;End
			Flags							=	RESTART_ANIM_WHEN_COMPLETE
		End

//----------------- ALERT STATE ---------------------------------------------------------------------------

		AnimationState						= ATTACKING
			Animation						= ALERT_1
				AnimationName				= KUDrkDun_IDLA
				AnimationMode				= LOOP
			End
		End	

		AnimationState						= EMOTION_ALERT
			Animation						= ALERT_1
				AnimationName				= KUDrkDun_IDLA
				AnimationMode				= LOOP//ONCE
				AnimationPriority			= 10
			End
			Flags							= RESTART_ANIM_WHEN_COMPLETE // acts like an idle animation & keeps running the animations.
		End
		
		AnimationState						= RAISING_FLAG
			Animation						= CHRA ;,;
				AnimationName				= KUDrkDun_CHRA
				AnimationMode				= ONCE
				AnimationSpeedFactorRange	= 0.9 1.1
			End
			Animation						= CHRB
				AnimationName				= KUDrkDun_CHRB
				AnimationMode				= ONCE
				AnimationSpeedFactorRange	= 0.9 1.1
			End
			Animation						= CHRC
				AnimationName				= KUDrkDun_CHRC
				AnimationMode				= ONCE
				AnimationSpeedFactorRange	= 0.9 1.1
			End
			Flags							=	RESTART_ANIM_WHEN_COMPLETE
		End
		
//----------------- SELECTED STATES -----------------------------------------------------------------------
		AnimationState        = SELECTED
			StateName           = STATE_Selected
			Animation           = ATNB
				AnimationName     = KUDrkDun_ATNB
				AnimationMode     = LOOP
			End
			
			BeginScript
				Prev = CurDrawablePrevAnimationState()
				if Prev == "STATE_Idle" 
				then 
					CurDrawableSetTransitionAnimState("TRANS_IdleToSelected") 
				end
				if CurDrawableModelcondition("ATTACKING")
				then
					return "IDLA"
				else
					return "ATNA"
				end
			EndScript
			
			BeginScript
				Prev = CurDrawablePrevAnimationState()
				if Prev == "STATE_Idle" then CurDrawableSetTransitionAnimState("TRANS_IdleToSelected") end
			EndScript
		End
		
//----------------- IDLE STATES ---------------------------------------------------------------------------
		AnimationState				= WEAPONSET_PLAYER_UPGRADE
			StateName				= STATE_Idle
			Animation				
				AnimationName       = KUDrkDun_IDLE
				AnimationMode       = ONCE
				AnimationSpeedFactorRange = 0.9 1.1
			End
			Animation				
				AnimationName       = KUDrkDun_IDLD
				AnimationMode       = ONCE
				AnimationSpeedFactorRange = 0.9 1.1
			End
			Animation				
				AnimationName       = KUDrkDun_IDLE
				AnimationMode       = ONCE
				AnimationSpeedFactorRange = 0.9 1.1
			End
			Animation				
				AnimationName       = KUDrkDun_CHRB
				AnimationMode       = ONCE
				AnimationSpeedFactorRange = 0.9 1.1
			End
			Animation				
				AnimationName       = KUDrkDun_CHRC
				AnimationMode       = ONCE
				AnimationSpeedFactorRange = 0.9 1.1
			End
			Flags					= RESTART_ANIM_WHEN_COMPLETE			
			BeginScript
				Prev = CurDrawablePrevAnimationState()
				if Prev == "STATE_Selected" then CurDrawableSetTransitionAnimState("TRANS_SelectedToIdle") end
			EndScript
		End		
		AnimationState				= USER_3
			StateName				= STATE_User_3
			Animation				= GUARD_STANCE
				AnimationName		= KUDrkDun_IDLA
				AnimationMode		= LOOP
			End
		End
		IdleAnimationState
			StateName				= STATE_Idle
			Animation				= IDLB
				AnimationName       = KUDrkDun_IDLB
				AnimationMode       = ONCE
				AnimationPriority   = 1
				AnimationSpeedFactorRange = 0.9 1.1
				AnimationBlendTime	= 15
			End
			Animation				= IDLC
				AnimationName       = KUDrkDun_IDLC
				AnimationMode       = ONCE
				AnimationPriority   = 1
				AnimationSpeedFactorRange = 0.9 1.1
				AnimationBlendTime	= 15
			End
			Animation				= IDLD
				AnimationName       = KUDrkDun_IDLD
				AnimationMode       = ONCE
				AnimationPriority   = 1
				AnimationSpeedFactorRange = 0.9 1.1
				AnimationBlendTime	= 15
			End
			Animation				= IDLE
				AnimationName       = KUDrkDun_IDLE
				AnimationMode       = ONCE
				AnimationPriority   = 1
				AnimationSpeedFactorRange = 0.9 1.1
				AnimationBlendTime	= 15
			End
			BeginScript
				Prev = CurDrawablePrevAnimationState()
				if Prev == "STATE_Selected" then CurDrawableSetTransitionAnimState("TRANS_SelectedToIdle") end
			EndScript
		End
//--------------- TRANSITIONS ---------------------------------------------------------------------------
		TransitionState       = TRANS_TO_USER_1
			Animation
				AnimationName     = KUDrkDun_ATNC
				AnimationMode     = ONCE
			End
		End
		TransitionState       = TRANS_IdleToSelected
			Animation           = ATNA
				AnimationName     = KUDrkDun_ATNA
				AnimationMode     = ONCE
				AnimationSpeedFactorRange = 0.9 1.0
				
			End
		End
		TransitionState		= TRANS_SelectedToIdle
			Animation			= ATNB
				AnimationName	= KUDrkDun_ATNC ;,; KUDrkDun_ATNB
				AnimationMode	= ONCE
				AnimationSpeedFactorRange = 0.9 1.0
			End
		End
//-----------------------------------------------------------------------------------------------------------
	End
	
    #include "..\..\..\includes\StunDrawModuleSmall.inc"


	// ***DESIGN parameters ***

	Side 		= Angmar
	EditorSorting 	= UNIT

	ThreatLevel 	= 1.0

	ThingClass 	= HORDE_UNIT
	CommandPoints 	= 7 ;;,;; 8				; originally 4
	BountyValue 	= ANGMAR_DARKDUNEDAIN_BOUNTY_VALUE
	Scale		= 1.0
	EmotionRange 	= 240 				// Make sure this value is greater than the fear distribution range. 

	TransportSlotCount = TRANSPORTSLOTCOUNT_UNIT
	
	//// WEAPON SETS ////

	WeaponSet
		Conditions		= None 
		Weapon			= PRIMARY    AngmarSword
		AutoChooseSources	= PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
	End
	WeaponSet
		Conditions		= PLAYER_UPGRADE
		Weapon			= PRIMARY	AngmarSwordUpgraded
		AutoChooseSources	= PRIMARY FROM_PLAYER FROM_SCRIPT FROM_AI
	End

	//// ARMOUR SETS ////

	ArmorSet
		Conditions      = None
		Armor           = AngmarDDArmor
		DamageFX        = NormalDamageFX
	End
	ArmorSet
		Conditions      = PLAYER_UPGRADE
		Armor           = AngmarDDHeavyArmor
		DamageFX        = NormalDamageFX
	End
	
	ShroudClearingRange 	= SHROUD_CLEAR_STANDARD       
	VisionRange 		= ANGMAR_DARKDUNEDAIN_VISION_RANGE
	
	VisionSide 		= 35%
	VisionRear 		= 25%
	
	MaxVisionBonusPercent 	= 300%
	VisionBonusTestRadius 	= 200
	VisionBonusPercentPerFoot = 2.0%
					


	DisplayName 		= OBJECT:CityCohort
	CrushableLevel		= 0  			//What am I?:        0 = for infantry, 1 = for trees, 2 = general vehicles
	CrusherLevel		= 1 
	CrushWeapon		= GuardianCrush  
	
	CrushOnlyWhileCharging		= yes		;// the guardian is only supposed to crush during his special charge ability
	
	MinCrushVelocityPercent 	= 50%		;// Has to be moving at least xx% of full speed
	CrushDecelerationPercent	= 90%		;// Lose xx% max velocity when crushing -- thus they only crush 1 row of infantry
	CrushKnockback			= 40		;// how hard we knock back crushed units.
	CrushZFactor			= 1.0		;// How much we knock upwards.
	CrushRevengeWeapon 	= BasicInfantryCrushRevenge

	
	CommandSet 		= CityCohortTwohanderCommandSet


	// *** AUDIO Parameters ***//

	VoiceAttack				= DkDunVoiceAttack
	VoiceAttackCharge			= DkDunVoiceAttackCharge
	VoiceAttackMachine			= DkDunVoiceAttack
	VoiceAttackStructure			= DkDunVoiceAttackBuilding
	VoiceCreated				= DkDunVoiceSalute
	VoiceFullyCreated 			= DkDunVoiceSalute				//GondorSoldierVoiceCreated
	VoiceGuard				= DkDunVoiceMove
	VoiceMove				= DkDunVoiceMove
	VoiceMoveToCamp				= DkDunVoiceMoveCamp ;,; DkDunVoiceMove
	VoiceMoveWhileAttacking			= DkDunVoiceDisengage				//TEMP_GondorSoldierVoiceMoveWhileAttacking_TEMP
	VoicePriority				= 49
	VoiceRetreatToCastle			= DkDunVoiceRetreat ;,; DkDunVoiceDisengage
	VoiceSelect				= DkDunVoiceSelect
	VoiceSelectBattle 			= DkDunVoiceSelectBattle
	
	;,; Grouped Enter States
	VoiceEnterStateAttack			= DkDunVoiceEnterStateAttack ;,; DkDunVoiceAttack
	VoiceEnterStateAttackCharge		= DkDunVoiceEnterStateAttackCharge ;,; DkDunVoiceAttackCharge
	VoiceEnterStateAttackMachine		= DkDunVoiceEnterStateAttack ;,; DkDunVoiceAttack
	VoiceEnterStateAttackStructure		= DkDunVoiceEnterStateAttackBuilding ;,; DkDunVoiceAttackBuilding
	VoiceEnterStateMove			= DkDunVoiceEnterStateMove ;,; DkDunVoiceMove
	VoiceEnterStateMoveToCamp		= DkDunVoiceEnterStateMoveCamp ;,; DkDunVoiceMoveCamp
	VoiceEnterStateMoveWhileAttacking	= DkDunVoiceEnterStateDisengage ;,; DkDunVoiceDisengage
	VoiceEnterStateRetreatToCastle		= DkDunVoiceEnterStateRetreat ;,; DkDunVoiceDisengage

	SoundImpact				= ImpactHorse

	UnitSpecificSounds
		VoiceGarrison						= DkDunVoiceDisengage              
		VoiceDesperateAttack					= DkDunVoiceAttackCharge 
		VoiceEnterUnitElvenTransportShip			= DkDunVoiceMove
		VoiceInitiateCaptureBuilding				= DkDunVoiceMove
		VoiceEnterStateInitiateCaptureBuilding				= DkDunVoiceEnterStateCaptureBuilding ;,;
	End

	CrowdResponseKey = EvilMen2

    #include "..\..\..\includes\StandardUnitEvaEvents.inc"

	ClientBehavior = ModelConditionAudioLoopClientBehavior ModuleTag_foo
		ModelCondition = Required:RAISING_FLAG			Excluded:DYING ENGAGED	Sound:EmotionMenGoodCompilationBFME1and2VoxTauntSinglesLoop
	End

	Behavior = LargeGroupAudioUpdate ModuleTag_LGAU
		Key = Humanoid_Male Man Man_Male Unit Infantry Gondor_Soldier
	End
	
	ClientBehavior = AnimationSoundClientBehavior ModuleTag_AnimAudioBehavior
		MaxUpdateRangeCap = 800
		;AnimationSound = Sound: TauntHumanHitShield	Animation:KUDrkDun_SKL.KUDrkDun_IDLC	Frames: 17 27
		AnimationSound = Sound: TauntHumanHitShield	Animation:KUDrkDun_SKL.KUDrkDun_TNTC	Frames: 74 82 94 125 139

        AnimationSound = Sound:BodyFallGeneric1		Animation:KUDrkDun_SKL.KUDrkDun_DIEA	Frames:70 ;,;
		AnimationSound = Sound:BodyFallGeneric1		Animation:KUDrkDun_SKL.KUDrkDun_DIEB	Frames:89
		AnimationSound = Sound:BodyFallGeneric1		Animation:KUDrkDun_SKL.KUDrkDun_DIEC	Frames:71
		AnimationSound = Sound:BodyFallGeneric1		Animation:KUDrkDun_SKL.KUDrkDun_DIED	Frames:29
		AnimationSound = Sound:BodyFallGeneric1		Animation:KUDrkDun_SKL.KUDrkDun_DIEE	Frames:28
		AnimationSound = Sound:BodyFallGeneric1		Animation:KUDrkDun_SKL.KUDrkDun_LNDA	Frames:0
	End


	// *** ENGINEERING Parameters ***

	RadarPriority = UNIT
	KindOf = PRELOAD SELECTABLE CAN_CAST_REFLECTIONS INFANTRY PATH_THROUGH_EACH_OTHER SCORE THROWN_OBJECT ATTACK_NEEDS_LINE_OF_SIGHT NOTIFY_OF_PREATTACK GRAB_AND_DROP
	
	Body = ActiveBody ModuleTag_02
		CheerRadius 	  = EMOTION_CHEER_RADIUS
		MaxHealth         = GONDOR_SOLDIER_HEALTH
		MaxHealthDamaged  = GONDOR_SOLDIER_HEALTH_DAMAGED
		BurningDeathBehavior = Yes
		BurningDeathFX       = FX_InfantryBurningFlame
	End
	
	Behavior = WeaponSetUpgrade WeaponSetUpgradeModuleTag
		TriggeredBy = Upgrade_GondorForgedBlades
	End

	Behavior = ArmorUpgrade ArmorUpgradeModuleTag
		TriggeredBy = Upgrade_GondorHeavyArmor
		ArmorSetFlag			= PLAYER_UPGRADE
	End
	
	//-------------------------------------------------------------------------
	//
	//	Sub object upgrading.
	//
	Behavior = SubObjectsUpgrade Armor_Upgrade
		TriggeredBy		= Upgrade_GondorHeavyArmor
		UpgradeTexture	= guccths.tga 0 guccths_ha.tga
		RecolorHouse	= Yes
		ExcludeSubobjects = Forged_Blade
	End
	
	Behavior = SubObjectsUpgrade ForgedBlade_Upgrade
		TriggeredBy		= Upgrade_GondorForgedBlades
		ShowSubObjects	= Forged_Blade	
	End	
	//-------------------------------------------------------------------------
	
	Behavior = AIUpdateInterface ModuleTag_03
		AutoAcquireEnemiesWhenIdle	=	Yes ATTACK_BUILDINGS
		MoodAttackCheckRate		=	500
		AILuaEventsList			=	GondorFighterFunctions
		MinCowerTime			=	3000
		MaxCowerTime			=	5000
		AttackPriority			= 	AttackPriority_Infantry
		BurningDeathTime		=	BURNINGDEATH_DURATION_INFANTRY
	End

	LocomotorSet
		Locomotor = HumanSpecialChargeLocomotor
		Condition = SET_NORMAL 
		Speed     = NORMAL_FOOT_MED_MEMBER_SPEED
	End

;	LocomotorSet
;		Locomotor = HumanLocomotor
;		Condition = SET_NORMAL 
;		Speed     = NORMAL_GOOD_FAST_MEMBER_SPEED
;	End

	LocomotorSet
		Locomotor = BurningDeathLocomotorInfantry
		Condition = SET_BURNINGDEATH
		Speed	  = BURNINGDEATH_WANDERSPEED_INFANTRY
	End

	Behavior = PhysicsBehavior ModuleTag_04
		GravityMult 		= 1.0
		ShockStunnedTimeLow	= 1400	//msec
		ShockStunnedTimeHigh	= 2400	//msec
		ShockStandingTime	= 1233	//msec
	End 

	Behavior = AttributeModifierUpgrade ModuleTag_AMU
		TriggeredBy = Upgrade_GondorFighterFearless
		AttributeModifier = FearlessForever
	End
	 
	Behavior = SquishCollide ModuleTag_06
		//nothing
	End
	
	Behavior = HordeMemberCollide ModuleTag_HMC
		//nothing
	End
	
	 Behavior = SpecialPowerModule ModuleTag_ChargeStarter                      
		SpecialPowerTemplate		= SpecialAbilityAngmarCharge
		UpdateModuleStartsAttack	= Yes
		InitiateSound			= DkDunVoiceChargePower
	End
	#include "..\..\..\includes\AngmarChargeUpdate.inc"

	Behavior = SlowDeathBehavior ModuleTag_05
		DeathTypes = ALL -KNOCKBACK -FADED
		SinkDelay = 3000
		SinkRate = 0.60     // in Dist/Sec
		DestructionDelay = 10000
		Sound = INITIAL DkDunVoiceDie ;,; ManEvilGenericVoiceDie //GondorSoldierVoiceDie
	End
	
	Behavior = SlowDeathBehavior ModuleTag_FadeDeath
		DeathTypes = NONE +FADED
		SinkDelay = 3000
		SinkRate = 0.60     // in Dist/Sec
		DestructionDelay = 10000
		Sound = INITIAL SpellGenericUnsummonFasterMS
	End

	Behavior = SlowDeathBehavior ModuleTag_07
		// Same as normal death, but no sound (sound already played by SoundImpact = ... )
		DeathTypes = NONE +KNOCKBACK
		SinkDelay = 3000
		SinkRate = 0.60     // in Dist/Sec
		DestructionDelay = 10000
	End

	Behavior = BezierProjectileBehavior ModuleTag_08 // Module starts asleep, and wakes up when thrown.
		// To tweak a Bezier path
		FirstHeight = 24  // Height of Bezier control points above highest intervening terrain
		SecondHeight = 24
		FirstPercentIndent = 30% // Percentage of shot distance control points are placed
		SecondPercentIndent = 70%
		TumbleRandomly = Yes

		CrushStyle = Yes // I don't detonate, I just hit
		DieOnImpact = Yes
		BounceCount = 1   // When I hit the ground, I'll arc again
		BounceDistance = 40 // this far
		BounceFirstHeight = 24  // Height of Bezier control points above highest intervening terrain
		BounceSecondHeight = 24
		BounceFirstPercentIndent = 20% // Percentage of shot distance control points are placed
		BounceSecondPercentIndent = 80%

		GroundHitFX       = FX_ThrownRockGroundHit
		GroundBounceFX    = FX_ThrownRockBounceHit
	End

	Geometry = CYLINDER
	GeometryMajorRadius = 8.0
	GeometryMinorRadius = 8.0
	GeometryHeight = 19.2
	GeometryIsSmall = Yes

    Shadow = SHADOW_DECAL
    ShadowSizeX = 19//
    ShadowSizeY = 19//
    ShadowTexture = ShadowI
End
 

Horde code

Object CityCohortTwohanderHorde

	// This is required for garrisoned objects - please put in all objects.
	ButtonImage		= BGBarracks_CityCohortTH
	SelectPortrait		= UPCityCohortTH 

	Draw = W3DScriptedModelDraw ModuleTag_W3DModelDraw
	    DependencySharedModelFlags = EMOTION_ALERT EMOTION_MORALE_HIGH EMOTION_MORALE_LOW EMOTION_AFRAID EMOTION_COWER EMOTION_TERROR EMOTION_LOOK_TO_SKY EMOTION_TAUNTING EMOTION_POINTING SELECTED
		DefaultModelConditionState
			Model = None //InvisHrdeTmp5x2
		End

		ModelConditionState = HORDE_EMPTY
			Model = None
		End		
		
		ModelConditionState = WORLD_BUILDER
			Model = HordeMarkGUSol
		End		
	End
	
	Side = Men
	EditorSorting = UNIT
	EmotionRange = 240
	DisplayName = OBJECT:CityCohortHorde
	DisplayNameStrategic = CONTROLBAR:LW_Unit_AngmarDarkDunedainHorde
	DescriptionStrategic = CONTROLBAR:LW_ToolTip_AngmarDarkDunedainHorde
	
	WeaponSet
		Conditions = None 
		Weapon = PRIMARY    NormalMeleeHordeRangefinder
	End

	// *** AUDIO Parameters ***//
	// Note: Don't put voice parameters here -- they will be ignored. Voice play requests
	// are always passed through to members
	#include "..\..\..\includes\StandardHordeEvaEvents.inc"

	UnitSpecificSounds
		VoiceDesperateAttack  = GondorSoldierVoiceDesperateCharge ;needs angmar voice
	End

	BuildCost 		= ANGMAR_DARKDUNEDAIN_BUILDCOST
	BuildTime 		= ANGMAR_DARKDUNEDAIN_BUILDTIME
	ShroudClearingRange 	= ANGMAR_DARKDUNEDAIN_HORDE_SHROUD_RANGE       
	VisionRange 		= ANGMAR_DARKDUNEDAIN_HORDE_VISION_RANGE
	VisionSide 		= 50%
	VisionRear 		= 25%
	MaxVisionBonusPercent 	= 300%
	VisionBonusTestRadius 	= 200
	VisionBonusPercentPerFoot = 1.0%
	CommandPoints 		= 70 ;;,;; 80	; originally 60
	
	FormationWidth = 2 // Width it occupies in formations. Current choices are 1 or 2.
	FormationDepth = 1 // Depth it occupies in formations. Current choices are 1 or 2.
	
 	CrushableLevel = 0  ;What am I?:        0 = for infantry, 1 = for trees, 2 = general vehicles
	CrusherLevel = 1 
	
	CrushOnlyWhileCharging = YES ; // the guardian is only supposed to crush during his special charge ability
	
	MinCrushVelocityPercent = 50% ; Has to be moving at least xx% of full speed
	CrushDecelerationPercent = 90% ; Lose xx% max velocity when crushing -- thus they only crush 1 row of infantry
	
	CrushKnockback = 40  ; how hard we knock back crushed units.
	CrushZFactor = 1.0  ; How much we knock upwards.
	 
    TransportSlotCount = TRANSPORTSLOTCOUNT_SMALL_HORDE
	KindOf = SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT INFANTRY HORDE MELEE_HORDE NOTIFY_OF_PREATTACK ARMY_SUMMARY LARGE_RECTANGLE_PATHFIND //UNATTACKABLE 

	ThreatLevel = GONDOR_FIGHTER_HORDE_THREAT
	ThreatBreakdown GondorFighterHorde_DetailedThreat
		AIKindOf = INFANTRY
	End
	
	Body = ImmortalBody ModuleTag_ImmortalBody
		MaxHealth = 1
	End

	#include "..\..\..\includes\CaptureBuilding.inc"
    
	Behavior = StancesBehavior ModuleTag_StancesBehavior
        StanceTemplate = FighterHorde
    End
    
	Behavior = HordeAIUpdate ModuleTag_HordeAIUpdate
		AutoAcquireEnemiesWhenIdle	= Yes ATTACK_BUILDINGS
		MoodAttackCheckRate		= 500
		MaxCowerTime			= 5000
		MinCowerTime			= 3000
		AILuaEventsList			= InfantryFunctions
		AttackPriority			= AttackPriority_Infantry
	End

	;,; 2.02 upgrade tiers: all tier-specific upgrade simply trigger the old one
	Behavior = AttributeModifierUpgrade ModuleTag_UpgradeTriggerBlades
		TriggeredBy = PERSONAL_FORGED_BLADES_TIERS_LIST
		AttributeModifier = Modifier_GondorForgedBlades
	End
	Behavior = AttributeModifierUpgrade ModuleTag_UpgradeTriggerArmor
		TriggeredBy = PERSONAL_HEAVY_ARMOR_TIERS_UPGRADE_LIST
		AttributeModifier = Modifier_GondorHeavyArmor
	End
	Behavior = AttributeModifierUpgrade ModuleTag_UpgradeTriggerTierBlades
		TriggeredBy = Upgrade_GondorForgedBlades
		AttributeModifier = Modifier_TieredBlades
	End
	Behavior = AttributeModifierUpgrade ModuleTag_UpgradeTriggerTierArmor
		TriggeredBy = Upgrade_GondorHeavyArmor
		AttributeModifier = Modifier_TieredArmor
	End

	Behavior = HordeContain ModuleTag_HordeContain
		FrontAngle 			= 270
		FlankedDelay 			=  GENERAL_UNIT_FLANKED_DELAY ;,; 2000
		ObjectStatusOfContained 	= 
		InitialPayload 			= CityCohortTwohander 10
		Slots 				= 10			; originally 15
		PassengerFilter			= NONE +INFANTRY
		ShowPips 			= No
		ThisFormationIsTheMainFormation = Yes	//Used to determine which armorset to use (and anything else we want!)
		RandomOffset			= X:0 Y:0
		MeleeBehavior 			= Amoeba
		End

		// Banner Carrier info		
		BannerCarriersAllowed		= GondorInfantryBanner						// types of units that are allowed as banner carriers
		BannerCarrierPosition		= UnitType:CityCohortTwohander   Pos:X:70.0 Y:0.0		// (DEFAULT) position of banner carrier
		
		RankInfo = RankNumber:1 UnitType:CityCohortTwohander Position:X:50 Y:0			Position:X:50 Y:20				Position:X:50 Y:-20				Position:X:50 Y:40				Position:X:50 Y:-40 
		RankInfo = RankNumber:2 UnitType:CityCohortTwohander Position:X:30 Y:0 Leader 1 0	Position:X:30 Y:20 Leader 1 1	Position:X:30 Y:-20 Leader 1 2	Position:X:30 Y:40 Leader 1 3	Position:X:30 Y:-40 Leader 1 4
		//RankInfo = RankNumber:3 UnitType:CityCohortTwohander Position:X:10 Y:0 Leader 2 0	Position:X:10 Y:20 Leader 2 1	Position:X:10 Y:-20 Leader 2 2	Position:X:10 Y:40 Leader 2 3	Position:X:10 Y:-40 Leader 2 4
		
		RanksToReleaseWhenAttacking 	= 1 2

;;,;;		AlternateFormation 		= GondorFighterHordeBlock
		MeleeAttackLeashDistance 	= 50 ;;,;; 1   		//How far the hordes	can	move from the center of	the	horde when melee attacking.				  
		BackUpMinDelayTime		= 1		//The minimum amount of	time to	delay before backing up
		BackUpMaxDelayTime		= 3000		//The maximum amount of	time to	delay before backing up
		BackUpMinDistance		= 1		//The minimum number of	cells to backup
		BackUpMaxDistance		= 3		//The maximum number of	cells to backup
		BackupPercentage		= 80%		//The amount of	chance that	a unit will	back up.
	End

	Behavior = PhysicsBehavior ModuleTag_PhysicsBehavior
		GravityMult = 1.0
	End
	
	Behavior = CommandButtonHuntUpdate ModuleTag_CommandButtonHuntUpdate
	End
  
   	Behavior = EmotionTrackerUpdate	Module_EmotionTracker
		TauntAndPointDistance	 	= INFANTRY_TAUNT_POINT_RADIUS	   	// max distance to taunted/pointed objet
		TauntAndPointUpdateDelay	= 1000		   			// how often	scan (milliseconds)
		TauntAndPointExcluded	 	= NONE
		AfraidOf			= EMOTION_AFRAIDOF_OBJECTFILTER
		AlwaysAfraidOf			= EMOTION_ALWAYS_AFRAIDOF_OBJECTFILTER
		PointAt				= EMOTION_POINTAT_OBJECTFILTER
		HeroScanDistance		= 150
		FearScanDistance		= INFANTRY_FEAR_SCAN_RADIUS

		AddEmotion			= Terror_Base
		AddEmotion			= Doom_Base				//OVERRIDE
			//StartFXList		= FX_GondorSoldierDoom			//these have been hooked up in the FXList.INI
			//End

		AddEmotion			= BraceForBeingCrushed_Base
		
		AddEmotion			= UncontrollableFear_Base		//OVERRIDE
			//StartFXList		= FX_GondorSoldierFear
			//End
		
		AddEmotion			= FearIdle_Base				//OVERRIDE
			//StartFXList		= FX_GondorSoldierFear
			//End
		
		AddEmotion			= FearBusy_Base				//OVERRIDE
			//StartFXList		= FX_GondorSoldierFear
			//End
	
		AddEmotion			= Point_Base				//OVERRIDE
			//Duration		= 13980
			//StartFXList		= FX_GondorSoldierPoint
			//End
		
		AddEmotion			= Taunt_Base				//OVERRIDE
 			//AttributeModifier	= GondorFighterTaunt
 			//End		
 		
 		AddEmotion		=	CheerIdle_Base
		AddEmotion		=	CheerBusy_Base
		AddEmotion		=	HeroCheerIdle_Base
		AddEmotion		=	HeroCheerBusy_Base
		AddEmotion		=	Alert_Base
	End
	
	Behavior = PickupStuffUpdate ModuleTag_PickupStuffUpdate
		SkirmishAIOnly 		= Yes
		StuffToPickUp 		= NONE +CRATE
		ScanRange 		= 200
		ScanIntervalSeconds 	= 0.5
	End
  
	LocomotorSet
		Locomotor     = NormalChargeMeleeHordeLocomotor
		Condition     = SET_NORMAL
		Speed         = NORMAL_FOOT_MED_HORDE_SPEED
	End

;	LocomotorSet
;		Locomotor     = NormalMeleeHordeLocomotor
;		Condition     = SET_NORMAL
;		Speed         = NORMAL_GOOD_FAST_HORDE_SPEED
;	End
	
	LocomotorSet
		Locomotor     = ScaredMeleeHordeLocomotor
		Condition     = SET_SCARED
		Speed         = NORMAL_FOOT_MED_HORDE_SPEED
	End
	
	Behavior = ProductionUpdate ProductionUpdateModuleTag
		GiveNoXP = Yes
	End

	Behavior = LevelUpUpgrade ModuleTag_BasicTraining
		TriggeredBy = Upgrade_GondorBasicTraining
		LevelsToGain = 1
		LevelCap = 2
	End
	
	Behavior = StatusBitsUpgrade ModuleTag_ProductionLegality
		TriggeredBy = Upgrade_GondorForgedBlades
	End
	
	Behavior = StatusBitsUpgrade ModuleTag_ProductionLegality2
		TriggeredBy = Upgrade_GondorHeavyArmor
	End
	
	
	/////////////////////
	// AISpecialPowers
	/////////////////////
	Behavior = AISpecialPowerUpdate AngmarCharge
		CommandButtonName = Command_AngmarChargeAttack
		SpecialPowerAIType = AI_SPECIAL_POWER_CHARGE
	End

	Behavior = AISpecialPowerUpdate GondorFighterHordeCaptureBuildingAI
		CommandButtonName = Command_CaptureBuilding
		SpecialPowerAIType = AI_SPECIAL_POWER_CAPTURE_BUILDING
	End
	
	Behavior = AISpecialPowerUpdate GondorFighterHordeStanceBattle
		CommandButtonName = Command_SetStanceBattle
		SpecialPowerAIType = AI_SPECIAL_POWER_STANCEBATTLE
	End

	Behavior = AISpecialPowerUpdate GondorFighterHordeStanceAggressive
		CommandButtonName = Command_SetStanceAggressive
		SpecialPowerAIType = AI_SPECIAL_POWER_STANCEAGGRESSIVE
	End

	Behavior = AISpecialPowerUpdate GondorFighterHordeHoldGround
		CommandButtonName = Command_SetStanceHoldGround
		SpecialPowerAIType = AI_SPECIAL_POWER_STANCEHOLDGROUND
	End
	

;-------------------------Angmar Charge--------------------------------------
	Behavior = UnpauseSpecialPowerUpgrade ModuleTag_ChargeUnpause
		SpecialPowerTemplate      = SpecialAbilityAngmarCharge
		TriggeredBy		  = Upgrade_ObjectLevel2
	End
	
  	Behavior = SpecialPowerModule ModuleTag_ChargeStarter                      
		SpecialPowerTemplate      = SpecialAbilityAngmarCharge
		UpdateModuleStartsAttack  = Yes
		StartsPaused		= Yes
	End
	#include "..\..\..\includes\AngmarChargeUpdate.inc"
	
	CommandSet = CityCohortTwohanderHordeCommandSet

	Geometry = BOX
	GeometryMajorRadius = 30.0
	GeometryMinorRadius = 45.0
	GeometryHeight = 20.0
	GeometryIsSmall = No
	
	
	//-------------------------------------------------------------------------------------------------
	// World Map specific data
	//-------------------------------------------------------------------------------------------------
	
	// *** AUTO RESOLVE DATA ***
	AutoResolveUnitType = AutoResolveUnit_Soldier
	AutoResolveCombatChain = AutoResolve_SoldierCombatChain
	
	AutoResolveBody = AutoResolve_GondorFighterHordeBody

	AutoResolveArmor
		RequiredUpgrades = Upgrade_GondorHeavyArmor
		Armor = AutoResolve_GondorSoldierHeavyArmor
	End

	AutoResolveArmor
		ExcludedUpgrades = Upgrade_GondorHeavyArmor
		Armor = AutoResolve_GondorSoldierArmor
	End

	AutoResolveWeapon
		RequiredUpgrades = Upgrade_GondorForgedBlades
		Weapon = AutoResolve_GondorSoldierUpgradedWeapon
	End

	AutoResolveWeapon
		ExcludedUpgrades = Upgrade_GondorForgedBlades
		Weapon = AutoResolve_GondorSoldierWeapon
	End

	WorldMapArmoryUpgradesAllowed = Upgrade_GondorBasicTraining Upgrade_GondorForgedBlades Upgrade_GondorHeavyArmor
End

Some ROTWK 3d-modelling and texturing questions

18 June 2020 - 02:29 PM

Hi everyone!

 

I'm diving into ROTWK modding and are facing some troubles. I already clued how to rig my models and add textures (thanks to the huge amount of tutorials), but there are some things I can't understand even with examples from other mods:
1) How to add multiple textures to one unit in ini files, if it's possible? I mean, not random texture for variations. For example, I have no space for the sword texture in my texture file and I want to add standalone file, but I can't find in unit's ini what should I write to make this second texture work.

2) Some questions about randomizing textures and models. For example, if I'll make one texture with two different heads or shields, I understand that I should make two different models of heads\shields and bind them to this texture, but how do I make game understand that it should randomize my head\shield models in the horde?