Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline rey  
#1 Posted : Tuesday, September 20, 2022 6:25:35 PM(UTC)
rey
Major
Joined: 11/6/2015(UTC)
Posts: 152

Thanks: 8 times
Was thanked: 4 time(s) in 4 post(s)
Long story short: i'm trying to let Red Guards shoot mines, so if they are detected, guards could shoot to disarm them. But for some reason mere remake of GLA worker weapon doesn't work. In some experiments infantry stopped using normal shooting weapon(wasn't able to attack any more after first anti-mine try), in some - didn't do anything to mine at all.
So can somebody please direct me how to modify red guard's weapon(or add another dedicated one) for it to be used against mines?
Sponsor
Offline UTD^Force  
#2 Posted : Friday, September 23, 2022 10:37:46 AM(UTC)
UTD^Force
Colonel
C&C Labs Staff: Labs Staff MemberMaps Staff: Maps Staff Member
Joined: 8/13/2013(UTC)
Posts: 817
Jordan
Location: Middle east

Thanks: 430 times
Was thanked: 184 time(s) in 168 post(s)
Please provide the full edited code to make it easier to figure out what the problem is.
Proud Muslim

UTD^Force

Moderator and former map reviewer
CnC Labs
Offline UTD^Force  
#3 Posted : Friday, September 23, 2022 11:31:45 AM(UTC)
UTD^Force
Colonel
C&C Labs Staff: Labs Staff MemberMaps Staff: Maps Staff Member
Joined: 8/13/2013(UTC)
Posts: 817
Jordan
Location: Middle east

Thanks: 430 times
Was thanked: 184 time(s) in 168 post(s)
Alright, so I gave it a shot and it worked.
My advice to you is to look into other units that have certain characteristics which can help you achieve your goal. And that's what I did, I looked into a couple of units that have different weapons activated by command buttons, colonel burton and the american ranger.

After I edited the weapons and found a way to let the red guard automatically switch back to his own weapon, another problem occurred. Because the red guard only has one weapon, he didn't animate disarming the mines, that's why this code is long. The first part of the code fixes the animation, while the second part fixes the weapon's issue:

Code:
CommandButton Command_DisarmMinesAtPositionRedGuard
  Command                 = FIRE_WEAPON
  WeaponSlot              = SECONDARY ; Best if this matches up with an AutoChoose listing that forbids this slot normally
  Options                 = OK_FOR_MULTI_SELECT NEED_TARGET_POS USES_MINE_CLEARING_WEAPONSET
  TextLabel               = CONTROLBAR:DisarmMinesAtPosition
  ButtonImage             = SSClearMines_L ;Don't know why this became a portrait (It's from Generals, not MD).
  ButtonBorderType        = ACTION ; Identifier for the User as to what kind of button this is
  DescriptLabel           = CONTROLBAR:ToolTipDisarmMinesAtPosition
  RadiusCursorType        = CLEARMINES
  InvalidCursorName       = GenericInvalid
End

CommandSet ChinaInfantryRedguardCommandSetNEW
  1  = Command_ChinaInfantryRedGuardCaptureBuilding
  2  = Command_DisarmMinesAtPositionRedGuard
  3  = Command_AmericaRangerSwitchToMachineGun
 ; 4  = Command_AmericaRangerSwitchToFlagBangGrenades
  11 = Command_AttackMove
  13 = Command_Guard
  14 = Command_Stop
End

Object ChinaInfantryRedguard
 RemoveModule ModuleTag_01
 AddModule
  Draw = W3DModelDraw ModuleTag_6515648

    OkToChangeModelColor = Yes

    ; this says "we don't use these condition states at all, so completely
    ; ignore them for purposes of matchmaking"... this is useful to help
    ; reduce the number of AliasConditionState clauses you must add in
    ; order to avoid ambiguity in some cases.
    IgnoreConditionStates = PREATTACK_A FIRING_A BETWEEN_FIRING_SHOTS_A RELOADING_A

    ; ------- Standing-Around Animations
 
    DefaultConditionState
      Model               = NICNSC_SKN
      IdleAnimation       = NICNSC_SKL.NICNSC_STA 0 35
      IdleAnimation       = NICNSC_SKL.NICNSC_IDA
      IdleAnimation       = NICNSC_SKL.NICNSC_IDB
      AnimationMode       = ONCE
      WeaponFireFXBone    = PRIMARY Muzzle
      WeaponMuzzleFlash   = PRIMARY MuzzleFX
      WeaponFireFXBone    = SECONDARY Muzzle
      WeaponMuzzleFlash   = SECONDARY MuzzleFX
      TransitionKey       = TRANS_Stand
    End

    ConditionState        = REALLYDAMAGED
      IdleAnimation       = NICNSC_SKL.NICNSC_STB
      AnimationMode       = ONCE
      TransitionKey       = TRANS_StandDamaged
    End

    ; ------- Machine Gun Animations

    ConditionState      = USING_WEAPON_A 
      Animation         = NICNSC_SKL.NICNSC_ATA
      AnimationMode     = LOOP
      TransitionKey     = TRANS_Firing
    End
    AliasConditionState = PREATTACK_B MOVING
    AliasConditionState = PREATTACK_B FIRING_B
    AliasConditionState = PREATTACK_B BETWEEN_FIRING_SHOTS_B

    ConditionState      = USING_WEAPON_A REALLYDAMAGED
      Animation         = NICNSC_SKL.NICNSC_ATC
      AnimationMode     = LOOP
      TransitionKey     = TRANS_FiringDamaged
    End
    AliasConditionState = PREATTACK_B MOVING REALLYDAMAGED
    AliasConditionState = PREATTACK_B FIRING_B REALLYDAMAGED
    AliasConditionState = PREATTACK_B BETWEEN_FIRING_SHOTS_B REALLYDAMAGED

    ; ------- Firing-related Transitions

    TransitionState   = TRANS_Firing TRANS_FiringDamaged
      Animation       = NICNSC_SKL.NICNSC_AA2AC
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_Stand TRANS_Firing
      Animation       = NICNSC_SKL.NICNSC_SA2AA
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_Firing TRANS_Stand
      Animation       = NICNSC_SKL.NICNSC_AA2SA
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_StandDamaged TRANS_FiringDamaged
      Animation       = NICNSC_SKL.NICNSC_ATCST
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_FiringDamaged TRANS_StandDamaged
      Animation       = NICNSC_SKL.NICNSC_ATCED
      AnimationMode   = ONCE
    End


    ; ------------- Damage Transitions --------------------
    TransitionState = TRANS_StandDamaged TRANS_RunDamaged
      Animation       = NICNSC_SKL.NICNSC_AA2AC
      AnimationMode   = ONCE
      AnimationSpeedFactorRange = 2 2
    End
    TransitionState = TRANS_RunDamaged TRANS_StandDamaged 
      Animation       = NICNSC_SKL.NICNSC_AA2AC
      AnimationMode   = ONCE_BACKWARDS
      AnimationSpeedFactorRange = 2 2
      Flags           = START_FRAME_LAST
    End
    TransitionState = TRANS_Stand TRANS_StandDamaged 
      Animation       = NICNSC_SKL.NICNSC_AA2SA
      AnimationMode   = ONCE_BACKWARDS
      AnimationSpeedFactorRange = 4 5
      Flags           = START_FRAME_LAST
    End




    ; ------- Bayonet Animations

    ConditionState    = PREATTACK_C 
      Animation       = NICNSC_SKL.NICNSC_ATB1
      AnimationMode   = ONCE
      TransitionKey   = TRANS_Stab
    End
    AliasConditionState = PREATTACK_C MOVING
    AliasConditionState = PREATTACK_C FIRING_C
    AliasConditionState = PREATTACK_C BETWEEN_FIRING_SHOTS_C

    ConditionState      = FIRING_C
      Animation         = NICNSC_SKL.NICNSC_ATB2
      AnimationMode     = ONCE
      ; this is basically a trick: this guy has a nontrivial animation for firing,
      ; and a long recycle time between shots. we want him to finish his fire animation
      ; (unless he's ordered to do something else), so this is just a handy trick that
      ; says, "if the previous state had this transition key, allow it to finish before
      ; switching to us, if possible".
      WaitForStateToFinishIfPossible = TRANS_Stab
    End
    AliasConditionState = BETWEEN_FIRING_SHOTS_C
    AliasConditionState = RELOADING_C

    ; ------- Parachuting Animations

    ConditionState    = FREEFALL
      Animation       = NICNSC_SKL.NICNSC_POP
      AnimationMode   = MANUAL
      Flags           = START_FRAME_FIRST
      TransitionKey   = TRANS_Falling
    End
    AliasConditionState = FREEFALL REALLYDAMAGED
    AliasConditionState = FREEFALL DYING

    ConditionState    = PARACHUTING
      Animation       = NICNSC_SKL.NICNSC_PHG
      AnimationMode   = LOOP
      Flags           = PRISTINE_BONE_POS_IN_FINAL_FRAME  ; our bone positions should come from the last frame, rather than the first
      TransitionKey   = TRANS_Chute
    End
    AliasConditionState = PARACHUTING REALLYDAMAGED
    AliasConditionState = PARACHUTING DYING

    TransitionState   = TRANS_Falling TRANS_Chute
      Animation       = NICNSC_SKL.NICNSC_POP
      AnimationMode   = ONCE
      Flags           = PRISTINE_BONE_POS_IN_FINAL_FRAME  ; our bone positions should come from the last frame, rather than the first
    End

    TransitionState   = TRANS_Chute TRANS_Stand
      Animation       = NICNSC_SKL.NICNSC_PTD
      AnimationMode   = ONCE
    End

    ; ------- Movement Animations

    ConditionState      = MOVING
      Animation         = NICNSC_SKL.NICNSC_RNA 26
      AnimationMode     = LOOP
      Flags             = RANDOMSTART
      TransitionKey     = None
      ParticleSysBone   = None InfantryDustTrails
    End
    AliasConditionState = MOVING ATTACKING

    ConditionState = MOVING REALLYDAMAGED
      Animation         = NICNSC_SKL.NICNSC_RNB 28
      AnimationMode     = LOOP
      Flags             = RANDOMSTART
      TransitionKey     = TRANS_RunDamaged
      TransitionKey     = None
    End
    AliasConditionState = MOVING ATTACKING REALLYDAMAGED

    ; ------- Bldg-capture

    ConditionState      = UNPACKING
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP1
      AnimationMode     = ONCE
    End
    AliasConditionState = UNPACKING REALLYDAMAGED

    ConditionState      = RAISING_FLAG
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP2
      AnimationMode     = ONCE
      TransitionKey     = TRANS_Raising
    End
    AliasConditionState = RAISING_FLAG REALLYDAMAGED

    ConditionState      = PACKING
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP1
      AnimationMode     = ONCE_BACKWARDS
      Flags             = START_FRAME_LAST
      TransitionKey     = TRANS_Packing
    End
    AliasConditionState = PACKING REALLYDAMAGED

    TransitionState     = TRANS_Raising TRANS_Packing
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP2
      AnimationMode     = ONCE_BACKWARDS
      Flags             = START_FRAME_LAST
    End

    ; ------- Dying Animations

    ConditionState      = DYING
      Animation         = NICNSC_SKL.NICNSC_DTA
      Animation         = NICNSC_SKL.NICNSC_DTB
      AnimationMode     = ONCE
      TransitionKey     = TRANS_Dying
    End

    TransitionState     = TRANS_Dying TRANS_Flailing
      Animation         = NICNSC_SKL.NICNSC_ATDE1
      AnimationMode     = ONCE
    End

    ConditionState      = DYING EXPLODED_FLAILING
      Animation         = NICNSC_SKL.NICNSC_ATDE2
      AnimationMode     = LOOP
      TransitionKey     = TRANS_Flailing
    End

    ConditionState      = DYING EXPLODED_BOUNCING
      Animation         = NICNSC_SKL.NICNSC_ATDE3
      AnimationMode     = ONCE
      TransitionKey     = None
    End

    ; ------- Misc Animations

    ConditionState      = SPECIAL_CHEERING
      Animation         = NICNSC_SKL.NICNSC_CHA
      AnimationMode     = LOOP
    End

  End
 End
;;;;;;;;;;;;;; all of that above in the redguard's code is only to let it animate disarming
  WeaponSet
    Conditions = None 
    Weapon = PRIMARY RedguardMachineGun
    Weapon = SECONDARY DozerMineDisarmingWeapon
    AutoChooseSources = PRIMARY FROM_SCRIPT FROM_AI DEFAULT_SWITCH_WEAPON
    AutoChooseSources = SECONDARY FROM_SCRIPT FROM_AI
    WeaponLockSharedAcrossSets = Yes ; This set is so similar to the default set that it can hold the weapon lock
  End
 AddModule
  Behavior = StealthDetectorUpdate ModuleTag_0655
    DetectionRate         = 500   ; how often to rescan for stealthed things in my sight (msec)
    ;DetectionRange       = ??? ;Dustin, enable this for independant balancing!
    CanDetectWhileGarrisoned  = No ;Garrisoned means being in a structure that you units can shoot out of.
    CanDetectWhileContained   = No ;Contained means being in a transport or tunnel network.
    ExtraRequiredKindOf   = MINE  ; we can only detect MINES, not other stealthed things
  End
 End
  CommandSet    = ChinaInfantryRedguardCommandSetNEW

End


Oh, and I also added the StealthDetectorUpdate behaviour to let the red guard detect mines and only mines. You can remove the last part if you don't want this.
Have a nice day, and happy modding!

#EDIT: make sure to copy the code in chronological order or the game will crash i.e. the game reads the code from the top to bottom, which means the commandbutton used in the commandset should be written before the commandset itself, or the game will crash. The same goes for the edited commandset that the redguard will use.

Edited by user Friday, September 23, 2022 11:34:37 AM(UTC)  | Reason: Not specified

Proud Muslim

UTD^Force

Moderator and former map reviewer
CnC Labs
Offline rey  
#4 Posted : Thursday, September 29, 2022 4:06:03 PM(UTC)
rey
Major
Joined: 11/6/2015(UTC)
Posts: 152

Thanks: 8 times
Was thanked: 4 time(s) in 4 post(s)
Originally Posted by: UTD^Force Go to Quoted Post
My advice to you is to look into other units that have certain characteristics which can help you achieve your goal.
Thank you for your time and code example, but for pity it's not what is my goal - i'm not after simple adding disarm ability for Red Guards to come and disarm like Worker, but for them to shoot/kill mines from distance and desirably do it automatically when mines are spot(automatically start shooting in mines).
And that's the problem - i didn't find any example to examine for exactly such mechanic.
Offline UTD^Force  
#5 Posted : Thursday, September 29, 2022 9:35:44 PM(UTC)
UTD^Force
Colonel
C&C Labs Staff: Labs Staff MemberMaps Staff: Maps Staff Member
Joined: 8/13/2013(UTC)
Posts: 817
Jordan
Location: Middle east

Thanks: 430 times
Was thanked: 184 time(s) in 168 post(s)
Originally Posted by: rey Go to Quoted Post
Originally Posted by: UTD^Force Go to Quoted Post
My advice to you is to look into other units that have certain characteristics which can help you achieve your goal.
Thank you for your time and code example, but for pity it's not what is my goal - i'm not after simple adding disarm ability for Red Guards to come and disarm like Worker, but for them to shoot/kill mines from distance and desirably do it automatically when mines are spot(automatically start shooting in mines).
And that's the problem - i didn't find any example to examine for exactly such mechanic.

I don't think that I totally understand what you want to do. Simply changing the attack range will let the redguards kill mines from a distance.
Code:
Weapon WorkerMineDisarmingWeaponREDGUARD
  PrimaryDamage = 1.0             ; this isn't really used, but must be nonzero for targeting to work well
  AttackRange = 500.0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;DISTANCE HERE
  DamageType = DISARM
  DeathType = NORMAL
  ProjectileObject = NONE
  FireFX = WeaponFX_WorkerMineDisarming
  DelayBetweenShots = 1000        ; time between shots, msec
  ClipSize = 0                    ; how many shots in a Clip (0 == infinite)
  ClipReloadTime = 0              ; how long to reload a Clip, msec
  AntiGround = No
  AntiProjectile = No
  AntiSmallMissile = No
  AntiMine = Yes
  PreAttackDelay = 1000           ; we have to wave our magic wand over it a bit
  PreAttackType = PER_SHOT ; Do the delay every single shot
  ContinueAttackRange = 100        ; after disarming a mine, look for additional mines within this dist to disarm
End

For the redguard to automatically attack mines, I can't think of anything specific on the fly right now, but looking into base defense weapons may help, as they have targets from several KINDOFs and auto target them.

Edited by user Thursday, September 29, 2022 9:36:56 PM(UTC)  | Reason: Not specified

Proud Muslim

UTD^Force

Moderator and former map reviewer
CnC Labs
Offline rey  
#6 Posted : Friday, October 7, 2022 2:56:49 AM(UTC)
rey
Major
Joined: 11/6/2015(UTC)
Posts: 152

Thanks: 8 times
Was thanked: 4 time(s) in 4 post(s)
Originally Posted by: UTD^Force Go to Quoted Post
I don't think that I totally understand what you want to do. Simply changing the attack range will let the redguards kill mines from a distance.
Thank you for your code example, and it works, but again it's not exactly what i want. This weapon "disarms" mines while i want to actually "kill" them - like when artillery shots on mine-fieid and they start to blow.

Maybe it sounds dumb problem, but i can't merge simple infantry shooting(that is always meant to shoot directly one target) with area effect damage and spread shooting, while at the same time this weapon can't be used against other units(only mines must be effected).
Basically i want unit to start gunfire an area(with actual bullets shooting in different spots) and mines not get disarmed with mere puff(like when Worker disarms them), but mines actually blow up, and at the same time weapon does damage only to mines and can't harm anything else.

Plus, however i experiment with Behavior = AIUpdateInterface, controlling infantry's weapon slots, can't make infantry to automatically attack mines when found nearby, only direct order to use weapon on specific area works.

Edited by user Friday, October 7, 2022 8:12:08 AM(UTC)  | Reason: Not specified

Offline UTD^Force  
#7 Posted : Friday, October 7, 2022 8:16:12 AM(UTC)
UTD^Force
Colonel
C&C Labs Staff: Labs Staff MemberMaps Staff: Maps Staff Member
Joined: 8/13/2013(UTC)
Posts: 817
Jordan
Location: Middle east

Thanks: 430 times
Was thanked: 184 time(s) in 168 post(s)
Oh, my bad, I get it now.
I have attempted changing the damage type to Armor_Piercing but as you said, that causes the weapon to damage units other than the mines.
However, you can edit the weapon FX if that is what you want, for example:
Code:
Object ChinaStandardMine
 RemoveModule ModuleTag_03
 AddModule
  Behavior = StealthUpdate ModuleTag_0354212
    StealthDelay                = 0 ; msec
    StealthForbiddenConditions  = NONE
    FriendlyOpacityMin          = 0.0%
    FriendlyOpacityMax          = 0.0%
    InnateStealth               = Yes
    OrderIdleEnemiesToAttackMeUponReveal  = Yes
  End
 End
End
Weapon WorkerMineDisarmingWeaponREDGUARD
  PrimaryDamage = 1.0             ; this isn't really used, but must be nonzero for targeting to work well
  AttackRange = 350.0
  DamageType = DISARM
  DeathType = NORMAL
  ProjectileObject = NONE
  FireFX = WeaponFX_MineDetonation;;;;;;;;;;;;;;HERE
  DelayBetweenShots = 1000        ; time between shots, msec
  ClipSize = 0                    ; how many shots in a Clip (0 == infinite)
  ClipReloadTime = 0              ; how long to reload a Clip, msec
  AntiGround = No
  AntiProjectile = No
  AntiSmallMissile = No
  AntiMine = Yes
  PreAttackDelay = 1000           ; we have to wave our magic wand over it a bit
  PreAttackType = PER_SHOT ; Do the delay every single shot
  ContinueAttackRange = 100        ; after disarming a mine, look for additional mines within this dist to disarm
End

I've edited the fireFX 'WeaponFX_MineDetonation' of the disarming weapon, and now mines appear to explode when actually disarmed using this weapon. This is the first problem, right?

The second problem is that redguards don't automatically fire at the mines, and this is what I attempted to fix with the first behaviour in this code, but sadly did not succeed at. There may be other ways, however, but I don't have time now to check them out.
Maybe look into the workers' code? I remember that they went by themselves to disarm mines when they detected them.
Proud Muslim

UTD^Force

Moderator and former map reviewer
CnC Labs
Offline rey  
#8 Posted : Tuesday, October 11, 2022 5:41:54 PM(UTC)
rey
Major
Joined: 11/6/2015(UTC)
Posts: 152

Thanks: 8 times
Was thanked: 4 time(s) in 4 post(s)
Originally Posted by: UTD^Force Go to Quoted Post
This is the first problem, right?

Maybe look into the workers' code? I remember that they went by themselves to disarm mines when they detected them.
I somewhat edited your code, but yeah, first one is solved.
For the second, I checked Workers even before, and as i understood they react due to Behavior = WorkerAIUpdate and AutoAcquireEnemiesWhenIdle = Yes, but this module can't be used on ordinary infantry. Tried adding analogue for ordinary units, but still no reaction on mines.
Quote:
Behavior = AIUpdateInterface ModuleTag_03
Turret
TurretTurnRate = 0
ControlledWeaponSlots = PRIMARY SECONDARY TERTIARY
End
AutoAcquireEnemiesWhenIdle = Yes
MoodAttackCheckRate = 250
End

Offline UTD^Force  
#9 Posted : Tuesday, October 11, 2022 11:21:50 PM(UTC)
UTD^Force
Colonel
C&C Labs Staff: Labs Staff MemberMaps Staff: Maps Staff Member
Joined: 8/13/2013(UTC)
Posts: 817
Jordan
Location: Middle east

Thanks: 430 times
Was thanked: 184 time(s) in 168 post(s)
Okay, so I solved the second problem.
You cannot have a worker or dozer AIupdate for a unit that does not have the kindof DOZER, the game will simply crash.
But having the DOZER kindof also lets units repair buildings.
I simply gave the redguard this KINDOF and set the repair percentage to 0%, which means they will not repair buildings but will also auto target mines.
This is the full code inside the map.ini file that I made. Inside this will be everything I tried from the moment I saw your post until now, so figure out what you need and what you don't.
Code:
CommandButton Command_DisarmMinesAtPositionRedGuard
  Command                 = FIRE_WEAPON
  WeaponSlot              = SECONDARY ; Best if this matches up with an AutoChoose listing that forbids this slot normally
  Options                 = OK_FOR_MULTI_SELECT NEED_TARGET_POS USES_MINE_CLEARING_WEAPONSET
  TextLabel               = CONTROLBAR:DisarmMinesAtPosition
  ButtonImage             = SSClearMines_L ;Don't know why this became a portrait (It's from Generals, not MD).
  ButtonBorderType        = ACTION ; Identifier for the User as to what kind of button this is
  DescriptLabel           = CONTROLBAR:ToolTipDisarmMinesAtPosition
  RadiusCursorType        = CLEARMINES
  InvalidCursorName       = GenericInvalid
End
CommandButton Command_AmericaRangerSwitchToFlagBangGrenadesRG
  Command                 = SWITCH_WEAPON
  WeaponSlot              = SECONDARY
  Options                 = CHECK_LIKE OK_FOR_MULTI_SELECT ;NEED_UPGRADE 
 ; Upgrade                 = Upgrade_AmericaRangerFlashBangGrenade
  TextLabel               = CONTROLBAR:FlashBangGrenadeMode
  ButtonImage             = SSFlashbang
  ButtonBorderType        = ACTION
  DescriptLabel           = CONTROLBAR:ToolTipSwitchToUSAFlashBang
End
Object ChinaStandardMine
 RemoveModule ModuleTag_03
 AddModule
  Behavior = StealthUpdate ModuleTag_0354212
    StealthDelay                = 0 ; msec
    StealthForbiddenConditions  = NONE
    FriendlyOpacityMin          = 0.0%
    FriendlyOpacityMax          = 0.0%
    InnateStealth               = Yes
    OrderIdleEnemiesToAttackMeUponReveal  = Yes
  End
 End
End
Weapon WorkerMineDisarmingWeaponREDGUARD
  PrimaryDamage = 1.0             ; this isn't really used, but must be nonzero for targeting to work well
  AttackRange = 350.0
  DamageType = DISARM
  DeathType = NORMAL
  ProjectileObject = NONE
  FireFX = WeaponFX_MineDetonation
  DelayBetweenShots = 1000        ; time between shots, msec
  ClipSize = 0                    ; how many shots in a Clip (0 == infinite)
  ClipReloadTime = 0              ; how long to reload a Clip, msec
  AntiGround = No
  AntiProjectile = No
  AntiSmallMissile = No
  AntiMine = Yes
  PreAttackDelay = 1000           ; we have to wave our magic wand over it a bit
  PreAttackType = PER_SHOT ; Do the delay every single shot
  ContinueAttackRange = 100        ; after disarming a mine, look for additional mines within this dist to disarm
End
CommandSet ChinaInfantryRedguardCommandSetNEW
  1  = Command_ChinaInfantryRedGuardCaptureBuilding
 ; 2  = Command_DisarmMinesAtPositionRedGuard
  3  = Command_AmericaRangerSwitchToMachineGun
  4  = Command_AmericaRangerSwitchToFlagBangGrenadesRG
  11 = Command_AttackMove
  13 = Command_Guard
  14 = Command_Stop
End

Object ChinaInfantryRedguard
 RemoveModule ModuleTag_01
 AddModule
  Draw = W3DModelDraw ModuleTag_6515648

    OkToChangeModelColor = Yes

    ; this says "we don't use these condition states at all, so completely
    ; ignore them for purposes of matchmaking"... this is useful to help
    ; reduce the number of AliasConditionState clauses you must add in
    ; order to avoid ambiguity in some cases.
    IgnoreConditionStates = PREATTACK_A FIRING_A BETWEEN_FIRING_SHOTS_A RELOADING_A

    ; ------- Standing-Around Animations
 
    DefaultConditionState
      Model               = NICNSC_SKN
      IdleAnimation       = NICNSC_SKL.NICNSC_STA 0 35
      IdleAnimation       = NICNSC_SKL.NICNSC_IDA
      IdleAnimation       = NICNSC_SKL.NICNSC_IDB
      AnimationMode       = ONCE
      WeaponFireFXBone    = PRIMARY Muzzle
      WeaponMuzzleFlash   = PRIMARY MuzzleFX
      WeaponFireFXBone    = SECONDARY Muzzle
      WeaponMuzzleFlash   = SECONDARY MuzzleFX
      TransitionKey       = TRANS_Stand
    End

    ConditionState        = REALLYDAMAGED
      IdleAnimation       = NICNSC_SKL.NICNSC_STB
      AnimationMode       = ONCE
      TransitionKey       = TRANS_StandDamaged
    End

    ; ------- Machine Gun Animations

    ConditionState      = USING_WEAPON_A 
      Animation         = NICNSC_SKL.NICNSC_ATA
      AnimationMode     = LOOP
      TransitionKey     = TRANS_Firing
    End
    AliasConditionState = PREATTACK_B MOVING
    AliasConditionState = PREATTACK_B FIRING_B
    AliasConditionState = PREATTACK_B BETWEEN_FIRING_SHOTS_B

    ConditionState      = USING_WEAPON_A REALLYDAMAGED
      Animation         = NICNSC_SKL.NICNSC_ATC
      AnimationMode     = LOOP
      TransitionKey     = TRANS_FiringDamaged
    End
    AliasConditionState = PREATTACK_B MOVING REALLYDAMAGED
    AliasConditionState = PREATTACK_B FIRING_B REALLYDAMAGED
    AliasConditionState = PREATTACK_B BETWEEN_FIRING_SHOTS_B REALLYDAMAGED

    ; ------- Firing-related Transitions

    TransitionState   = TRANS_Firing TRANS_FiringDamaged
      Animation       = NICNSC_SKL.NICNSC_AA2AC
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_Stand TRANS_Firing
      Animation       = NICNSC_SKL.NICNSC_SA2AA
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_Firing TRANS_Stand
      Animation       = NICNSC_SKL.NICNSC_AA2SA
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_StandDamaged TRANS_FiringDamaged
      Animation       = NICNSC_SKL.NICNSC_ATCST
      AnimationMode   = ONCE
    End

    TransitionState   = TRANS_FiringDamaged TRANS_StandDamaged
      Animation       = NICNSC_SKL.NICNSC_ATCED
      AnimationMode   = ONCE
    End


    ; ------------- Damage Transitions --------------------
    TransitionState = TRANS_StandDamaged TRANS_RunDamaged
      Animation       = NICNSC_SKL.NICNSC_AA2AC
      AnimationMode   = ONCE
      AnimationSpeedFactorRange = 2 2
    End
    TransitionState = TRANS_RunDamaged TRANS_StandDamaged 
      Animation       = NICNSC_SKL.NICNSC_AA2AC
      AnimationMode   = ONCE_BACKWARDS
      AnimationSpeedFactorRange = 2 2
      Flags           = START_FRAME_LAST
    End
    TransitionState = TRANS_Stand TRANS_StandDamaged 
      Animation       = NICNSC_SKL.NICNSC_AA2SA
      AnimationMode   = ONCE_BACKWARDS
      AnimationSpeedFactorRange = 4 5
      Flags           = START_FRAME_LAST
    End




    ; ------- Bayonet Animations

    ConditionState    = PREATTACK_C 
      Animation       = NICNSC_SKL.NICNSC_ATB1
      AnimationMode   = ONCE
      TransitionKey   = TRANS_Stab
    End
    AliasConditionState = PREATTACK_C MOVING
    AliasConditionState = PREATTACK_C FIRING_C
    AliasConditionState = PREATTACK_C BETWEEN_FIRING_SHOTS_C

    ConditionState      = FIRING_C
      Animation         = NICNSC_SKL.NICNSC_ATB2
      AnimationMode     = ONCE
      ; this is basically a trick: this guy has a nontrivial animation for firing,
      ; and a long recycle time between shots. we want him to finish his fire animation
      ; (unless he's ordered to do something else), so this is just a handy trick that
      ; says, "if the previous state had this transition key, allow it to finish before
      ; switching to us, if possible".
      WaitForStateToFinishIfPossible = TRANS_Stab
    End
    AliasConditionState = BETWEEN_FIRING_SHOTS_C
    AliasConditionState = RELOADING_C

    ; ------- Parachuting Animations

    ConditionState    = FREEFALL
      Animation       = NICNSC_SKL.NICNSC_POP
      AnimationMode   = MANUAL
      Flags           = START_FRAME_FIRST
      TransitionKey   = TRANS_Falling
    End
    AliasConditionState = FREEFALL REALLYDAMAGED
    AliasConditionState = FREEFALL DYING

    ConditionState    = PARACHUTING
      Animation       = NICNSC_SKL.NICNSC_PHG
      AnimationMode   = LOOP
      Flags           = PRISTINE_BONE_POS_IN_FINAL_FRAME  ; our bone positions should come from the last frame, rather than the first
      TransitionKey   = TRANS_Chute
    End
    AliasConditionState = PARACHUTING REALLYDAMAGED
    AliasConditionState = PARACHUTING DYING

    TransitionState   = TRANS_Falling TRANS_Chute
      Animation       = NICNSC_SKL.NICNSC_POP
      AnimationMode   = ONCE
      Flags           = PRISTINE_BONE_POS_IN_FINAL_FRAME  ; our bone positions should come from the last frame, rather than the first
    End

    TransitionState   = TRANS_Chute TRANS_Stand
      Animation       = NICNSC_SKL.NICNSC_PTD
      AnimationMode   = ONCE
    End

    ; ------- Movement Animations

    ConditionState      = MOVING
      Animation         = NICNSC_SKL.NICNSC_RNA 26
      AnimationMode     = LOOP
      Flags             = RANDOMSTART
      TransitionKey     = None
      ParticleSysBone   = None InfantryDustTrails
    End
    AliasConditionState = MOVING ATTACKING

    ConditionState = MOVING REALLYDAMAGED
      Animation         = NICNSC_SKL.NICNSC_RNB 28
      AnimationMode     = LOOP
      Flags             = RANDOMSTART
      TransitionKey     = TRANS_RunDamaged
      TransitionKey     = None
    End
    AliasConditionState = MOVING ATTACKING REALLYDAMAGED

    ; ------- Bldg-capture

    ConditionState      = UNPACKING
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP1
      AnimationMode     = ONCE
    End
    AliasConditionState = UNPACKING REALLYDAMAGED

    ConditionState      = RAISING_FLAG
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP2
      AnimationMode     = ONCE
      TransitionKey     = TRANS_Raising
    End
    AliasConditionState = RAISING_FLAG REALLYDAMAGED

    ConditionState      = PACKING
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP1
      AnimationMode     = ONCE_BACKWARDS
      Flags             = START_FRAME_LAST
      TransitionKey     = TRANS_Packing
    End
    AliasConditionState = PACKING REALLYDAMAGED

    TransitionState     = TRANS_Raising TRANS_Packing
      Model             = NICNSC_F_SKN
      Animation         = NICNSC_F_SKL.NICNSC_F_FDP2
      AnimationMode     = ONCE_BACKWARDS
      Flags             = START_FRAME_LAST
    End

    ; ------- Dying Animations

    ConditionState      = DYING
      Animation         = NICNSC_SKL.NICNSC_DTA
      Animation         = NICNSC_SKL.NICNSC_DTB
      AnimationMode     = ONCE
      TransitionKey     = TRANS_Dying
    End

    TransitionState     = TRANS_Dying TRANS_Flailing
      Animation         = NICNSC_SKL.NICNSC_ATDE1
      AnimationMode     = ONCE
    End

    ConditionState      = DYING EXPLODED_FLAILING
      Animation         = NICNSC_SKL.NICNSC_ATDE2
      AnimationMode     = LOOP
      TransitionKey     = TRANS_Flailing
    End

    ConditionState      = DYING EXPLODED_BOUNCING
      Animation         = NICNSC_SKL.NICNSC_ATDE3
      AnimationMode     = ONCE
      TransitionKey     = None
    End

    ; ------- Misc Animations

    ConditionState      = SPECIAL_CHEERING
      Animation         = NICNSC_SKL.NICNSC_CHA
      AnimationMode     = LOOP
    End

  End
 End

  KindOf = PRELOAD SELECTABLE CAN_ATTACK ATTACK_NEEDS_LINE_OF_SIGHT CAN_CAST_REFLECTIONS INFANTRY SCORE PARACHUTABLE DOZER
 

 RemoveModule ModuleTag_04
 AddModule
  Behavior = DozerAIUpdate ModuleTag_04444
    RepairHealthPercentPerSecond = 0%    ; % of max health to repair each second
    BoredTime                    = 5000  ; in milliseconds
    BoredRange                   = 150   ; when bored, we look this far away to do something
    ; the only "enemies" that workers can acquire are mines, to be disarmed...
    AutoAcquireEnemiesWhenIdle   = Yes
  End
 End
  Locomotor = SET_NORMAL BasicHumanLocomotor
  WeaponSet
    Conditions = None 
    Weapon = PRIMARY WorkerMineDisarmingWeaponREDGUARD 
    Weapon = SECONDARY RedguardMachineGun;;;RedguardMachineGunOTHER; 
    AutoChooseSources = PRIMARY FROM_SCRIPT FROM_AI DEFAULT_SWITCH_WEAPON
    AutoChooseSources = SECONDARY FROM_SCRIPT FROM_AI FROM_PLAYER
    WeaponLockSharedAcrossSets = Yes ; This set is so similar to the default set that it can hold the weapon lock
  End
 ; WeaponSet
 ;   Conditions = MINE_CLEARING_DETAIL 
 ;   Weapon = PRIMARY WorkerMineDisarmingWeaponREDGUARD 
 ;   Weapon = SECONDARY RedguardMachineGun;;;RedguardMachineGunOTHER; 
 ;   AutoChooseSources = PRIMARY FROM_SCRIPT FROM_AI DEFAULT_SWITCH_WEAPON
 ;   AutoChooseSources = SECONDARY FROM_SCRIPT FROM_AI FROM_PLAYER
 ;   WeaponLockSharedAcrossSets = Yes ; This set is so similar to the default set that it can hold the weapon lock
 ; End
 AddModule
  Behavior = StealthDetectorUpdate ModuleTag_0655
    DetectionRate         = 300   ; how often to rescan for stealthed things in my sight (msec)
    ;DetectionRange       = ??? ;Dustin, enable this for independant balancing!
    CanDetectWhileGarrisoned  = No ;Garrisoned means being in a structure that you units can shoot out of.
    CanDetectWhileContained   = No ;Contained means being in a transport or tunnel network.
    ExtraRequiredKindOf   = MINE  ; we can only detect MINES, not other stealthed things
  End
 End
  CommandSet    = ChinaInfantryRedguardCommandSetNEW

End
Proud Muslim

UTD^Force

Moderator and former map reviewer
CnC Labs
thanks 1 user thanked UTD^Force for this useful post.
rey on 10/13/2022(UTC)
Offline rey  
#10 Posted : Thursday, October 13, 2022 6:35:09 AM(UTC)
rey
Major
Joined: 11/6/2015(UTC)
Posts: 152

Thanks: 8 times
Was thanked: 4 time(s) in 4 post(s)
Unexpected approach, thank you. Didn't check it fully yet, but wouldn't then Red Guards be able to "take action in building" with Kindof Dozer?

Edited by user Thursday, October 13, 2022 6:37:22 AM(UTC)  | Reason: Not specified

Offline chu121su12  
#11 Posted : Sunday, December 24, 2023 9:07:04 PM(UTC)
chu121su12
Private
Joined: 3/30/2019(UTC)
Posts: 1

I think to "kill" mine you'd need to make mine as unit/structure and spare damage & armor to be exclusive for mine attacking, not as mine fueld.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.