• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

Forcing to open targeting UI of unit/point target abilities?

Status
Not open for further replies.
Level 3
Joined
Mar 30, 2022
Messages
7
Hello all, and thank you for visiting this question!

I am creating a map where players can choose different abilities for their heroes.

I know how to track pressed keys from the keyboard. I want that when a certain button is pressed, the hero will start directing/take aim with the ability (select target menu) as if the player clicked the mouse on this ability before using it. (In general, this is something like custom hotkeys)

Can anyone suggest to me a method or function to do this? (JASS/LUA doesn't matter)

Note: the ability that I want to aim is on the hero and does not have a hotkey

Thanks in advance for any help!
 

Uncle

Warcraft Moderator
Level 71
Joined
Aug 10, 2018
Messages
7,537
Forcing a hotkey is one solution but it's less than ideal due to the delay.

There's this system which apparently works fine when playing offline:

Another idea that comes to mind that could potentially work:
  • Create X Channel abilities, each with their own unique hotkey.
  • Whenever a unit learns an ability, disable the learned ability and give the unit one of these Channel abilities of your choice (so your hotkey of choice).
  • Modify the given Channel ability to match the learned abilities casting properties (mana cost, cast range, targeting type, etc). You can use the Set Ability Boolean/Integer/Real actions to do this.
  • Link these two abilities to the unit using a table so that they're paired with one another.
  • Whenever your unit begins casting a Channel ability, enable the disabled ability and order it to cast that instead. Manage the cooldowns/mana costs so that you aren't paying mana twice and so that you can't cast the Channel ability while the real ability is on cooldown.
  • Reset the process so that the unit can only cast the Channel ability again.

I imagine there's a lot of issues that come along with this but maybe they could be worked around.
 
Last edited:
Level 43
Joined
Feb 27, 2007
Messages
5,434
I tried to force a UI key for a hidden/nonfunctioning ability that I used only for targeting (to make a spell that targeted multiple chosen points) and I was never able to find a solution that worked reliably. There’s a delay associated with enabling/adding the ability before you can activate it via hotkey, so to get it to go off at all you have to spam the UI Key press and you get a lot of erroneous clicking sounds. And even then it doesn’t always work.

There may be more to explore but I became frustrated that there was no reasonable solution.
 
Level 3
Joined
Mar 30, 2022
Messages
7
Thanks everyone for your answers !

I'm creating a map where each player (Multiplayer map) can give to his hero, any abilities from the list. It's very important that players will be able to take abilities in any order they want, but in the same time, it should be easy and comfortable to use them.

Now I am convinced that there is no easy and elegant solution. Uncle second idea is the most suitable in my option. I did it in this way:

  • I created a 20 Dummy Ability - 4 for each (Q W E R) slot: Instant target, Instant without stopping hero, Target-unit, target-point and Passive.

  • I created Names, Icons, and Descriptions (51 abilities in the custom UI box). It's where Players learn and upgrade spells.

  • When a player picks an ability from Skill Box UI, Hero will receive a suitable dummy ability, in an empty (Q, W, E, or R) slot. The problem with hotkeys/targeting and positioning is solved.

  • Next we modify the received abilities (mana cost, tooltips, cooldown, range, etc.) but unfortunately, it's impossible to modify icons personally for each hero (broken function)

  • To solve issues with icons I created 4 backdrops with textures of chosen abilities, we will place them on the top of received Dummy spells. Thanks to TriggerRegisterCommonCommandEventBJ we can track, when Players select and target spells.

  • This will help us to hide Fake icons (UI backdrops). We also can play with backdrops transparency, to show a low-mana effect. To my surprise - the original Icon cooldown effect covered created Fake icons on top, without any manipulation. With this, I was able to mimic original icons. The only thing that is untrackable is when players manually press the Cancel button. When it happens my function is not able to unhide Fake Icons, but they instantly return after player gives an order or clicks the right mouse button.
With this algorithm, we probably even can have multiple heroes with different spells controlled by 1 player. I also checked the system in LAN game, and it seems fine. Of course, it probably needs optimization and maybe some improvement, but as a prototype its works very well.

Once again I thank you for your replies. I hope these ideas will be useful for someone too. I attach some screenshots of this system. If I will have more time I will also upload a video of my map.
 

Attachments

  • 1.jpg
    1.jpg
    596.5 KB · Views: 34
  • 2.jpg
    2.jpg
    592.3 KB · Views: 30
  • 3.jpg
    3.jpg
    595.1 KB · Views: 23
  • 4.jpg
    4.jpg
    589.3 KB · Views: 20
  • 5.jpg
    5.jpg
    619.9 KB · Views: 23
  • 6.jpg
    6.jpg
    627.1 KB · Views: 31
Status
Not open for further replies.
Top