• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Custom Preselect

Level 12
Joined
Sep 27, 2016
Messages
169
I have an idea for Custom Preselection.

You can hover a cursor over a unit, and it will detect it as a pre-selected target.

In my case, I need this because I have a custom UI that uses frame handles. And the UI for some of the units I select might be different from others. So, when I select a unit, I need to change the UI before the unit is actually selected, otherwise it looks ugly.

Idea:

I hover my cursor over a unit -> Pre-selected units are detected -> Find the UI that matches the pre-selected unit -> Left-click (unselected yet!) -> Change the UI I want -> Select the pre-selected unit -> The exchange between old selected unit's UI and new selected unit's UI become smooth!

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: if GetLocalPlayer() == Player(0) then
      • Game - Disable selection and deselection functionality (Disable selection circles)
      • Game - Disable drag-selection functionality (Disable drag-selection box)
      • Game - Disable pre-selection functionality (Disable pre-selection circles, life bars, and object info)
      • Custom script: endif
  • Preselect
    • Events
      • Player - Player 1 (Red) issues Mouse Move event
    • Conditions
    • Actions
      • Set VariableSet x = (X of (Mouse Position for Triggered Mouse Event))
      • Set VariableSet y = (Y of (Mouse Position for Triggered Mouse Event))
      • Set VariableSet loc = (Mouse Position for Triggered Mouse Event)
      • Set VariableSet g = (Random 1 units from (Units within 48.00 of loc.))
      • Unit Group - Pick every unit in g and do (Actions)
        • Loop - Actions
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Picked unit) Not equal to preselectedunit
            • Then - Actions
              • Special Effect - Destroy preselectcirle
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using UI\Feedback\SelectionCircle\SelectionCircle.mdl
              • Set VariableSet preselectcirle = (Last created special effect)
            • Else - Actions
          • Custom script: endif
          • Set VariableSet preselectedunit = (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in g) Equal to 0
        • Then - Actions
          • Set VariableSet preselectedunit = No unit
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • Special Effect - Destroy preselectcirle
          • Custom script: endif
        • Else - Actions
      • Custom script: call DestroyGroup(udg_g)
      • Custom script: call RemoveLocation(udg_loc)
  • Select
    • Events
      • Player - Player 1 (Red) issues Mouse Down event
    • Conditions
      • (Trigger Mouse Button) Equal to Left Mouse Button
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Selection - Select preselectedunit
      • Custom script: endif
what it need:
  • Custom SelectectionCircle model that must instantly gone after it destroyed using "Special Effect - Destroy preselectcirle" .. the original model will wait a few second until it really gone from your screen.
  • Custom Cursor that doesn't change color when it hovering over an ally or enemy. the original model will changed color when it hovering on the unit that outside the unit picking's area.
  • Maybe, Custom UI for Life and Mana Bar and unit info, made from custom framehandles that would be shown up over the unit.
Im big asking: Any advice?

Issues:
- how to detect the unit are spell targeting or not? Event "Player - Player 1 (Red) issues Mouse Down event" will force you to select a preselected unit and cancel your spell!
 

Attachments

Last edited:
Back
Top