• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Current selected unit in group

Status
Not open for further replies.
Level 8
Joined
Aug 5, 2014
Messages
194
Hello!

I need to know it is possible to catch event when player selects unit(make it active) in current selected unit group. When i tested it, it seems "Unit selected by player" doesnt work when you selected unit in already selected group of units in UI.
 
Level 39
Joined
Feb 27, 2007
Messages
5,032
Some information here could be wrong because I don't know much about the UI functions but:

If the player is clicking, the only way you could potentially use this as an event would be by periodically checking what is being displayed in the various UI frames but honestly I'm not sure how much info you can get in reverse like that. @Tasyen might have some idea, they're the person I ping for UI threads. It's also possible to detect player clicks wherever, but if the mouse is clicked while hovering a UI frame element, the coordinates of the mouse return (0,0) instead of whatever they would be on the UI so you can't really know where they clicked.

If the player uses a hotkey to cycle the active unit you could theoretically catch that with the new keypress events. This moves through the list of selected units in a regular order so there is likely a way to replicate the same order from the UI in a trigger and cycle through what the game 'knows' is selected based on this keypress event.

"Unit selected by player" event has a (functionally) huge delay between when you select and when the event actually fires, unfortunately.
 
Status
Not open for further replies.
Top