• 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 faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Get tooltip function

Status
Not open for further replies.
Level 17
Joined
Apr 13, 2008
Messages
1,610
Is there a way to get a unit's tooltip somehow?
I want to make a simple hero selection system for my map. When the player clicks on a hero its tooltip would show up in a text message. No, I don't want to use taverns. I have 27 heroes and it would be a pain in the ass to write 27 ifs for them.
 
Level 7
Joined
Mar 12, 2006
Messages
407
I got bad news for you...
in gui its impossible as far as i know

well.. copy n paste is your friend !
For the ifs... do a string array and a herotype array ( i think u might already have one ?)
Then compare those arrays to get the right string and then show it

so you still have to copy n paste tooltips 27 times but not that much if/then/else ;)
 
Level 12
Joined
Mar 23, 2008
Messages
942
If you want a idea of tavern system I use this on my map:

  • Hero Purchase
    • Events
      • Unit - A unit enters Heroes Tavern <gen>
    • Conditions
      • (Unit-type of (Entering unit)) Not equal to Choose a Hero
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is an ally of Player 1 (Red)) Equal to True
          • Arena Equal to Mystic Fountain
        • Then - Actions
          • Set temppoint = (Center of Base1 1 <gen>)
          • Unit - Move (Entering unit) instantly to temppoint
          • Camera - Pan camera for (Owner of (Entering unit)) to temppoint over 0.00 seconds
          • Custom script: call RemoveLocation(udg_temppoint)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is an ally of Player 2 (Blue)) Equal to True
          • Arena Equal to Mystic Fountain
        • Then - Actions
          • Set temppoint = (Center of Base2 1 <gen>)
          • Unit - Move (Entering unit) instantly to temppoint
          • Camera - Pan camera for (Owner of (Entering unit)) to temppoint over 0.00 seconds
          • Custom script: call RemoveLocation(udg_temppoint)
        • Else - Actions
      • Selection - Select (Entering unit) for (Owner of (Entering unit))
      • -------- Here will disable new heroes --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HeroUnitType[(Player number of (Owner of (Entering unit)))] Equal to No unit-type
        • Then - Actions
          • Set PlayerHero[(Player number of (Owner of (Entering unit)))] = (Entering unit)
          • Set HeroUnitType[(Player number of (Owner of (Entering unit)))] = (Unit-type of (Entering unit))
          • Player Group - Pick every player in (All players) and do (Actions)
            • Loop - Actions
              • Player - Make HeroUnitType[(Player number of (Owner of (Entering unit)))] Unavailable for training/construction by (Picked player)
          • For each (Integer A) from 0 to 3, do (Actions)
            • Loop - Actions
              • Player - Make AllHeroes[(Integer A)] Unavailable for training/construction by (Owner of (Entering unit))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HeroUnitType[(Player number of (Owner of (Entering unit)))] Not equal to (Unit-type of (Entering unit))
            • Then - Actions
              • Set tempforce = (All players matching (((Matching player) Food used) Equal to 0))
              • Player Group - Pick every player in tempforce and do (Actions)
                • Loop - Actions
                  • Player - Make HeroUnitType[(Player number of (Owner of (Entering unit)))] Available for training/construction by (Picked player)
              • Custom script: call DestroyForce(udg_tempforce)
              • Set PlayerHero[(Player number of (Owner of (Entering unit)))] = (Entering unit)
              • Set HeroUnitType[(Player number of (Owner of (Entering unit)))] = (Unit-type of (Entering unit))
              • Player Group - Pick every player in (All players) and do (Actions)
                • Loop - Actions
                  • Player - Make HeroUnitType[(Player number of (Owner of (Entering unit)))] Unavailable for training/construction by (Picked player)
            • Else - Actions
In map initialization I set all the heroes in the AllHeroes[x] array.
 
Level 17
Joined
Apr 13, 2008
Messages
1,610
My map is 95% JASS :p
Hero type array isn't necessary for the copy-paste function, you can use the custom unit value on the heroes, and actually, you don't have to copy-paste either, you can refer to the game's constant strings, for example "TRIGSTR_012" if you look them up.

Edit:
Saishy, thanks, but I don't want to use a tavern system, I made my selection system already for the map, I just don't want to add +60 unnecessary lines to it, I want to keep clean code.
 
Level 12
Joined
Mar 16, 2006
Messages
992
My map is 95% JASS :p
Hero type array isn't necessary for the copy-paste function, you can use the custom unit value on the heroes, and actually, you don't have to copy-paste either, you can refer to the game's constant strings, for example "TRIGSTR_012" if you look them up.

Edit:
Saishy, thanks, but I don't want to use a tavern system, I made my selection system already for the map, I just don't want to add +60 unnecessary lines to it, I want to keep clean code.

Copy paste until you find out a solution, I say.

It's better to progress primitively than to waste your time.
 
Status
Not open for further replies.
Top