Jundiyy
  • Jundiyy
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
OK So I wanted to make 2 types of command buttons but I am really confused on where to look, I tried to study the command button ini but I don't know where it takes me.

1. I have edited the artillery platform - it won't attack unless I click on it and it has a huge range across the map and shoots 5 shots per clip...
I want to make a command button that let's me click the button and then choose where to shoot, example a scud launcher, we can use force fire to shoot in places we can't see but I want to make a button which allows us to click the button then click on the ground.
(1.b. If it's possible to have a circle on the ground like we do for a paradrop that would be awesome but it's not the main concern).

2. Once a command button is made, is it possible to have a few command buttons, shoot 1 shell, shoot 3 shells, shoot 5 shells - of course for 1 shell the reload would be faster.
(There was a bit more to this question but I forgot it lol.)
Sponsor
Zatsupachi
8 years ago
If you want a non-auto-engaging unit, you must the WeaponSet code be like this:


WeaponSet
  Weapon = PRIMARY artyweapon
  PreferredAgainst = PRIMARY NONE ;this is important, so that it doesn't use it at all.
  AutoChooseSources = PRIMARY NONE ;this too, so not even force-firing tells it to use the weapon.
End

Then implement a button similar to ComancheRocketPods, make sure it fires the correct weapon slot, and add it to this object's commandset.

NOW-- THIS WILL SHOOT THE ENTIRE CLIP(OF 5).

If you want it shoot different numbers of shells, then create three different weapons. Each with a different ClipSize and ReloadTime.

Assign the weapons as above, all of them must be implemented the same way.
Then add the corresponding buttons for it.

And add this: ShareWeaponReloadTime = Yes

it should look like this:

WeaponSet
  Weapon = PRIMARY artyweapon1shot
  PreferredAgainst = PRIMARY NONE
  AutoChooseSources = PRIMARY NONE
  Weapon = SECONDARY artyweapon3shot
  PreferredAgainst = SECONDARY NONE
  AutoChooseSources = SECONDARY NONE
  Weapon = TERTIARY artyweapon5shot
  PreferredAgainst = TERTIARY NONE
  AutoChooseSources = TERTIARY NONE
  ShareWeaponReloadTime = Yes
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!
Jundiyy
  • Jundiyy
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Thanks a lot! That defo does help but the main problem before this one is that I don't understand how to get this type of command button to work or even make on.
I know how to make CONSTRUCT types, I can copy and paste weapon ones and edit the name, simple. But I don't understand these, the one that I tried looking at first was this

CommandButton Command_GLAToxinTractorContaminateGround
Command = FIRE_WEAPON
WeaponSlot = SECONDARY ; Best if this matches up with an AutoChoose listing that forbids this slot normally
Options = NEED_TARGET_POS OK_FOR_MULTI_SELECT
TextLabel = CONTROLBAR:Contaminate
ButtonImage = SSContaminate
ButtonBorderType = ACTION ; Identifier for the User as to what kind of button this is
DescriptLabel = CONTROLBAR:ToolTipGLAFireToxinTractorSlime
UnitSpecificSound = ToxinTractorVoiceModeContam
End

So I can't see where the actual weapon is that it will fire? It doesn't mention it at all.
Then I tried looking at the battleship as it is similar to what I want but again I can't see where it shows me the weapon. What is the main thing that I am missing here? I'm sure it will be easy to understand once I find it. (Like OCL, I didn't get it all but now I'm getting the hang of it a bit, managing to copy one and edit it).

CommandButton Command_BattleshipFire
Command = FIRE_WEAPON
WeaponSlot = PRIMARY
Options = OK_FOR_MULTI_SELECT NEED_TARGET_POS CONTEXTMODE_COMMAND
TextLabel = CONTROLBAR:BattleshipFire
ButtonImage = SSBarrage
CursorName = Target
InvalidCursorName = GenericInvalid
ButtonBorderType = ACTION ; Identifier for the User as to what kind of button this is
DescriptLabel = CONTROLBAR:ToolTipFireBattleship
End


P.S.

Thanks for the first tip as well.

WeaponSet
Weapon = PRIMARY artyweapon
PreferredAgainst = PRIMARY NONE ;this is important, so that it doesn't use it at all.
AutoChooseSources = PRIMARY NONE ;this too, so not even force-firing tells it to use the weapon.
End

I didn't know you could deny force fire, I just simply edited the engineering to stop it from firing. Yes to No, would still do the same thing as 'PreferredAgainst'?


AutoAcquireEnemiesWhenIdle = Yes ;ATTACK_BUILDINGS; defensive weapon
Zatsupachi
8 years ago
AutoAcquireEnemiesWhenIdle basically means whether or not it should automatically acquire targets to shoot at. If you set it to 'No' then, it will not engage the targets, but you can still order it to attack, and if it has a weapon it can use it will use it.

AutoChooseFromSources and PreferredAgainst help in choosing what weapon the object must use:

AutoChooseFromSources = FROM_PLAYER ;only use this weapon when ordered by the player.
AutoChooseFromSources = FROM_AI ;only use this weapon when NOT ordered by the player, only use when target is auto-acquired.
AutoChooseFromSources = FROM_PLAYER FROM_AI ;use this weapon regardless if ordered by the player or through auto-acquisition.
AutoChooseFromSources = NONE ;do not use this weapon at all, unless overridden by commandbutton.
PreferredAgainst = ;can use this weapon against this KindOf

ex.: PreferredAgainst = INFANTRY ;can use this weapon when acquired target is infantry.

I hope this chart explains how an object uses weapons:

>Target Acquisition(types: player command, auto-acquisition)
> Try PRIMARY WEAPON
> Check AutoChooseFromSources if it matches acquisition type and not NONE
> Check PreferredAgainst if target is the appropriate KindOf and not NONE
> If all flags are true, use PRIMARY WEAPON
> Else, go to next weapon
> Try SECONDARY WEAPON, etc., etc.

This is quite simple actually.

CommandButton Command_BattleshipFire
Command = FIRE_WEAPON    ;Fire a Weapon
WeaponSlot = PRIMARY     ;WHAT WEAPON SLOT WILL IT USE
Options = OK_FOR_MULTI_SELECT NEED_TARGET_POS CONTEXTMODE_COMMAND ;PROPERTIES OF THE COMMAND
TextLabel = CONTROLBAR:BattleshipFire
ButtonImage = SSBarrage
CursorName = Target
InvalidCursorName = GenericInvalid
ButtonBorderType = ACTION ; Identifier for the User as to what kind of button this is
DescriptLabel = CONTROLBAR:ToolTipFireBattleship
End 

Though I think you can find a better example with Comanche Rocket Pods by just removing the Upgrade property and 'NEED_UPGRADE' Option bit type.
"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!
Jundiyy
  • Jundiyy
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Weapons



;------------------------------------------------------------------------------
Weapon ArtilleryBarrageGun3
PrimaryDamage = 50.0
PrimaryDamageRadius = 15.0
ScatterRadius = 15.0
ScatterRadiusVsInfantry = 15.0 ;When this weapon is used against infantry, it can randomly miss by as much as this distance.
AttackRange = 1500.0 ;500.0
MinimumAttackRange = 700.0
MinTargetPitch = -10 ; we may not target anything outside of this pitch range
MaxTargetPitch = 80 ; ditto
DamageType = EXPLOSION
DeathType = EXPLODED
WeaponSpeed = 250 ; dist/sec
WeaponRecoil = 5 ; angle to deflect the model when firing
ScaleWeaponSpeed = Yes ; Used for lob weapons, scales speed proportional to range ; dist/sec
ProjectileObject = StrategyCenterArtilleryShell
;ProjectileExhaust = MissileExhaust
FireFX = WeaponFX_GenericTankGunNoTracer
ProjectileDetonationFX = FX_StrategyCenterBarrage
FireSound = StrategyCenter_ArtilleryRound
RadiusDamageAffects = ALLIES ENEMIES NEUTRALS
DelayBetweenShots = 350 ; time between shots, msec
ClipSize = 5 ; how many shots in a Clip (0 == infinite)
ClipReloadTime = 2000 ; how long to reload a Clip, msec
AutoReloadsClip = Yes
AntiAirborneVehicle = No
AntiAirborneInfantry = No
AntiGround = Yes
AntiBallisticMissile = No
WeaponBonus = PLAYER_UPGRADE DAMAGE 125% ; UraniumShells

; note, these only apply to units that aren't the explicit target
; (ie, units that just happen to "get in the way"... projectiles
; always collide with the Designated Target, regardless of these flags
ProjectileCollidesWith = STRUCTURES WALLS
End

;------------------------------------------------------------------------------
Weapon ArtilleryBarrageGun2
PrimaryDamage = 50.0
PrimaryDamageRadius = 15.0
ScatterRadius = 15.0
ScatterRadiusVsInfantry = 15.0 ;When this weapon is used against infantry, it can randomly miss by as much as this distance.
AttackRange = 1500.0 ;500.0
MinimumAttackRange = 700.0
MinTargetPitch = -10 ; we may not target anything outside of this pitch range
MaxTargetPitch = 80 ; ditto
DamageType = EXPLOSION
DeathType = EXPLODED
WeaponSpeed = 250 ; dist/sec
WeaponRecoil = 5 ; angle to deflect the model when firing
ScaleWeaponSpeed = Yes ; Used for lob weapons, scales speed proportional to range ; dist/sec
ProjectileObject = StrategyCenterArtilleryShell
;ProjectileExhaust = MissileExhaust
FireFX = WeaponFX_GenericTankGunNoTracer
ProjectileDetonationFX = FX_StrategyCenterBarrage
FireSound = StrategyCenter_ArtilleryRound
RadiusDamageAffects = ALLIES ENEMIES NEUTRALS
DelayBetweenShots = 350 ; time between shots, msec
ClipSize = 3 ; how many shots in a Clip (0 == infinite)
ClipReloadTime = 1200 ; how long to reload a Clip, msec
AutoReloadsClip = Yes
AntiAirborneVehicle = No
AntiAirborneInfantry = No
AntiGround = Yes
AntiBallisticMissile = No
WeaponBonus = PLAYER_UPGRADE DAMAGE 125% ; UraniumShells

; note, these only apply to units that aren't the explicit target
; (ie, units that just happen to "get in the way"... projectiles
; always collide with the Designated Target, regardless of these flags
ProjectileCollidesWith = STRUCTURES WALLS
End

;------------------------------------------------------------------------------
Weapon ArtilleryBarrageGun1
PrimaryDamage = 50.0
PrimaryDamageRadius = 15.0
ScatterRadius = 15.0
ScatterRadiusVsInfantry = 15.0 ;When this weapon is used against infantry, it can randomly miss by as much as this distance.
AttackRange = 1500.0 ;500.0
MinimumAttackRange = 700.0
MinTargetPitch = -10 ; we may not target anything outside of this pitch range
MaxTargetPitch = 80 ; ditto
DamageType = EXPLOSION
DeathType = EXPLODED
WeaponSpeed = 250 ; dist/sec
WeaponRecoil = 5 ; angle to deflect the model when firing
ScaleWeaponSpeed = Yes ; Used for lob weapons, scales speed proportional to range ; dist/sec
ProjectileObject = StrategyCenterArtilleryShell
;ProjectileExhaust = MissileExhaust
FireFX = WeaponFX_GenericTankGunNoTracer
ProjectileDetonationFX = FX_StrategyCenterBarrage
FireSound = StrategyCenter_ArtilleryRound
RadiusDamageAffects = ALLIES ENEMIES NEUTRALS
DelayBetweenShots = 350 ; time between shots, msec
ClipSize = 1 ; how many shots in a Clip (0 == infinite)
ClipReloadTime = 400 ; how long to reload a Clip, msec
AutoReloadsClip = Yes
AntiAirborneVehicle = No
AntiAirborneInfantry = No
AntiGround = Yes
AntiBallisticMissile = No
WeaponBonus = PLAYER_UPGRADE DAMAGE 125% ; UraniumShells

; note, these only apply to units that aren't the explicit target
; (ie, units that just happen to "get in the way"... projectiles
; always collide with the Designated Target, regardless of these flags
ProjectileCollidesWith = STRUCTURES WALLS
End



Regarding the construction I mentioned at the start, is there anyway to get perfect construction and fencing? At the moment I just copy and past another one into it that is similar size. So for the platform I will probably take the tunnelnetwork contruction.
Zatsupachi
8 years ago
I'm not sifting through that code unless you check CrashReleaseInfo.txt in your Documents/Command and Conquer Generals Zero Hour folder OR you run WorldBuilder to see if the bug checker tells you something about it.

Also, for perfect construction with fencing and stuffs, You'll have to make the model yourself if you want it to be a unique fence and other related visual stuffs.
"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!
Jundiyy
  • Jundiyy
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago

I'm not sifting through that code unless you check CrashReleaseInfo.txt in your Documents/Command and Conquer Generals Zero Hour folder OR you run WorldBuilder to see if the bug checker tells you something about it.

Also, for perfect construction with fencing and stuffs, You'll have to make the model yourself if you want it to be a unique fence and other related visual stuffs.

Originally Posted by: Zatsupachi 



Thanks, yea sorry, thought I would provide all the info in one go. I always use worldbuilder to help me with my problems (even though I'm new to modding but I have managed to make just over 20, maybe 25 units/buildings - nothing compared to you guys lol) so I always check with worldbuilder after every few steps or edits. This wasn't giving me any errors this time.

I never thought of CrashReleaseInfo to be honest, but it directed me to my command lines, which I checked and the problem was that I had added CommandButton rather than Command.

All done now thanks BUT 1 (or 2) small problem(s) left.

I left all 3 weapon codes in the message above for you to look at.

1. Main problem, when I shoot 3 or 5 shots, the artillery platform stops shooting after it has compleyed 3 or 5 shots - that is how I want it but when I click single shot, it just keeps shooting non stop, any idea why or how to stop it (apart from clicking the stop button)?

The main line I took out of weapons was
ShotsPerBarrel = 1 ; By default, shoot one shot per barrel
and I added clip size to all 3 weapons (what's the difference anyway? But I don't think this is the problem as the 3 and 5 are fine.)

2. As you can see I have the platform on a max and minimum range, when I tested it, it's fine but it's very hard to determine where that middle range is, the rocket pod cursor can be clicked anywhere but the platform will only shoot if you click in the right range amount. Is there any sort of guard mode cursor I can use when I click on the platform which will show me the range I can shoot into?

P.S.
3. The button image shows a Chinese command centre for some reason even though it doesn't say so
SelectPortrait = SAArtillery_L
ButtonImage = SAArtillery
Any ideas? Guess it's just a mistake when making the game?
Jundiyy
  • Jundiyy
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Any thoughts anyone?
SkyMix_RMT
8 years ago


AutoChooseFromSources and PreferredAgainst help in choosing what weapon the object must use:

AutoChooseFromSources = FROM_PLAYER ;only use this weapon when ordered by the player.
AutoChooseFromSources = FROM_AI ;only use this weapon when NOT ordered by the player, only use when target is auto-acquired.
AutoChooseFromSources = FROM_PLAYER FROM_AI ;use this weapon regardless if ordered by the player or through auto-acquisition.
AutoChooseFromSources = NONE ;do not use this weapon at all, unless overridden by commandbutton.
PreferredAgainst = ;can use this weapon against this KindOf

Originally Posted by: Zatsupachi 



It's "AutoChooseSources" not "AutoChooseFromSources". Just correcting because it made my game crash.

Also what does "FROM_SCRIPT" do?


Check out:
My Music  (Techno/House/Experimental)
My Website  (GeneralsCentral)
My Youtube Channel  (Inactive)
World Builder Community Discord 
Zatsupachi
8 years ago
FROM_SCRIPT comes from map scripts.
"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!
nymi
  • nymi
  • 50.25% (Neutral)
  • Private
8 years ago
I think this is related so ill post here. How do you make defenses fire when they are stealthed since they dont fire at all even if the target is near unless you manually target it. I stealthed my gattling gun and it cant fire anymore. Need some help. Thanks.
Jundiyy
  • Jundiyy
  • 50.25% (Neutral)
  • Captain Topic Starter
8 years ago
Is this any good to you?

Behavior = AIUpdateInterface ModuleTag_06
AutoAcquireEnemiesWhenIdle = Yes ;ATTACK_BUILDINGS; defensive weapon
MoodAttackCheckRate = 250
End