Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Is it possible to mod the Civilian Bunker structure so it uses a machinegun (say, the comanche gun) on enemies within range when it is garrisoned by a player?
Sponsor
Unknown Editor
8 years ago
In my Opinion , It Sure can be ; Just requires a Couple of codes that You Must Add to the Bunker (AddModule), You can even make them able to Get Mine Upgrades however it's almost like a bug ; I can Look and Find the Codes in INI Later and make it work as well (I think It could be Sth Like Technical Machine Gun which Is Installed on it) , But now I must go to my English Class 😁
I'll Try to Figure it out A.S.A.P 😎
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
AdrianeMapMaker
8 years ago
I Think You Need to Add a Model On It Not in Modeling But Coding as Unknown Editor Had Said
A part of ZH worldbuilders map making community
https://discord.gg/tJ6zyGb 

UserPostedImage




R.I.P
  • R.I.P
  • 50.25% (Neutral)
  • Captain
8 years ago
it can be done by coding
just change the weapon of the bunker and give it a shot
It's me your friendly modder ZOMBATAR!
SkyMix_RMT
8 years ago
In order for this to work 100% and look good you will need to add several pieces of code to the bunker.

In DefaultConditionState add a line with "WeaponFireFXBone = PRIMARY FIREPOINT", this makes sure the bullets come out of the bunker's firepoints.

Add a Weaponset like so:

WeaponSet
Conditions = None
Weapon = PRIMARY WeaponName
End

Make sure VisionRange and ShroudClearingRange are a bigger value than that of the weapon's AttackRange. (For example, commanche's vulcan gun AttackRange is 200, so VisionRange should be something like 210 and ShroudClearingRange 250)

Then add a "CAN_ATTACK" and a "ATTACK_NEEDS_LINE_OF_SIGHT" to the Bunker's KindOf.

Finnaly, add a turret module to control the weapon, personally I use this:

  AddModule
    Behavior = AIUpdateInterface ModuleTag_Turret
      Turret
        ControlledWeaponSlots = PRIMARY
        TurretTurnRate        = 720
        FiresWhileTurning     = Yes
      End
      AutoAcquireEnemiesWhenIdle = Yes 
      MoodAttackCheckRate        = 250
    End
  End

Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Unknown Editor
8 years ago


AddModule
Behavior = AIUpdateInterface ModuleTag_Turret
Turret
ControlledWeaponSlots = PRIMARY
TurretTurnRate = 720
FiresWhileTurning = Yes
End
AutoAcquireEnemiesWhenIdle = Yes
MoodAttackCheckRate = 250
End
End

Originally Posted by: SkyMix_RMT 



SkyMix_RMT You are a genius ; I had tried Everything Instead of these , How Didn't I even Think about AIUpdateInterface Yet ?
By the Way , Now Everything is Ready and Prepared ; Just they Look not Auto Attack ! The Code:

Weapon BunkerCannonWeapon
  PrimaryDamage               = 20.0
  PrimaryDamageRadius         = 0.0
  AttackRange                 = 200.0
  MinimumAttackRange          = 10.0
  DamageType                  = Small_Arms
  DeathType                   = NORMAL
  WeaponSpeed                 = 999999.0
  ProjectileObject            = NONE
  FireSound                   = ComancheWeaponMachineGun
  FireFX                      = WeaponFX_HeroicComanche20mmCannonFire
  RadiusDamageAffects         = ALLIES ENEMIES NEUTRALS
  DelayBetweenShots           = 50
  ClipSize                    = 10
  ClipReloadTime              = 3000
  AutoReloadsClip             = Yes
  AntiAirborneVehicle         = No
  AntiAirborneInfantry        = Yes
End

Object CivilianBunker01

  KindOf                = +CAN_ATTACK +ATTACK_NEEDS_LINE_OF_SIGHT

  WeaponSet
    Conditions          = None
    Weapon              = PRIMARY BunkerCannonWeapon
  End

AddModule
  Behavior = AIUpdateInterface ModuleTag_AttackAI
    Turret
      ControlledWeaponSlots    = PRIMARY
      TurretTurnRate           = 360
      FiresWhileTurning        = Yes
    End
    AutoAcquireEnemiesWhenIdle = Yes
    MoodAttackCheckRate        = 240
  End
 End
End

Also a MAP :   Bunker_Test01.rar (34kb) downloaded 9 time(s).
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago


AddModule
Behavior = AIUpdateInterface ModuleTag_Turret
Turret
ControlledWeaponSlots = PRIMARY
TurretTurnRate = 720
FiresWhileTurning = Yes
End
AutoAcquireEnemiesWhenIdle = Yes
MoodAttackCheckRate = 250
End
End

Originally Posted by: Unknown Editor 



SkyMix_RMT You are a genius ; I had tried Everything Instead of these , How Didn't I even Think about AIUpdateInterface Yet ?
By the Way , Now Everything is Ready and Prepared ; Just they Look not Auto Attack ! The Code:

Weapon BunkerCannonWeapon
  PrimaryDamage               = 20.0
  PrimaryDamageRadius         = 0.0
  AttackRange                 = 200.0
  MinimumAttackRange          = 10.0
  DamageType                  = Small_Arms
  DeathType                   = NORMAL
  WeaponSpeed                 = 999999.0
  ProjectileObject            = NONE
  FireSound                   = ComancheWeaponMachineGun
  FireFX                      = WeaponFX_HeroicComanche20mmCannonFire
  RadiusDamageAffects         = ALLIES ENEMIES NEUTRALS
  DelayBetweenShots           = 50
  ClipSize                    = 10
  ClipReloadTime              = 3000
  AutoReloadsClip             = Yes
  AntiAirborneVehicle         = No
  AntiAirborneInfantry        = Yes
End

Object CivilianBunker01

  KindOf                = +CAN_ATTACK +ATTACK_NEEDS_LINE_OF_SIGHT

  WeaponSet
    Conditions          = None
    Weapon              = PRIMARY BunkerCannonWeapon
  End

AddModule
  Behavior = AIUpdateInterface ModuleTag_AttackAI
    Turret
      ControlledWeaponSlots    = PRIMARY
      TurretTurnRate           = 360
      FiresWhileTurning        = Yes
    End
    AutoAcquireEnemiesWhenIdle = Yes
    MoodAttackCheckRate        = 240
  End
 End
End

Also a MAP :

Originally Posted by: SkyMix_RMT 


Nice little test map, but I'm not seeing any turret action from the bunkers. 💀

Is there anything specific I need to do to the CivilianBuilding.ini file, or can this be implemented purely through Map.ini?
Unknown Editor
8 years ago


Nice little test map, but I'm not seeing any turret action from the bunkers. 💀

Is there anything specific I need to do to the CivilianBuilding.ini file, or can this be implemented purely through Map.ini?

Originally Posted by: Deinon 



The Only Problem Was It Wouldn't Work Automatically !
No AUTO Shots

But Then Understand It Needed "VisionRange" !!! The Newest Code :

Weapon BunkerCannonWeapon
  PrimaryDamage               = 25.0
  PrimaryDamageRadius         = 0.0
  AttackRange                 = 240.0
  MinimumAttackRange          = 10.0
  DamageType                  = Small_Arms
  DeathType                   = NORMAL
  WeaponSpeed                 = 999999.0
  ProjectileObject            = NONE
  FireSound                   = ComancheWeaponMachineGun
  FireFX                      = WeaponFX_HeroicComanche20mmCannonFire
  RadiusDamageAffects         = ALLIES ENEMIES NEUTRALS
  DelayBetweenShots           = 75
  ClipSize                    = 12
  ClipReloadTime              = 2500
  AutoReloadsClip             = Yes
  AntiAirborneVehicle         = No
  AntiAirborneInfantry        = Yes
End

Object CivilianBunker01

  VisionRange         = 240.0
  ShroudClearingRange = 360

  KindOf              = +CAN_ATTACK +ATTACK_NEEDS_LINE_OF_SIGHT

  WeaponSet
    Conditions        = None
    Weapon            = PRIMARY BunkerCannonWeapon
    AutoChooseSources = PRIMARY FROM_PLAYER FROM_AI FROM_SCRIPT
    PreferredAgainst  = PRIMARY INFANTRY VEHICLE
  End



AddModule
  Behavior = AIUpdateInterface ModuleTag_AttackAI
    Turret
      ControlledWeaponSlots   = PRIMARY
      TurretTurnRate          = 180
      FiresWhileTurning       = Yes
    End
    AutoAcquireEnemiesWhenIdle = Yes
    MoodAttackCheckRate        = 250
  End
 End
End

Now If You Garrison a Bunker With an Infantry as Soon as No Rangers are Close ,
You'll See The Bunker Will Attack them itself from Range 240 !
So , Don't Worry about the RPG Troopers 😎
The Map :   Bunker_Test01.rar (38kb) downloaded 7 time(s).
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
Unknown Editor
8 years ago
Case Closed
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
SkyMix_RMT
8 years ago
You also forgot to add the FIREPOINT.

It's optional, but makes it look much better, add this to the bunker code:


  ReplaceModule ModuleTag_01
    Draw = W3DModelDraw ModuleTag_01_Override
      OkToChangeModelColor = Yes    
      ;Day
      DefaultConditionState
        Model         = CBBunker01
        WeaponFireFXBone = PRIMARY FIREPOINT
      End
      ConditionState = DAMAGED
        Model         = CBBunker01_D
      End
      ConditionState = REALLYDAMAGED
        Model         = CBBunker01_E
      End
      ConditionState = RUBBLE
        Model         = CBBunker01_R
      End
      ;Day garrisoned
      ;Day garrisoned
      ConditionState = GARRISONED
        Model         = CBBunker01_G
        Animation     = CBBunker01_G.CBBunker01_G
        AnimationMode = LOOP
      End
      ConditionState = DAMAGED GARRISONED
        Model         = CBBunker01_DG
        Animation     = CBBunker01_DG.CBBunker01_DG
        AnimationMode = LOOP
      End
      ConditionState = REALLYDAMAGED GARRISONED
        Model         = CBBunker01_EG
        Animation     = CBBunker01_EG.CBBunker01_EG
        AnimationMode = LOOP
      End
    End
  End

Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Unknown Editor
8 years ago
Yeah , Right ; Case Wasn't Close :D
This was a Great Idea , I was thinking Sth is Missed .
as soon we may find other things to add to it too .
in a case that this topic will be a HOT & SPICY topic 🙂
Asking is Not a Problem , Problem is Not to Know Something .
Operation : Dark Angel
Static : Launch Delayed
Reason : Uncool Terrain - Old Logic in use - Lack of Performance
Status : Applying new Terrain - Applying new Logic - Increasing Performance by 300%
Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Awesome! Thanks! Works beautifully, and we don't even have to screw around with core game files.

I'm trying to add it to the GuardTower object now too. It works, but it only ever fires from the very bottom of the tower, even if you're trying to target aircraft. Is there a different WeaponFireFXBone I need to be using, other than PRIMARY FIREPOINT, so it'll always fire from the top of the tower? I don't suppose their names are listed anywhere...
Zatsupachi
8 years ago
If you open up 'CBTower2_G' the model with GMax/RenX pressing 'H' will list all of the model's components.

I'm not entirely sure why FIREPOINT isn't working for you unless you're using projectiles.
If you want projectiles launching off you need WeaponLaunchBone = PRIMARY FIREPOINT01

Either or maybe it's FIREPOINT01(there's up to 40, I don't know why.)
"It's precision_bomber."
Death Label HAS BEEN RELEASED(go get v0.99):
http://www.moddb.com/mods/death-label/downloads/death-label-ver-099 
Next Episode:
precision_bomber's Zero Hour SCIENCE!
Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago

If you open up 'CBTower2_G' the model with GMax/RenX pressing 'H' will list all of the model's components.

I'm not entirely sure why FIREPOINT isn't working for you unless you're using projectiles.
If you want projectiles launching off you need WeaponLaunchBone = PRIMARY FIREPOINT01

Either or maybe it's FIREPOINT01(there's up to 40, I don't know why.)

Originally Posted by: Zatsupachi 

Leaving out PRIMARY makes the game blow up. 😁

Using FIREPOINT01 results in the machine gun still firing from the base of the tower. I suppose I can play around with it, the whole idea was that the civilian bunker has a powerful machine gun which can only target ground units and the guard tower has a weaker machine gun which can target both air and ground. I'd hoped to get it so it will adjust the height from which the machine gun is fired inside the tower (as garrisoned units such as the rocket launcher in the tower can be seen doing).   TowerMG.png (2,490kb) downloaded 13 time(s).
Zatsupachi
8 years ago
I think I see the problem.

In Object GuardTower, it starts with 'ConditionState = NONE' as the default model which means, garrisoned version will not get from any other ConditionState.

Making a DefaultConditionState makes it so that if ever a specific bone is called from another model, it will call from the DefaultConditionState.


ReplaceModule ModuleTag_01
  Draw = W3DModelDraw ModuleTag_01
  OkToChangeModelColor = Yes

    DefaultConditionState ;Changed from ConditionState =None
      Model         = CBTower2
      WeaponFireFXBone = PRIMARY FIREPOINT01 ;For projectiles it's WeaponLaunchBone
    End
    ConditionState = DAMAGED
      Model         = CBTower2_D
    End
    ConditionState = REALLYDAMAGED
      Model         = CBTower2_E
    End
    ConditionState = RUBBLE
      Model         = CBTower2_R
    End

    ConditionState = GARRISONED
      Model         = CBTower2_G
      Animation     = CBTower2_G.CBTower2_G
      AnimationMode = LOOP
    End
    ConditionState = DAMAGED GARRISONED
      Model         = CBTower2_DG
      Animation     = CBTower2_DG.CBTower2_DG
      AnimationMode = LOOP
    End
  End
End

"It's precision_bomber."
Death Label HAS BEEN RELEASED(go get v0.99):
http://www.moddb.com/mods/death-label/downloads/death-label-ver-099 
Next Episode:
precision_bomber's Zero Hour SCIENCE!
Deinon
  • Deinon
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Works beautifully! Thanks!