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

How to create trigger based on hotkey

Status
Not open for further replies.
Level 6
Joined
Oct 25, 2010
Messages
203
There is an Event that says "Player - Keyboard Event"
but it only allows me to select the arrow keys, like "Player 1 presses (left arrow)"

Is there a way to create a trigger based on a letter key? or a combination of keys like Alt + X?
 
Level 11
Joined
Jun 2, 2004
Messages
849
Short answer: No.

Long answer: If and only if you know a unit will be selected by the player, you can sort of do it by giving the unit an ability that uses that shortcut key but otherwise does nothing, and check for when the ability is cast.
 
Level 6
Joined
Oct 25, 2010
Messages
203
Oh, I wanted to create a hotkey that selects units, like Press Alt + 1 = select all melee units, Alt+2 = all ranged etc
 
Level 11
Joined
Jun 2, 2004
Messages
849
The player can already do that with control groups (though they'd have to set it up manually every game). Press control + number row key to make a control group out of currently selected units, and then when you press that number key again (without ctrl key) you'll select them all.
 
Level 6
Joined
Oct 25, 2010
Messages
203
lol I've been playing wc3 since the day it was released, I know the default keys :)

What I am looking to do is not already possible, where units would already be grouped based on attack type, without the need for using Ctrl
 
What you can do is make two units per player. One represents melee and the other ranged. Have the player control group melee or ranged into 1 and the other into 2 at the start of the game. Whenever they press 1 they will select the melee or ranged dummy unit that we just made, and trigger it to re-direct/force the player to select his melee units.

This way ctrl is still involved but only once per game.

If there is significant delay with the force selection you can also make a trigger that tells his melee units to do the same move/attack/hold position as the melee dummy unit bound to 1 does.

Do the same for ranged obv

If you really don't like having players bind things themselves you can make the two units heroes which default hotkeys to select are F1/F2/F3/etc. But honestly they should be able to handle control grouping those two units this many years into WC3 and with the type of game it is.
 
Last edited:
Level 6
Joined
Oct 25, 2010
Messages
203
What you can do is make two units per player.
Thank you for the suggestion, but I would rather not do it that way. There are more attack types than just melee/ranged, and I dont want a bunch of "fake" units for players to click on just to set there control groups. If I could set it to the Alt key it would feel more natural in melee play, and would be easier to use in combination with Ctrl (or not use ctrl at all)
 
Level 6
Joined
Oct 25, 2010
Messages
203
This is for melee where people can have more than 1 hero, I already said I dont want to use units to trigger the event.

I'm just really surprised there isnt a way to make a trigger based on a hotkey
 
Warcraft 3 has a couple limits. Some times its better to just know the limits and not try to cross them because the functionalities just aren't there and it is too convoluted to try.

A selection re-direction unit, arrow keys, selection ability hotkeys on every unit and building, or having every unit have use-able items for numpad to select your units are the best options you have.
 
Last edited:
Level 6
Joined
Oct 25, 2010
Messages
203
Warcraft 3 has a couple limits. Some times its better to just know the limits and not try to cross them because the functionalities just aren't there and it is too convoluted to try.
Just because a wall has a door in it, doesnt mean I cant climb over it. I do understand the limitations of the software, and I do understand how to "work around" those limitations. But in this particular case, I do not want to just find a work around. I know what I want to do is possible, if I was better at coding. Theres a couple tools I could use, like Cheatengine or Autohotkey, but I thought somebody with a little more experience might be able to help simplify things to not require external programs
 
Level 11
Joined
Jun 2, 2004
Messages
849
Game engines are deliberately sandboxed to keep you from being able to do everything. You're limited to what the trigger API exposes (barring some exploits). Blizzard decided quite deliberately back in the day what to let you do, and custom hotkeys was not one of the things they allowed.

Reasons for sandboxing include:
- Simplifying things for user friendliness.
- Preventing exploits/unintentional damage.
- Time and effort requirements in making additional API.

Custom hotkeys fell victim to the last bullet point; they simply didn't think about it or didn't feel it was worth the effort. In contrast, SC2 exposed many, many more things at the cost of the failing to properly consider the first bullet point (user friendliness).
 
Level 6
Joined
Oct 25, 2010
Messages
203
Why do people feel the need to explain the history of why things cant be done? People already answered me, why keep repeating it?

Either its not possible or it is, explaining WHY it is or is not doesnt help, this isnt philosophy class

I get it, but was hoping maybe somebody who understands how CheatEngine or Autohotkey works might chime in with something other than "nope"

I got the answer no multiple times, I get it... thank you

How about going to my other thread on texturing which does not have any replies, and explaining why that one isnt possible either
 
Level 11
Joined
Jun 2, 2004
Messages
849
I'm unfamiliar with CheatEngine, but Autohotkey and similar programs send software interrupts to mimic IO interrupts. Games can't tell if the keypress event they got came from an actual keyboard or a background program (barring rootkit methods like Warden), so they'll gleefully assume you really are hitting the button. There's nothing at all like that in wc3; you can't send key events through triggers.

Side note, if you have one of those fancy gaming mice or keyboards with a repeat function, they likely had you install some sort of driver to make it work, which is functionally identical to what Autohotkey does. Blizzard and other companies tend to allow it and not other software methods due to Reasons.
 
Level 6
Joined
Oct 25, 2010
Messages
203
was hoping maybe somebody who understands how CheatEngine or Autohotkey works

I'm unfamiliar with CheatEngine

several people have already explained why it doesnt work, I dont care about WHY or what the history of the world editor is. If you can't offer an explanation that discusses how to achieve what I am asking for, then your wasting your time and mine

Autohotkey and similar programs send software interrupts to mimic IO interrupts. Games can't tell if the keypress event they got came from an actual keyboard or a background program (barring rootkit methods like Warden), so they'll gleefully assume you really are hitting the button.

More useless information giving me the history of AHK when I already know how it works... you clearly dont get how AHK and CE can be used together to create mods

So I ask you, how is it that you have helped me?

You keep asking things so I keep answering xD

and you ignored my last question...

How about going to my other thread on texturing which does not have any replies, and explaining why that one isnt possible either
 
Last edited:
Status
Not open for further replies.
Top