| 04-11-2006, 08:19 PM | #1 |
Is there any way to assign code for when a player presses a key? I want it such that if a player presses "1", a specific unit is picked. I'm trying to emulate hotkeys, basically. Event: player presses "1" Action: select "unit" for player is this possible? |
| 04-11-2006, 08:32 PM | #2 |
No, it is only possible to detect when the ESC and arrow keys are pressed by triggers. |
| 04-11-2006, 08:51 PM | #3 |
You have to give the unit abilities with the hotkeys of the letters you wish to detect. |
| 04-11-2006, 09:05 PM | #4 |
I'm sorry Tim, I'm not sure I understand -- I can actually give a unit a hotkey that'll globally select them whenever I press it? |
| 04-11-2006, 09:09 PM | #5 |
No, you give the unit an ability with 0 cooldown, no target, etc. Then have a trigger that fires when the ability is cast. |
| 04-12-2006, 02:08 AM | #6 | |
Quote:
|
| 04-12-2006, 05:52 AM | #7 | |
Quote:
I doubt that it's to prevent conflicts... The esc key conflicts with the cancel ability and the arrow keys conflict with camera movement. I dunno why Blizzard doesn't enable other keyboard events. |
| 04-12-2006, 05:55 AM | #8 | |
Quote:
Does this work even if the ability does not fit on the unit's button palette? What I mean is, if I give him 15 abilities, will those that don't have enough room to be shown on the screen still be accessible via the hotkeys? If so, you could just make 10 abilities (one for each number), and have the button for it look like an empty square so that the player wouldn't notice. Then whenever the player selects a unit, add all the abilities to it. You'd have to set their position and priority really low so that they wouldn't take the place of other abilities. |
| 04-12-2006, 06:32 AM | #9 | |
Quote:
You could test this yourself very easily... Just give a unit a bunch of abilities and try the hotkeys for all of 'em. But my guess is no... if an ability doesn't have room to show up in the list, then it can't be used. Aside from that, I don't believe there is any way to set the priority for abilities. There are abilities that don't show icons (most item abilities for damage, defense, health, etc.. as well as a few unit abilities), but they're generally passive--so hotkeys won't work on them regardless of whether or not one is set. |
| 04-12-2006, 06:56 AM | #10 | |
Quote:
I remember testing an ability that I accidently set to a button position that was behind something else... could not use the ability even with hot keys. Tough luck... :/ |
| 04-12-2006, 06:58 AM | #11 |
That sucks. Well, it would at least work for a couple of numbers. |
| 04-12-2006, 01:44 PM | #12 |
Trust me, I did a ton of tests on keystrokes. The only way to get keystrokes is for a unit to always be selected, and you can only have a max of 9 hotkeys for the 9 command card slots. If you give a unit 26 abilities, only the ones appearing in the command card will work. |
