• 🏆 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!

[GUI] Simple Click Hero Selection 1.00

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Simple Click Hero Selection

Description
A very hero selection system. Select your hero by double-clicking it.
Easy to install - the system initializes heroes in a given region. The user just has to set the region that contains all the heroes, and a region where the hero will spawn.

Installation
1. Copy the folder into your map.
2. Edit the region variables.

Triggers

  • SCHS Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ----- --------
      • -------- v edit here v --------
      • -------- ----- --------
      • Set schs_SpawnRegion = my spawn region <gen>
      • Set schs_HeroesRegion = my hero region <gen>
      • Set schs_HeroSummonSFX = Abilities\Spells\Human\ReviveHuman\ReviveHuman.mdl
      • -------- ----- --------
      • -------- ^ edit here ^ --------
      • -------- ----- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in schs_HeroesRegion) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to True
            • Then - Actions
              • Set schs_HeroId = (schs_HeroId + 1)
              • Set schs_HeroUnit[schs_HeroId] = (Picked unit)
            • Else - Actions
          • Unit Group - Add (Picked unit) to schs_AvailableHeroes
  • SCHS Select
    • Events
      • Player - Player 1 (Red) Selects a unit
      • ~
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
      • schs_PlayerChosen[(Player number of (Triggering player))] Equal to False
      • ((Triggering unit) is in schs_AvailableHeroes) Equal to True
    • Actions
      • Set tempUnit = (Triggering unit)
      • Set tempPlayer = (Triggering player)
      • Set tempId = (Player number of tempPlayer)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • tempUnit Equal to schs_PlayerCurrentSelection[tempId]
        • Then - Actions
          • For each (Integer schs_Loop) from 1 to schs_HeroId, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • tempUnit Equal to schs_HeroUnit[schs_Loop]
                • Then - Actions
                  • Set tempLoc = (Center of schs_SpawnRegion)
                  • Unit - Change ownership of tempUnit to tempPlayer and Change color
                  • Unit - Move tempUnit instantly to tempLoc
                  • Unit Group - Remove tempUnit from schs_AvailableHeroes
                  • -------- ----- --------
                  • Special Effect - Create a special effect attached to the origin of tempUnit using schs_HeroSummonSFX
                  • Special Effect - Destroy (Last created special effect)
                  • -------- ----- --------
                  • Camera - Pan camera for tempPlayer to tempLoc over 0.00 seconds
                  • Set schs_PlayerChosen[tempId] = True
                  • Game - Display to (All players) the text: ((Name of tempPlayer) + ( has chosen + ((Name of tempUnit) + .)))
                  • Custom script: call RemoveLocation(udg_tempLoc)
                • Else - Actions
              • Skip remaining actions
        • Else - Actions
          • Set schs_PlayerCurrentSelection[tempId] = tempUnit
          • Set tempForce = (Player group(tempPlayer))
          • Game - Display to tempForce the text: (Click again to choose + ((Name of tempUnit) + .))
          • Custom script: call DestroyForce(udg_tempForce)


Changelog
0.03
  • Cached (triggering unit) and (triggering player) for better efficiency.
  • Special effect is now configurable.
0.02
  • Merged the function to add heroes to the group into the pick
  • Removed instances of Integer B
  • Replaced 3 (player number of (player)) calls with a variable

I know that there are many, superior hero selection systems available. This one has a key advantage, though: simplicity. A novice mapmaker can very easily use this system, and the methods are in line with what a typical novice mapmaker would use, e.g. placing the heroes on the map. That said, I'd fully understand if this system is rejected.

Keywords:
hero selection, hero, selection, select, double-click, hero click, hero select, hero pick, pick
Contents

Simple Click Hero Selection 1.00 (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 04:12, 31st Aug 2012 Magtheridon96: - There's a more efficient way to handle the events. Instead of using that huge block of events, you can loop from 1 to 12 on map initialization and...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

04:12, 31st Aug 2012
Magtheridon96:

- There's a more efficient way to handle the events.
Instead of using that huge block of events, you can loop from 1 to 12 on map initialization and add events to your system's main trigger accordingly.

This system will be approved after that and will get a rating of 3/5 for being useful.
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Could be even more simplified.
(SelectedUnit is an array variable.)

A unit is selected by Player X

If SelectedUnit[PlayerNumber(Player X)] == GetTriggerUnit() then it's a final selection.
Else set the SelectedUnit[PlayerNumber(Player X)] = GetTriggerUnit().

Being how unit variables are initially empty this is the best way to treat a double click on units for players.
 
Top