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

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline Jundiyy  
#1 Posted : Tuesday, September 26, 2017 9:39:07 AM(UTC)
Jundiyy
Captain
Joined: 1/8/2017(UTC)
Posts: 78

Was thanked: 4 time(s) in 4 post(s)
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
Offline Zatsupachi  
#2 Posted : Tuesday, September 26, 2017 10:31:54 AM(UTC)
Zatsupachi
Major
Joined: 3/27/2015(UTC)
Posts: 490

Thanks: 5 times
Was thanked: 213 time(s) in 155 post(s)
If you want a non-auto-engaging unit, you must the WeaponSet code be like this:

Code:

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:
Code:

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

Edited by user Tuesday, September 26, 2017 10:36:30 AM(UTC)  | Reason: Not specified

"It's precision_bomber."

Death Label HAS BEEN RELEASED(go get v0.99):
http://www.moddb.com/mod...oads/death-label-ver-099

Next Episode:
precision_bomber's Zero Hour SCIENCE!
thanks 1 user thanked Zatsupachi for this useful post.
CommieDog on 10/2/2017(UTC)
Offline Jundiyy  
#3 Posted : Tuesday, September 26, 2017 3:33:30 PM(UTC)
Jundiyy
Captain
Joined: 1/8/2017(UTC)
Posts: 78

Was thanked: 4 time(s) in 4 post(s)
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

Edited by user Tuesday, September 26, 2017 3:37:22 PM(UTC)  | Reason: Not specified

Offline Zatsupachi  
#4 Posted : Tuesday, September 26, 2017 5:46:17 PM(UTC)
Zatsupachi
Major
Joined: 3/27/2015(UTC)
Posts: 490

Thanks: 5 times
Was thanked: 213 time(s) in 155 post(s)
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 = <slot> FROM_PLAYER ;only use this weapon when ordered by the player.
AutoChooseFromSources = <slot> FROM_AI ;only use this weapon when NOT ordered by the player, only use when target is auto-acquired.
AutoChooseFromSources = <slot> FROM_PLAYER FROM_AI ;use this weapon regardless if ordered by the player or through auto-acquisition.
AutoChooseFromSources = <slot> NONE ;do not use this weapon at all, unless overridden by commandbutton.
PreferredAgainst = <slot> <KindOf> ;can use this weapon against this KindOf

ex.: PreferredAgainst = <slot> 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.
Code:

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.

Edited by user Tuesday, September 26, 2017 5:55:16 PM(UTC)  | Reason: Not specified

"It's precision_bomber."

Death Label HAS BEEN RELEASED(go get v0.99):
http://www.moddb.com/mod...oads/death-label-ver-099

Next Episode:
precision_bomber's Zero Hour SCIENCE!
thanks 4 users thanked Zatsupachi for this useful post.
SkyMix_RMT on 9/26/2017(UTC), acidbrain on 9/27/2017(UTC), Unknown Editor on 9/30/2017(UTC), CommieDog on 10/12/2017(UTC)
Offline Jundiyy  
#5 Posted : Thursday, September 28, 2017 3:42:00 AM(UTC)
Jundiyy
Captain
Joined: 1/8/2017(UTC)
Posts: 78

Was thanked: 4 time(s) in 4 post(s)
Weapons


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.

Edited by user Friday, September 29, 2017 4:14:32 AM(UTC)  | Reason: Not specified

Offline Zatsupachi  
#6 Posted : Thursday, September 28, 2017 4:21:40 PM(UTC)
Zatsupachi
Major
Joined: 3/27/2015(UTC)
Posts: 490

Thanks: 5 times
Was thanked: 213 time(s) in 155 post(s)
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/mod...oads/death-label-ver-099

Next Episode:
precision_bomber's Zero Hour SCIENCE!
Offline Jundiyy  
#7 Posted : Thursday, September 28, 2017 6:35:11 PM(UTC)
Jundiyy
Captain
Joined: 1/8/2017(UTC)
Posts: 78

Was thanked: 4 time(s) in 4 post(s)
Originally Posted by: Zatsupachi Go to Quoted Post
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.


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?

Edited by user Friday, September 29, 2017 2:10:35 AM(UTC)  | Reason: Added another question

Offline Jundiyy  
#8 Posted : Saturday, September 30, 2017 1:58:01 PM(UTC)
Jundiyy
Captain
Joined: 1/8/2017(UTC)
Posts: 78

Was thanked: 4 time(s) in 4 post(s)
Any thoughts anyone?
Offline SkyMix_RMT  
#9 Posted : Friday, October 6, 2017 11:42:54 AM(UTC)
SkyMix_RMT
Major
Joined: 2/21/2015(UTC)
Posts: 386
Portugal

Thanks: 80 times
Was thanked: 132 time(s) in 96 post(s)
Originally Posted by: Zatsupachi Go to Quoted Post

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

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


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
Offline Zatsupachi  
#10 Posted : Friday, October 6, 2017 8:34:06 PM(UTC)
Zatsupachi
Major
Joined: 3/27/2015(UTC)
Posts: 490

Thanks: 5 times
Was thanked: 213 time(s) in 155 post(s)
FROM_SCRIPT comes from map scripts.
"It's precision_bomber."

Death Label HAS BEEN RELEASED(go get v0.99):
http://www.moddb.com/mod...oads/death-label-ver-099

Next Episode:
precision_bomber's Zero Hour SCIENCE!
Offline nymi  
#11 Posted : Saturday, October 7, 2017 2:47:42 AM(UTC)
nymi
Private
Joined: 9/18/2017(UTC)
Posts: 6

Thanks: 3 times
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.
Offline Jundiyy  
#12 Posted : Monday, October 9, 2017 4:06:57 PM(UTC)
Jundiyy
Captain
Joined: 1/8/2017(UTC)
Posts: 78

Was thanked: 4 time(s) in 4 post(s)
Is this any good to you?

Behavior = AIUpdateInterface ModuleTag_06
AutoAcquireEnemiesWhenIdle = Yes ;ATTACK_BUILDINGS; defensive weapon
MoodAttackCheckRate = 250
End
thanks 1 user thanked Jundiyy for this useful post.
nymi on 10/11/2017(UTC)
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.