• 🏆 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!

Is it possible to adjust spell hotkeys based on position (x,y), like QWERTY etc.?

Level 3
Joined
Mar 3, 2023
Messages
17
I’ve seen this question asked a few times in past threads however they were years ago so I’m wondering with the reforge and newest Warcraft editor, is it possible to assign hotkeys depending on the order in which it was bought (for example in a custom hero survival)?
I’ve seen solutions like this which is definitely doable (eventually) but 150+ skills x 7 and then the trigger through GUI is not an exciting project, I’m hoping there may be something out there or slightly faster way to do it?
 
Level 18
Joined
Oct 17, 2012
Messages
821
Pretty much all the 3rd Party tools for the various programming languages provide a way to create object data via code. Therefore, creating 100s of the same ability becomes less painful and way faster. In addition, you will be able to more easily access them whenever you need to.

Another option is to detect key presses via the new native functions and then have the unit cast the corresponding ability when the key is pressed.
Don't assign any hotkey to any ability.

There is also this system, Dummy Hotkeys, which could prove to be more feasible. However, the requirement of dummy abilities may seem cumbersome.
 
Last edited:
Level 3
Joined
Mar 3, 2023
Messages
17
Pretty much all the 3rd Party tools for the various programming languages provide a way to create object data via code. Therefore, creating 100s of the same ability becomes less painful and way faster. In addition, you will be able to more easily access them whenever you need to.

Another option is to detect key presses via the new native functions and then have the unit cast the corresponding ability when the key is pressed.
Don't assign any hotkey to any ability.

There is also this system, Dummy Hotkeys, which could prove to be more feasible. However, the requirement of dummy abilities may seem cumbersome.
that’s amazing! I’ll need to look into 3rd party tools regardless because that sounds way better haha.
Is there any guides towards a general structure for the 2nd option? (Would this be what you’re referring to?)
 
Last edited:
Level 18
Joined
Oct 17, 2012
Messages
821
Scratch what I said about the second option. It only works well for instant abilities that require no casting.
  • Cast Ability
    • Events
      • Game - GUIKeyEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • _GUIKeyTrigger Equal to GUIKEY_Q
        • Then - Actions
          • Unit - Order TEST_UNIT to Human Paladin - Activate Divine Shield.
        • Else - Actions
 
Last edited:
Level 3
Joined
Mar 3, 2023
Messages
17
Damn, all good! I’ll look into making the abilities in a less painful manner. Thanks for helping with some direction
 
Level 18
Joined
Oct 17, 2012
Messages
821
Well, actually, you could force press another key via Game - Force Player to press key. That could work.
That would imply the abilities will need hotkeys. The issue with that is the hotkeys are now part of the tooltips wherever you want it to or not.
However, you can change tooltips.
I am going to look into it to see if there are any problems.

Edit: Well, the hotkey does not go away even if you change the tooltip. So, other than a visual error in the tooltip and making sure no other ability, especially no target abilities, has the same hotkey as your dummy hotkey, the second option could work really well.
 
Last edited:
Level 3
Joined
Mar 3, 2023
Messages
17
Would you still be utilizing the GuiKeyEvent tool?
Hotkey not going away can possibly have some workarounds to make it clear to the player to ignore them or potentially make the hotkey a key people typically don't use for abilities so there is no overlap with what the trigger states, otherwise that'd definitely be ideal.
 
Level 12
Joined
Jan 10, 2023
Messages
191
Well, actually, you could force press another key via Game - Force Player to press key. That could work.
That would imply the abilities will need hotkeys. The issue with that is the hotkeys are now part of the tooltips wherever you want it to or not.
However, you can change tooltips.
I am going to look into it to see if there are any problems.

I have messed around with odd characters in hotkeys, and I'm not sure if it may cause other issues/ bugs.

Using the question mark for example worked in the hero abilities 'spellbook' but I believe it did not work when I tried to use the ability itself (using [SHIFT] + [/] on my keyboard)

Maybe you could set it to something obscure like one of the [ALT] + ### combinations then use force UI ?

Edit: (forgot to get to the point) These characters are not displayed in the tooltip
 
Last edited:
Level 18
Joined
Oct 17, 2012
Messages
821
I have messed around with odd characters in hotkeys, and I'm not sure if it may cause other issues/ bugs.

Using the question mark for example worked in the hero abilities 'spellbook' but I believe it did not work when I tried to use the ability itself (using [SHIFT] + [/] on my keyboard)

Maybe you could set it to something obscure like one of the [ALT] + ### combinations then use force UI ?

Edit: (forgot to get to the point) These characters are not displayed in the tooltip
So, I tried those obscure characters. While it is nice that the hotkeys don't show up in the tooltips, the abilities with them don't react at all to the function Game - Force Player to press key. Since they don't show up in tooltip, then you can't press the ability with a hotkey normally, which means the function won't work for these hotkeys.
 
Last edited:
Level 12
Joined
Jan 10, 2023
Messages
191
So, I tried those obscure characters. While it is nice that the hotkeys don't show up in the tooltips, the abilities with them don't react at all to the function Game - Force Player to press key. Since they don't show up in tooltip, then you can't press the ability with a hotkey normally, which means the function won't work for these hotkeys.
I'll have to double check as far as hero ability menu hotkeys work (i swear i was leveling divine shield with a question mark, but not casting)

Even if that oddly specific function works it won't help your situation so I guess I'll just check for me.

It could be an extremely niche way to force a skill-point selection without assigning a hotkey or risking a use of the ability, but that is so niche and there are other ways of doing it that I think it isn't useful for much now...
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
I wrote my own ability system a while back to get around this annoying crap. It allowed you to define a dynamic Hotkey between A to Z, play any animation (customized to your liking), and have your own Cast Point on a per ability basis. Keep in mind that this was built with the intention of using your own custom abilities instead of the native Blizzard abilities. A Dummy unit could still cast the native abilities though so it's not like you couldn't make it work.

For the hotkey stuff I created 26 abilities based on Channel, each with a different hotkey from A to Z. Then I triggered the fields of these Channel abilities using the "new" Ability Field natives to adjust Casting Time, Targeting Type, Cooldown, Mana Cost, Cast Range, and Area of Effect on the fly. I basically made an extension class for Abilities and Unit-Types which helped define these settings so I could easily get the needed information.

So just for example let's say my custom Dragon Knight Hero has a model which uses animation index 5 for it's Spell Throw animation. I would define this in my extended Unit-Type class for the Dragon Knight. Then my custom Flameblast ability would be coded to have settings like Spell Animation Type = Spell Throw. This ability class and the unit-type class communicate with one another to produce the desired results, telling the DK to use animation index 5 when playing it's cast animation for this ability. Animation timescale and other settings could also be applied here.

Casting Time was used to mimic the behavior of Cast Point. The Channel ability automatically animation cancels, meaning it skips the Cast Backswing animation, which was too annoying to fix so I just considered it a feature.

I believe I was using the "A unit begins channeling" Event to detect the initial casting of the Channel ability. Then I used a Timer that lasted X seconds, where X was the Cast Point of the Ability you're casting (again, referring to the extended Ability class). If the unit interrupts this process by cancelling the channeling early, I simply destroy the Timer and nothing happens. If the cast is successful, I proceed to run the ability "starts the effect" function which contains the actual effects of the ability.

I think a system like this is pretty useful if you're interested in gaining full control over ability casting. It fits well with a MOBA or RPG type of map where you control a single Hero, although I don't see why it wouldn't work in any kind of map. Also, there may have been other workarounds involved, I'm not entirely sure if I was able to get Targeting Type to work or not, my memory is a bit foggy on the matter.
 
Last edited:
Level 3
Joined
Mar 3, 2023
Messages
17
I wrote my own ability system a while back to get around this annoying crap. It allowed you to define a dynamic Hotkey between A to Z, play any animation (customized to your liking), and have your own Cast Point on a per ability basis. Keep in mind that this was built with the intention of using your own custom abilities instead of the native Blizzard abilities. A Dummy unit could still cast the native abilities though so it's not like you couldn't make it work.

For the hotkey stuff I created 26 abilities based on Channel, each with a different hotkey from A to Z. Then I triggered the fields of these Channel abilities using the "new" Ability Field natives to adjust Casting Time, Targeting Type, Cooldown, Mana Cost, Cast Range, and Area of Effect on the fly. I basically made an extension class for Abilities and Unit-Types which helped define these settings so I could easily get the needed information.

So just for example let's say my custom Dragon Knight Hero has a model which uses animation index 5 for it's Spell Throw animation. I would define this in my extended Unit-Type class for the Dragon Knight. Then my custom Flameblast ability would be coded to have settings like Spell Animation Type = Spell Throw. This ability class and the unit-type class communicate with one another to produce the desired results, telling the DK to use animation index 5 when playing it's cast animation for this ability. Animation timescale and other settings could also be applied here.

Casting Time was used to mimic the behavior of Cast Point. The Channel ability automatically animation cancels, meaning it skips the Cast Backswing animation, which was too annoying to fix so I just considered it a feature.

I believe I was using the "A unit begins channeling" Event to detect the initial casting of the Channel ability. Then I used a Timer that lasted X seconds, where X was the Cast Point of the Ability you're casting (again, referring to the extended Ability class). If the unit interrupts this process by cancelling the channeling early, I simply destroy the Timer and nothing happens. If the cast is successful, I proceed to run the ability "starts the effect" function which contains the actual effects of the ability.

I think a system like this is pretty useful if you're interested in gaining full control over ability casting. It fits well with a MOBA or RPG type of map where you control a single Hero, although I don't see why it wouldn't work in any kind of map. Also, there may have been other workarounds involved, I'm not entirely sure if I was able to get Targeting Type to work or not, my memory is a bit foggy on the matter.
Oh! It’s an interesting workaround to avoid the issue and gives more ideas to experiment and to play with lol.
 
Level 18
Joined
Mar 16, 2008
Messages
721
this is pretty much default in Reforged, you can edit some of the C drive documents and it forces everything to be QWERTY

Just add this text file to your wc3 data folder, on my computer it's located here:
Code:
C:\Users\USER_NAME\Documents\Warcraft III\CustomKeyBindings
 

Attachments

  • customkeys.txt
    288.1 KB · Views: 4
Level 19
Joined
Jan 3, 2022
Messages
320
Another option is to detect key presses via the new native functions
I oppose this idea, because in vanilla the ability hotkeys are client-side. Zero latency to click. If you script it, the new natives are all synced and the use (input lag) will depend on players' ping. Try to play with a laggy asian player, 300ms minimum to understand what it would feel like BEFORE you even cast the ability.

Text - Hotkey (Character)
Defines the keyboard key that can be pressed in order to train the unit/building/hero. Used as an alternative to clicking on the icon in the command interface.
Same but with the hotkey field of the ability. You can try to modify BlzGetAbilityStringField or BlzGetAbilityIntegerField of the particular ability attached to the unit. Try to toggle ability, visibility etc. to make it apply the change. Though the chances of success are near 0%.
 
Top