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

Hero Selection

Status
Not open for further replies.
Level 14
Joined
Dec 29, 2009
Messages
931
Made this system for my map really quick..
..it's basic but I wanted to know if it can be simplified and if so how?

  • HS Initialize
    • Events
    • Conditions
    • Actions
      • -------- Hero Types --------
      • Set HS_HeroType[1] = Aspect of Light
      • Set HS_HeroType[2] = Huntress
      • Set HS_HeroType[3] = Clergyman
      • Set HS_HeroType[4] = Blademaster
      • Set HS_HeroType[5] = Marksman
      • Set HS_HeroType[6] = Mystic
      • Set HS_HeroType[7] = Juggernaut
      • Set HS_HeroType[8] = gen_DebugHero
      • Set HS_HeroType[9] = Enchantress
      • Set HS_HeroType[10] = Dragonlord
      • Set HS_HeroType[11] = gen_DebugHero
      • Set HS_HeroType[12] = gen_DebugHero
      • -------- Facing Degrees --------
      • Set HS_FacingDegree[1] = 270.00
      • Set HS_FacingDegree[2] = 270.00
      • Set HS_FacingDegree[3] = 270.00
      • Set HS_FacingDegree[4] = 180.00
      • Set HS_FacingDegree[5] = 180.00
      • Set HS_FacingDegree[6] = 180.00
      • Set HS_FacingDegree[7] = 90.00
      • Set HS_FacingDegree[8] = 90.00
      • Set HS_FacingDegree[9] = 90.00
      • Set HS_FacingDegree[10] = 0.00
      • Set HS_FacingDegree[11] = 0.00
      • Set HS_FacingDegree[12] = 0.00
      • -------- Regions --------
      • Set HS_Region[1] = Hero 01 <gen>
      • Set HS_Region[2] = Hero 02 <gen>
      • Set HS_Region[3] = Hero 03 <gen>
      • Set HS_Region[4] = Hero 04 <gen>
      • Set HS_Region[5] = Hero 05 <gen>
      • Set HS_Region[6] = Hero 06 <gen>
      • Set HS_Region[7] = Hero 07 <gen>
      • Set HS_Region[8] = Hero 08 <gen>
      • Set HS_Region[9] = Hero 09 <gen>
      • Set HS_Region[10] = Hero 10 <gen>
      • Set HS_Region[11] = Hero 11 <gen>
      • Set HS_Region[12] = Hero 12 <gen>
      • -------- Spawn --------
      • For each (Integer HS_SpawnInt) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set HS_TempLoc = (Center of HS_Region[HS_SpawnInt])
          • Unit - Create 1 HS_HeroType[HS_SpawnInt] for Neutral Passive at HS_TempLoc facing HS_FacingDegree[HS_SpawnInt] degrees
          • Set HS_PassiveHero[HS_SpawnInt] = (Last created unit)
          • Custom script: call RemoveLocation(udg_HS_TempLoc)
  • Select 01
    • Events
      • Unit - A unit enters Hero 01 <gen>
    • Conditions
      • (Triggering unit) Equal to gen_HeroSoul[(Player number of (Owner of (Triggering unit)))]
    • Actions
      • Unit - Create 1 Backpack for (Owner of (Triggering unit)) at HR_RevivePoint[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
      • Set BP_Unit[(Player number of (Owner of (Triggering unit)))] = (Last created unit)
      • Set HS_TempLoc = (Position of HS_PassiveHero[1])
      • Set gen_PlayerHero[(Player number of (Owner of (Triggering unit)))] = HS_PassiveHero[1]
      • Unit - Move gen_PlayerHero[(Player number of (Owner of (Triggering unit)))] instantly to HR_RevivePoint[(Player number of (Owner of (Triggering unit)))], facing 0.00 degrees
      • Unit - Change ownership of gen_PlayerHero[(Player number of (Owner of (Triggering unit)))] to (Owner of (Triggering unit)) and Change color
      • Selection - Select gen_PlayerHero[(Player number of (Owner of (Triggering unit)))] for (Owner of (Triggering unit))
      • Camera - Set the camera bounds for (Owner of (Triggering unit)) to (Playable map area)
      • Camera - Pan camera for (Owner of (Triggering unit)) to HR_RevivePoint[(Player number of (Owner of (Triggering unit)))] over 0.00 seconds
      • Destructible - Create a Icecrown Tree Wall at HS_TempLoc facing (Random angle) with scale 0.85 and variation (Random integer number between 0 and 9)
      • Unit - Remove (Triggering unit) from the game
      • Custom script: call RemoveLocation(udg_HS_TempLoc)
      • Custom script: set udg_HS_PassiveHero[1] = null
      • Trigger - Turn off (This trigger)
There are 12 seperate triggers for the "hero selected" part.
Each trigger is for a different circle of power w/ a region that the hero is standing in.
 
Level 3
Joined
Jun 23, 2013
Messages
54
i think using a tavern is a good choice
fristly, you make 12 heroes so 1 tavern will be enough
secondly, tavern doesn't need large space of map
 
Level 8
Joined
Oct 12, 2011
Messages
483
You could set it up so that there's a larger region around the hero selection one, and check if the selection unit is in the larger one by looping through an array and then do all of the other stuff for the hero with the same index as the large region.
 
Level 11
Joined
Jun 15, 2011
Messages
447
I know this question is a lil' off this thread,
(I said lil' meaning it's still close to it, like 10 meters far only)
Why do you use enter region based selection instead of buy unit selection? 'Cause I think selecting a unit by "buying" it like from taverns are better, and the unused heroes wont just stand in the corner of the map like they're waiting for nothing.

Just askin', but yeah... Keep it up, make and make and make maps!
 
Level 14
Joined
Dec 29, 2009
Messages
931
I know this question is a lil' off this thread,
(I said lil' meaning it's still close to it, like 10 meters far only)
Why do you use enter region based selection instead of buy unit selection? 'Cause I think selecting a unit by "buying" it like from taverns are better, and the unused heroes wont just stand in the corner of the map like they're waiting for nothing.

Just askin', but yeah... Keep it up, make and make and make maps!

Personal preference.
I've used taverns many times before, and as I said once already, I like being able to view the hero and its model beforehand.

You could set it up so that there's a larger region around the hero selection one, and check if the selection unit is in the larger one by looping through an array and then do all of the other stuff for the hero with the same index as the large region.

What do you mean?

Uhmm, cache (Owner of (Triggering unit)) to make it more fastah!

Btw, use hashtables for a much efficient data registry.

Yes dear. ;p

Why not just place the units already on the map in the circle?
This way I can use a loop to create the heroes and then set them to their values.
What's different about this system is that the heroes standing in the circles AREN'T just left there.

They're the ones used by the players.
You could see that if you took a closer look at the triggers.
 
Level 8
Joined
Oct 12, 2011
Messages
483
I don't think you can get the triggering region... What I meant is that when the unit enters a region, you would normally check which region the unit is in, by sticking an if/then in a loop that goes through each region. However, if a unit just enters the region, it is not entirely in the region, which is why you need a larger region. I'd also recommend creating the regions via triggers around the hero.
 
Level 14
Joined
Dec 29, 2009
Messages
931
The regions are used to create the heroes so you obviously can't create the regions using triggers. ;p As for the loop I'm not sure it's worth doing at this point. c:

The 12 triggers don't amount to much difference in the long run.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
here is what i mean. here is the map init trigger

  • region
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set regionArray[1] = Region 000 <gen>
      • Set regionArray[2] = Region 001 <gen>
      • Set regionArray[3] = Region 002 <gen>
      • Set regionArray[4] = Region 003 <gen>
here is the trigger that fires when unit enters the region.
  • unit enters
    • Events
      • Unit - A unit enters Region 000 <gen>
      • Unit - A unit enters Region 001 <gen>
      • Unit - A unit enters Region 002 <gen>
      • Unit - A unit enters Region 003 <gen>
    • Conditions
    • Actions
      • Set tempUnit = (Triggering unit)
      • For each (Integer tempInt) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (regionArray[tempInt] contains tempUnit) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: (The unit is in region + (String(tempInt)))
            • Else - Actions
were i have the game display message thats were u spawn ur units. this will bring all hero spawn triggers into one simple trigger. ( in a map init trigger u will need to store the regions and the units to be spawned)
 
Status
Not open for further replies.
Top