• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Removing standart command buttons with CommandFunc.txt

Status
Not open for further replies.
Level 7
Joined
Aug 23, 2014
Messages
208

Command Buttons Stacking

142464d1421566728-removing-standart-command-buttons-commandfunc-txt-commandbuttonstacking.png
You do not have enough space on the unit's command card because standard buttons occupy it?
Now you can fix it! Fold unnecessary buttons under top-left corner button and free some space for abilities.
Bonus: hidden buttons are not activated when you press their shortcuts on the keyboard. You can assign a skill shortcut to the vacant key.
Note: these changes will apply to all units and all players, use wisely!

[thread=261633]View tutorial[/thread] or Download DEMO



How to use?


1. Make a copy of Units\CommandFunc.txt file from war3.mpq
2. Open it with Notepad
3. Change lines "Buttonpos=X,Y" to "Buttonpos=-2147483648,-2147483648" for all command buttons you want to stack.
4. Save file
5. Import file in your map
6. Change imported file full path to "Units\CommandFunc.txt" (Right click -> Modify File Properties... -> check Use custom path -> type new path in enabled textbox -> OK)
7. Save map and test how it works!

How to define stacking type?


1. Open Object Editor in World Editor (F6)
2. Open Units tab
3. Select: Standart Units -> Human -> Melee -> Buildings -> Guard Tower (hgtw)*
3.5 Copy it if you want use standart Guard Tower in map later.
4. Modify Standart Guard Tower:
- for Type A stacking you must keep tower attack ability. (when you select tower, you must see Attack button)
- for Type B stacking you must set Movement - Speed Base to 1 (or higher value). (when you select tower, you must see Move button)
4.5 You can change different values to make tower more "dummy", but keep in mind:
- Stats - Is a Building must be TRUE
- If you changing attack, watch attack availability in command card.
- Guard Tower must be visible for all players. However, you can replace model with dummy and make it unselectable with Locust.
5. Place edited Guard Tower on the map.
6. Change ownership of placed Guard Tower to Neutral Passive. (so it will not interfere normal gameplay)
7. Save map and test it!
*If you find an object that overrides Guard Tower, please write it in comments.

Warning! Stacking order is always set to Type A after loading saved game. Keep it in mind if your map uses standart Save/Load.

Important info

  • Stacking order depends on placed on the map units at the game start.
  • Stacking order does not change during the game.
  • Buttons stacking works properly only in 0,0 slot of command card (top-left). Attempts to stack two command buttons in other slots led to crashes.
  • Minimal value for start stacking buttons is "Buttonpos=-2147483648,-2147483648" (closer to 0 values lead to crashes in some situations, still not sure what effect have closer to -inf values).
  • Hidden in the stack buttons can not be activated via shortcuts. Only displayed buttons work.
  • This method changes command card for all units and all players.
  • It seems that this method does not cause game crashes. Nevertheless, I advise to use it with caution as all "hacks".

Button stacking order from uppermost to the bottom for the normal unit

Type A
142457d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattack.png
Attack
[tr]
142458d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattackground.png
Attack
Ground
[tr]
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142455d1421560336-removing-standart-command-buttons-commandfunc-txt-btnmove.png
M ove
142456d1421560336-removing-standart-command-buttons-commandfunc-txt-btnpatrol.png
P atrol
142253d1420869663-why-gaias-page-hosted-projects-empty-pvp.png
H old
Position
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
Type B
142455d1421560336-removing-standart-command-buttons-commandfunc-txt-btnmove.png
M ove
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142456d1421560336-removing-standart-command-buttons-commandfunc-txt-btnpatrol.png
P atrol
142253d1420869663-why-gaias-page-hosted-projects-empty-pvp.png
H old
Position
142457d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattack.png
Attack
[tr]
142458d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattackground.png
Attack
Ground
[tr]
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]

Button stacking order for stationary unit (Movement - Speed Base = 0)

Type A
142457d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattack.png
Attack
[tr]
142458d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattackground.png
Attack
Ground
[tr]
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
Type B
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142457d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattack.png
Attack
[tr]
142458d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattackground.png
Attack
Ground
[tr]
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]

Button stacking order for unit without attacks (Combat - Attacks Enabled = None)

Type A
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142455d1421560336-removing-standart-command-buttons-commandfunc-txt-btnmove.png
M ove
142456d1421560336-removing-standart-command-buttons-commandfunc-txt-btnpatrol.png
P atrol
142253d1420869663-why-gaias-page-hosted-projects-empty-pvp.png
H old
Position
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
Type B
142455d1421560336-removing-standart-command-buttons-commandfunc-txt-btnmove.png
M ove
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142456d1421560336-removing-standart-command-buttons-commandfunc-txt-btnpatrol.png
P atrol
142253d1420869663-why-gaias-page-hosted-projects-empty-pvp.png
H old
Position
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]

Button stacking order for unit with hidden attacks (Combat - Attack 1&2 - Show UI = false)

Type A
142458d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattackground.png
Attack
Ground*
[tr]
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142455d1421560336-removing-standart-command-buttons-commandfunc-txt-btnmove.png
M ove
142456d1421560336-removing-standart-command-buttons-commandfunc-txt-btnpatrol.png
P atrol
142253d1420869663-why-gaias-page-hosted-projects-empty-pvp.png
H old
Position
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
Type B
142455d1421560336-removing-standart-command-buttons-commandfunc-txt-btnmove.png
M ove
142454d1421560336-removing-standart-command-buttons-commandfunc-txt-btnstop.png
S top
142456d1421560336-removing-standart-command-buttons-commandfunc-txt-btnpatrol.png
P atrol
142253d1420869663-why-gaias-page-hosted-projects-empty-pvp.png
H old
Position
142458d1421560342-removing-standart-command-buttons-commandfunc-txt-btnattackground.png
Attack
Ground*
[tr]
142252d1420869663-why-gaias-page-hosted-projects-empty-herotalents.png
Her o
abilities
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
[tr][/td]
*Attack ground does nothing when clicked/shortcutted, so you can use it for map rules info tooltip for example.


[CmdMove]
Art=CommandMove
Buttonpos=-2147483648,-2147483648

[CmdAttack]
Art=CommandAttack
Buttonpos=-2147483648,-2147483648

[CmdAttackGround]
Art=CommandAttackGround
Buttonpos=-2147483648,-2147483648

[CmdBuild]
Art=CommandBasicStruct
Buttonpos=0,2

[CmdBuildHuman]
Art=CommandBasicStructHuman
Buttonpos=0,2

[CmdBuildOrc]
Art=CommandBasicStructOrc
Buttonpos=0,2

[CmdBuildNightElf]
Art=CommandBasicStructNightElf
Buttonpos=0,2

[CmdBuildUndead]
Art=CommandBasicStructUndead
Buttonpos=0,2

[CmdCancel]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelBuild]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelTrain]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelRevive]
Art=CommandCancel
ButtonPos=3,2

[CmdHoldPos]
Art=CommandHoldPosition
Buttonpos=-2147483648,-2147483648

[CmdPatrol]
Art=CommandPatrol
Buttonpos=-2147483648,-2147483648

[CmdPurchase]
Art=CommandPurchase
Buttonpos=0,0

[CmdRally]
Art=CommandRally
Buttonpos=3,1
PlacementModel=UI\Feedback\RallyPoint\RallyPoint.mdl

[CmdSelectSkill]
Art=CommandNewSkill
Buttonpos=-2147483648,-2147483648

[CmdStop]
Art=CommandStop
Buttonpos=-2147483648,-2147483648

//[CmdUnivAgi]
//Art=
//Buttonpos=2,0

//[CmdUnivInt]
//Art=
//Buttonpos=1,0

//[CmdUnivStr]
//Art=
//Buttonpos=0,0

What can you do with it?


AZERTY friendly spell layout for 8 spells
Layout with 11 free slots (10+1 for heroes)
142459d1421563183-removing-standart-command-buttons-commandfunc-txt-layoutertydfgh.jpg
142461d1421564227-removing-standart-command-buttons-commandfunc-txt-layout_10_11.jpg
Configure as you wish!

What do you think about this discovery?


After a bit of playing with large values in imported Units\CommandFunc.txt I received a very interesting result:
142425d1421446128-removing-standart-command-buttons-commandfunc-txt-commandbuttonsdecreased.jpg


As you can see part of the standard buttons removed from the panel. Proof map: View attachment TestCmdButtons.w3x

It happened when I set Buttonpos to extremely low values -9999999999,-9999999999. It seems that buttons with this values doesn't displayed on the panel. After some experimentation I found what only "Move" button can not be removed from panel. Also I noticed that hidden buttons doesn't react on shortcuts.
At first glance, the game does not crash when selecting a unit. But most likely, this method has pitfalls, as all hacks. Need more testing to find them. (Found literally two hours ago) :)

[CmdMove]
Art=CommandMove
Buttonpos=0,0

[CmdAttack]
Art=CommandAttack
Buttonpos=1,0

[CmdAttackGround]
Art=CommandAttackGround
Buttonpos=1,0

[CmdBuild]
Art=CommandBasicStruct
Buttonpos=0,2

[CmdBuildHuman]
Art=CommandBasicStructHuman
Buttonpos=0,2

[CmdBuildOrc]
Art=CommandBasicStructOrc
Buttonpos=0,2

[CmdBuildNightElf]
Art=CommandBasicStructNightElf
Buttonpos=0,2

[CmdBuildUndead]
Art=CommandBasicStructUndead
Buttonpos=0,2

[CmdCancel]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelBuild]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelTrain]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelRevive]
Art=CommandCancel
ButtonPos=3,2

[CmdHoldPos]
Art=CommandHoldPosition
Buttonpos=-9999999999,-9999999999

[CmdPatrol]
Art=CommandPatrol
Buttonpos=-9999999999,-9999999999

[CmdPurchase]
Art=CommandPurchase
Buttonpos=0,0

[CmdRally]
Art=CommandRally
Buttonpos=3,1
PlacementModel=UI\Feedback\RallyPoint\RallyPoint.mdl

[CmdSelectSkill]
Art=CommandNewSkill
Buttonpos=3,0

[CmdStop]
Art=CommandStop
Buttonpos=-9999999999,-9999999999

//[CmdUnivAgi]
//Art=
//Buttonpos=2,0

//[CmdUnivInt]
//Art=
//Buttonpos=1,0

//[CmdUnivStr]
//Art=
//Buttonpos=0,0
attachment.php


Found a way to hide ALL standart command buttons! Proof map: View attachment HideAllCmdButtons.w3x (for demonstration purposes there are all command buttons hidden, even Hero Abilities and Cancel)
If you set "Buttonpos=9999999999,-9999999999" to button in "Units/CommandFunc.txt" it will dissapear from command card of all units!
Side effect: hidden buttons can not be activated via shortcuts. Thus it is possible to make Friendly Fire protection with removing attack button.
[CmdPatrol]
Art=CommandPatrol
Buttonpos=9999999999,-9999999999
Still need testing for crash situations, but the possibilities already look great.

Command ButtonName in CommandFunc.txtCan hide?
Move[td][CmdMove]Yes
Attack[td][CmdAttack]Yes
Attack Ground[CmdAttackGround]Yes
Build Structure[CmdBuild]World Editor
Build Structure[CmdBuildHuman]World Editor
Build Structure[CmdBuildOrc]World Editor
Create Building[CmdBuildNightElf]World Editor
Summon Building[CmdBuildUndead]World Editor
Cancel (in Spellbook, etc)[CmdCancel]Yes
Cancel[CmdCancelBuild]Yes
Cancel[CmdCancelTrain]Yes
Cancel[CmdCancelRevive]Yes
Hold Position[CmdHoldPos]Yes
Patrol[CmdPatrol]Yes
Didn't find what is it[CmdPurchase]???
Set Rally Point[CmdRally]World Editor
Hero Abilities[CmdSelectSkill]Yes
Stop[CmdStop]Yes
*World Editor means what button position overrided in WE. Editor prohibits enormous values, so hide this buttons without something like hack for WE isn't possible.

Keep in mind that these changes affect all units on the map.
Also, I do not recommend removing cancel buttons, because it disables ESC button and may be frustrating in some cases.

UPD: Interesting. When it tested from JNGP multiplayer emulation everything works fine, but in normal warcraft III game it causes memory error and game close when selecting a unit. Hmm... Looks like big positive values in Buttonpos makes game adress something into wrong memory section. So this approach is too dangerous.
Extreme values also repeat standart button layout, so you can stack all 5(7?) unit command buttons into any position.

Buttonpos=X,Y
-2147483648-2147483647-2147483646-2147483645X / Y
-2147483648
-2147483647
-2147483646
Also, this approach doesn't crash my game yet. So maybe it's safe (still need more tests).
After some experimentation with extreme values of 32-bit integer I found something interesting. Buttons with low values are not sorted automatically. They overlap eachother. The uppermost icon depends on some unknow yet reasons (suspect that it depends on first loaded in the memory unit, if it can move - first will be Move, if it can only attack - Attack). Some facts:
- If there are guard tower (or any other building of this type) at the beginning of the map, icons will be: Attack for battle units, and Stop for units without attack.
- If there are only units (even stationary with attacks), uppermost icon will be Move, and Stop for stationary units.
- Uppermost icons are same for all players and they depend on the placed on the map objects.
- Icons order will be fixed during the game, even if you build guard tower with starting top Move button. However, if you Save and then Load game with builded towers, your uppermost icon will be Attack.
- If a player has Attack orders on the top: units with hidden attack (Show UI - false) will have Stop button at the top; siege units with hidden siege attacks will have Attack Ground button at the top, but it doesn't interactive (you can not select area for AoE attacks, just like in normal map); stationary units with hidden attack will have all 12 slots free (just like in normal map).

CommandButtonsDecreased.jpgWC3ScrnShot_011715_010245_01.jpgWC3ScrnShot_011715_095405_01.jpgAllStandartIconsHidden.jpgBTNStop.pngBTNMove.pngBTNPatrol.pngBTNAttack.pngBTNAttackGround.pngLayoutERTYDFGH.jpgLayout_10_11.jpgCommandButtonStacking.png

 

Attachments

  • CommandFunc_ERTYDFGH.txt
    1.2 KB · Views: 987
  • CommandFunc_10_11.txt
    1.3 KB · Views: 889
  • CommandButtonsStackingDemo.w3x
    49.2 KB · Views: 1,062
Last edited:
Level 21
Joined
Mar 27, 2012
Messages
3,232
Actually I do see a use for this.

I believe it can be used for allowing the overriding of buttons. For instance, if I wanted attacks to have a cooldown indicator for whatever reason, then I would just put an ability into the slot. It seems to me that overriding can be done at any point of the game.

This is very promising if it can be used like that.
 
Level 7
Joined
Aug 23, 2014
Messages
208
Actually I do see a use for this...
It seems that completely buttons override isn't possible, because you will have at least one standart button which has a higher priority than abilities.

Personally, I see this useful for:
- Action maps with limited game objects. You can make units with 11 free slots for abilities, that can be mapped to Q,W,E,R,T + A,S,D,F,G + her"O" abilities/options/etc + "M"ove.
- RPG maps with custom hero skillpoints distribution - you can hide standart button under Move/Attack and place new with triggered spell learning spell book (and you can still see number of skill points on the hero portrait).
- Freeing "A" and "S" shortcuts (but it imposes restrictions on some map objects to prevent Attack and Stop buttons popping out)
- Adding two free slots from removing Patrol and Hold Position buttons.
Hold Position functionality can be restored with triggers (because it very useful in some cases), for example check distance between current position and move order, if it is small - set Hold Position instead of Move order.
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
I see this very useful too, it allows you to hide the buttons without removing the commands(you can still move, patrol, attack etc) and you suddenly can have 11 spell slots for RPGs for instance, or as mentioned before, indicating cooldowns on attacks, and there sure are more uses for this
 
Level 7
Joined
Aug 23, 2014
Messages
208
This is interesting indeed. Can youdo more tests on this especially to find how to remove all buttons without crashes? Rpg maps usuallydont need those commands except for attack and stop. Id love to have a way to use 9 spells without having to use spellbooks :)
You mean something like this?

142444d1421518230-removing-standart-command-buttons-commandfunc-txt-collapsedcommandbuttonshero.jpg


It is easy to implement, you only need to place guard tower somewhere on the map to initialize Attack/Stop buttons top position.
[CmdMove]
Art=CommandMove
Buttonpos=-2147483648,-2147483648

[CmdAttack]
Art=CommandAttack
Buttonpos=1,0

[CmdAttackGround]
Art=CommandAttackGround
Buttonpos=-2147483648,-2147483648

[CmdBuild]
Art=CommandBasicStruct
Buttonpos=0,2

[CmdBuildHuman]
Art=CommandBasicStructHuman
Buttonpos=0,2

[CmdBuildOrc]
Art=CommandBasicStructOrc
Buttonpos=0,2

[CmdBuildNightElf]
Art=CommandBasicStructNightElf
Buttonpos=0,2

[CmdBuildUndead]
Art=CommandBasicStructUndead
Buttonpos=0,2

[CmdCancel]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelBuild]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelTrain]
Art=CommandCancel
ButtonPos=3,2

[CmdCancelRevive]
Art=CommandCancel
ButtonPos=3,2

[CmdHoldPos]
Art=CommandHoldPosition
Buttonpos=-2147483648,-2147483648

[CmdPatrol]
Art=CommandPatrol
Buttonpos=-2147483648,-2147483648

[CmdPurchase]
Art=CommandPurchase
Buttonpos=0,0

[CmdRally]
Art=CommandRally
Buttonpos=3,1
PlacementModel=UI\Feedback\RallyPoint\RallyPoint.mdl

[CmdSelectSkill]
Art=CommandNewSkill
Buttonpos=2,0

[CmdStop]
Art=CommandStop
Buttonpos=-2147483648,-2147483648

//[CmdUnivAgi]
//Art=
//Buttonpos=2,0

//[CmdUnivInt]
//Art=
//Buttonpos=1,0

//[CmdUnivStr]
//Art=
//Buttonpos=0,0
I added all units from company & melee on the map (except neutral creeps). Looks like it doesn't crash while selecting them. Pay attention to the siege units - command buttons for them looks awesome!
The real test will be if someone uses this (hack? feature?) thing for a large complex map.
 

Attachments

  • AllUnitsCrashCheck.w3x
    29.3 KB · Views: 193
  • WC3ScrnShot_011715_210709_01.jpg
    WC3ScrnShot_011715_210709_01.jpg
    587.4 KB · Views: 361
  • CollapsedCommandButtonsHero.jpg
    CollapsedCommandButtonsHero.jpg
    98.2 KB · Views: 957
Level 7
Joined
Aug 23, 2014
Messages
208
it seems to me that what he does is basically forces the buttons to one position, so you can still order unit to stop by hitting S, but you dont see it anymore. But yes stability may be issue
Nope. You can not use shortcuts for hidden buttons.
Just download and run in singleplayer map from my previous post. You will see, for example, that "S", "P" and "H" buttons do nothing for siege units, because they use Attack "G"round and "A"ttack buttons.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
This could actually be the WC3 discovery of the year, imho.

I wonder why nobody though of this yet. I mean, it's a pretty straightforward approach to WC3 modding to try negative numbers in places where they clearly shouldn't be...

Unlike some of the newer discoveries, this has actual value in terms of mapmaking, as it allows to free the command card of stuff nobody ever uses like hold position and patrol.
 
Level 33
Joined
Apr 24, 2012
Messages
5,113
This could actually be the WC3 discovery of the year, imho.

I wonder why nobody though of this yet. I mean, it's a pretty straightforward approach to WC3 modding to try negative numbers in places where they clearly shouldn't be...

Unlike some of the newer discoveries, this has actual value in terms of mapmaking, as it allows to free the command card of stuff nobody ever uses like hold position and patrol.

Yep. And because of this, there will be more possibilities of what maps can now be made with the use of this.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Yep. And because of this, there will be more possibilities of what maps can now be made with the use of this.
We now need a small snippet that recreates all the standard commands via JASS to allow having both units with disabled command card and units with enabled command card abilities. Shouldn't be hard; just use LUA to generate dummy abilities with the same icon and hotkey, then redirect their orders to issue move, patrol, etc.
Obviously, all units should have the normal commands by default, so an onIndex event from a unit indexer should be used to apply the dummies to all units.

Players can then use UnitRemoveAbility to remove the commands if needed.


Anyone has an idea how we could create hidden dummy abilities that can still be enabled via hotkeys, so that it's possible to hide the attack and stop command without disabling the hotkeys? Event - Player presses key is not an option due to the long delay.
 
Status
Not open for further replies.
Top