• 🏆 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 select hero by double click?

Status
Not open for further replies.
Level 28
Joined
Jan 26, 2007
Messages
4,789
Create a boolean variable (called "clicked" or something, use arrays if there are multiple players).

Create a trigger with the event "a unit is clicked" (or a specific unit event, your choice).
If clicked == false, then set clicked = true
If clicked == true, then create hero for player.

If a player switches from hero (in the selection screen), set clicked to false.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Supposedly you have 5 heroes in your map, this trigger is the way to go~
  • Load Hero
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • P01_PickedHero Equal to False
          • Or - Any (Conditions) are true
            • Conditions
              • (Triggering unit) Equal to Orist Icebrand 0004 <gen>
              • (Triggering unit) Equal to Shelv Stormcast 0003 <gen>
              • (Triggering unit) Equal to Kelen Wellsun 0000 <gen>
              • (Triggering unit) Equal to Agor Stonebreaker 0001 <gen>
              • (Triggering unit) Equal to Wanderer 0178 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to P01_LoadHero
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at (Center of 001 Hero Intro <gen>) facing Default building facing degrees
          • Set P01_PickedHero = True
          • Set P01_Hero = (Last created unit)
          • Set P01_HeroName = (Proper name of (Last created unit))
          • Trigger - Turn off Camera Lock For Intro <gen>
          • Trigger - Turn off Pick Agor Stonebreaker the Dwarf <gen>
          • Trigger - Turn off Pick Orist Icebrand the Hunter <gen>
          • Trigger - Turn off Pick Kelen Wellsun the Mage <gen>
          • Trigger - Turn off Pick Shelv Stormcast the Sorcerer <gen>
          • Trigger - Turn off Pick Anaya Lightsong <gen>
          • Trigger - Run Intro Entrance <gen> (ignoring conditions)
        • Else - Actions
          • Set P01_LoadHero = (Triggering unit)
The Event is "Player - Selection Event"
P01_PickedHero is Boolean-type variable
P01_LoadHero is Unit variable
Just follow the trigger (in my map, I have 5 heroes, in yours, I don't know)
Tell me if you have any problem~
 
Status
Not open for further replies.
Top