• 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.

Starting Units

Status
Not open for further replies.
Level 7
Joined
Dec 28, 2009
Messages
257
Hello There.

I would like to ask: How can i make trigger or something which will change Melee Starting units? Lets say that i want to have Naga starting units when i play for Night elves (example) - how do i change their Town Hall and Workers into Murgul slaves and Temple of Tides?

Ive got some trigger which works like this:
3515v84.jpg


It creates starting units, however, instead o 5 Murgul Slaves i get 15 of them, and sometimes 3 town halls.
And also, when i want to do this with Undead, problem occurs: instead of 5 workers they have 3Acolytes and 1 Ghoul, and their mine is turned into Haunted Gold Mine. how can i turn Undead base into classic 5workers+town hall base?

Also, one thing: Is it against forum laws to spam here tons of questions? Cause i need help with one project im working on, and it still seems im lame editor. Or can i open one topic where i could i ask all my questions? or find some clever guy whom i could disturb with my questions? :D
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
but why dont create your trigger instead use melee crap? :p

like this

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Player - Set (Player((Integer A))) Current gold to 1000
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Player((Integer A)))) Equal to Human
                • Then - Actions
                  • Set UnitTypeVar = Worker (Blood Elf)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Player((Integer A)))) Equal to Night Elf
                • Then - Actions
                  • Set UnitTypeVar = Wisp
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Player((Integer A)))) Equal to Orc
                • Then - Actions
                  • Set UnitTypeVar = Fel Orc Peon
                • Else - Actions
              • Set p = ((Player((Integer A))) start location)
              • Unit - Create 1 UnitTypeVar for (Player((Integer A))) at p facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_p)
            • Else - Actions
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Also, one thing: Is it against forum laws to spam here tons of questions? Cause i need help with one project im working on, and it still seems im lame editor. Or can i open one topic where i could i ask all my questions? or find some clever guy whom i could disturb with my questions? :D

Just list the questions you have in a numbered list like this:

  1. First question?
  2. Second Question?
  3. Third Question?
  4. Fourth Question?

And then those who know the answer to the question will provide the number + the answer. That's usually what happens :)
State them please, I can't wait to solve questions! :p
 
Level 7
Joined
Dec 28, 2009
Messages
257
but why dont create your trigger instead use melee crap? :p

like this

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Player - Set (Player((Integer A))) Current gold to 1000
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Player((Integer A)))) Equal to Human
                • Then - Actions
                  • Set UnitTypeVar = Worker (Blood Elf)
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Player((Integer A)))) Equal to Night Elf
                • Then - Actions
                  • Set UnitTypeVar = Wisp
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Player((Integer A)))) Equal to Orc
                • Then - Actions
                  • Set UnitTypeVar = Fel Orc Peon
                • Else - Actions
              • Set p = ((Player((Integer A))) start location)
              • Unit - Create 1 UnitTypeVar for (Player((Integer A))) at p facing Default building facing degrees
              • Custom script: call RemoveLocation(udg_p)
            • Else - Actions

Well, Thanks, for you shortened my 4 triggers (1 for each race) into 1. However, this didnt solve problem with undead - they still have additional Ghoul and Haunted Gold Mine!




Just list the questions you have in a numbered list like this:

  1. First question?
  2. Second Question?
  3. Third Question?
  4. Fourth Question?

And then those who know the answer to the question will provide the number + the answer. That's usually what happens :)
State them please, I can't wait to solve questions! :p

I would prefer opening topic and then asking all these questions, because i may ask 4questions in 1 topic, and another 4 next day in another one, and i would create already 2 topics :D

But i cant think of anything to ask right now.. :D
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Well, Thanks, for you shortened my 4 triggers (1 for each race) into 1. However, this didnt solve problem with undead - they still have additional Ghoul and Haunted Gold Mine!

sorry but i dont see ur problem since it is custimizable easily, as u want but anyway why want create ghoul too and not just acolyte who can build and harvest gold?

  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player((Integer A))) slot status) Equal to Is playing
        • Then - Actions
          • Set p = ((Player((Integer A))) start location)
          • Player - Set (Player((Integer A))) Current gold to 1000
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Human
            • Then - Actions
              • Set UnitTypeVar = Worker (Blood Elf)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Night Elf
            • Then - Actions
              • Set UnitTypeVar = Wisp
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Orc
            • Then - Actions
              • Set UnitTypeVar = Fel Orc Peon
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Undead
            • Then - Actions
              • Set UnitTypeVar = Acolyte
              • Unit - Create 2 Ghoul for (Player((Integer A))) at p facing Default building facing degrees
            • Else - Actions
          • Unit - Create 3 UnitTypeVar for (Player((Integer A))) at p facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_p)
        • Else - Actions
 
sorry but i dont see ur problem since it is custimizable easily, as u want but anyway why want create ghoul too and not just acolyte who can build and harvest gold?

  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player((Integer A))) slot status) Equal to Is playing
        • Then - Actions
          • Set p = ((Player((Integer A))) start location)
          • Player - Set (Player((Integer A))) Current gold to 1000
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Human
            • Then - Actions
              • Set UnitTypeVar = Worker (Blood Elf)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Night Elf
            • Then - Actions
              • Set UnitTypeVar = Wisp
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Orc
            • Then - Actions
              • Set UnitTypeVar = Fel Orc Peon
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Undead
            • Then - Actions
              • Set UnitTypeVar = Acolyte
              • Unit - Create 2 Ghoul for (Player((Integer A))) at p facing Default building facing degrees
            • Else - Actions
          • Unit - Create 3 UnitTypeVar for (Player((Integer A))) at p facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_p)
        • Else - Actions

A little optimisation -->


  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Player((Integer A))) slot status) Equal to Is playing
        • Then - Actions
          • Set p = ((Player((Integer A))) start location)
          • Player - Set (Player((Integer A))) Current gold to 1000
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of (Player((Integer A)))) Equal to Human
            • Then - Actions
              • Set UnitTypeVar = Worker (Blood Elf)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of (Player((Integer A)))) Equal to Night Elf
                • Then - Actions
                  • Set UnitTypeVar = Wisp
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Race of (Player((Integer A)))) Equal to Orc
                    • Then - Actions
                      • Set UnitTypeVar = Fel Orc Peon
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Race of (Player((Integer A)))) Equal to Undead
                        • Then - Actions
                          • Set UnitTypeVar = Acolyte
                          • Unit - Create 2 Ghoul for (Player((Integer A))) at p facing Default building facing degrees
                        • Else - Actions
          • Unit - Create 3 UnitTypeVar for (Player((Integer A))) at p facing Default building facing degrees
          • Custom script: call RemoveLocation(udg_p)
        • Else - Actions
 
Level 7
Joined
Dec 28, 2009
Messages
257
Viola, it works!
First i tried using trigger "Melee Map - create starting units for all players", and instead of creating new units, i used your trigger and action "Replace these units with "UnitTypVar".

However, then i tried it without Melee Map trigger, and it worked - only with one problem, and that it didnt create Town Hall.
So i improved that trigger, so it would build town hall and viola - it works!

Also, i was little bit afraid, because when creating 5workers + town hall on 1point, it might happen that one of these units wouldnt be created.

But it works!
So, thank you! :D


And one more thing i would like to ask before closing topic:
I need this trigger, because im working on map with different races (as you might realize). But when i play for Night Elves, im supposed to get Naga starting units. This works perfectly, but at beggining of the game, is gives me warning that if i wont build Town Hall in 2 minutes, i will be revealed to other players. But since my town hall is Temple of Tides, and it wants me to build Tree of Life...
Well, can somebody help me how to remove this thing? It would help me very much.
 
Level 7
Joined
Dec 28, 2009
Messages
257
1 hour later:
Hell no, it doesnt work properly.

When using this trigger, Town Hall is created further away from gold mine than usual. And sometimes is thrown near trees. One might say it's just aestethical thing, but it takes more time for workers to gain gold and so on.

Another reason why i prefer using trigger to create melee units and then replace them with my new. Yeah, it works, but i would prefer it to be more perfect...

Edit: My mystake, i just switched it so 1st goes creation of town hall and 2nd are workers. Still, workers arent created at the same spot as during any other Melee Game, but at least town hall hasnt moved.
 
Last edited:
Level 7
Joined
Dec 28, 2009
Messages
257
Well, i said it. Creating starting units with alternative/customized (not melee one) sucks. Yeah, now i got trigger which easily creates starting units for custom race, but with one problem.

When using Melee Map trigger, that trigger also sets price of your 1st hero to nothing (thats why 1st hero is free). However, by deleting trigger "Melee Map - Create starting units for (all players)" i deleted this. So, my 1st hero costs 425gold and 100lumber instead of nothing. Its very funny chopping extra trees and lumber coz of this.

So, as i said, i can either create basic trigger which replaces melee created units by custom ones, or somehow remove Melee created units and keep customized trigger created ones.

gosh. I hope you understand what i mean.

Hunt for perfect trigger starts once again.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Well, i said it. Creating starting units with alternative/customized (not melee one) sucks. Yeah, now i got trigger which easily creates starting units for custom race, but with one problem.

When using Melee Map trigger, that trigger also sets price of your 1st hero to nothing (thats why 1st hero is free). However, by deleting trigger "Melee Map - Create starting units for (all players)" i deleted this. So, my 1st hero costs 425gold and 100lumber instead of nothing. Its very funny chopping extra trees and lumber coz of this.

So, as i said, i can either create basic trigger which replaces melee created units by custom ones, or somehow remove Melee created units and keep customized trigger created ones.

gosh. I hope you understand what i mean.

Hunt for perfect trigger starts once again.

Well you could delete the
  • Melee Game - Create starting units (for all players)
It's basically this native:
JASS:
function MeleeStartingUnits takes nothing returns nothing
    local integer  index
    local player   indexPlayer
    local location indexStartLoc
    local race     indexRace

    call Preloader( "scripts\\SharedMelee.pld" )

    set index = 0
    loop
        set indexPlayer = Player(index)
        if (GetPlayerSlotState(indexPlayer) == PLAYER_SLOT_STATE_PLAYING) then
            set indexStartLoc = GetStartLocationLoc(GetPlayerStartLocation(indexPlayer))
            set indexRace = GetPlayerRace(indexPlayer)

            // Create initial race-specific starting units
            if (indexRace == RACE_HUMAN) then
                call MeleeStartingUnitsHuman(indexPlayer, indexStartLoc, true, true, true)
            elseif (indexRace == RACE_ORC) then
                call MeleeStartingUnitsOrc(indexPlayer, indexStartLoc, true, true, true)
            elseif (indexRace == RACE_UNDEAD) then
                call MeleeStartingUnitsUndead(indexPlayer, indexStartLoc, true, true, true)
            elseif (indexRace == RACE_NIGHTELF) then
                call MeleeStartingUnitsNightElf(indexPlayer, indexStartLoc, true, true, true)
            else
                call MeleeStartingUnitsUnknownRace(indexPlayer, indexStartLoc, true, true, true)
            endif
        endif

        set index = index + 1
        exitwhen index == bj_MAX_PLAYERS
    endloop
    
endfunction

You can customize it to your likings by creating a melee unit creation function yourself.
Or you can alter SharedMelee.pld but it might be easier for you to just not use that GUI action and create the customized units through triggers.
 
Level 7
Joined
Dec 28, 2009
Messages
257
Well, to be honest, i dont understand that JASS thing much, maybe because ive got no JASS experience :D

But what i need right now is:
Trigger which replaces unit created by "Melee Game - Create starting units (for all players)" by my custom ones (i think i said this few times). Also, i need solution for Undead problem (replacing Necropolis+Haunted Mine + 3Acolytes +Ghoul by Town Hall + 5 Workers).

Could you please turn that JASS thing into GUI trigger please? :D I know i ask this like tenth time, but yet nobody ansewered me this thing.

(Yeah, i could do it by 10 100 different ways, but this one is easiest. I will avoid problems with expensive heroes (as i mentioned in another topic), and it will work just fine like any other trigger.)
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
Well, to be honest, i dont understand that JASS thing much, maybe because ive got no JASS experience :D

But what i need right now is:
Trigger which replaces unit created by "Melee Game - Create starting units (for all players)" by my custom ones (i think i said this few times). Also, i need solution for Undead problem (replacing Necropolis+Haunted Mine + 3Acolytes +Ghoul by Town Hall + 5 Workers).

Could you please turn that JASS thing into GUI trigger please? :D I know i ask this like tenth time, but yet nobody ansewered me this thing.

(Yeah, i could do it by 10 100 different ways, but this one is easiest. I will avoid problems with expensive heroes (as i mentioned in another topic), and it will work just fine like any other trigger.)

Well this would be one of the ways to do it:
  • Replace Units
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Footman) and do (Actions)
        • Loop - Actions
          • Unit - Replace (Picked unit) with a Peasant using The new unit's default life and mana
And then do that for every unit type.

There are lots of other ways of doing it. It's pretty simple actually. But why do you want to use Melee Game - Create starting units (for all players) specifically if you can create units through triggers yourself?
I usually remove all of the melee actions and then create them myself. It's better to have more controll over wat you do in generall then having to rely on functions that might not do what you want them to.
 
Level 7
Joined
Dec 28, 2009
Messages
257
Because when i deleted trigger "Melee Game - Create starting units for All players", i deleted some sort of mechanism which sets price of 1st hero to nothing (1st hero is always free, now you know why).

note: When you use trigger "Create (racial) starting units for player X", it says one more thing: Exclude/include heroes. So it seems that "excluding heroes" means that price of 1st hero is nothing. Check out triggers if you dont know what i mean.

But about problem:
During night i was wondering about some solution, and guess wha: ive found one.

33nwba9.jpg


I used "shadowvzs" trigger to create units, but with some adjustment. Since i needed Melee trigger, i used one which creates starting units for 1race for every player - Human in this case. So, my trigger creates Human starting units despite the fact that your race is Night elf. By this, i solved problem with expensive heroes.

Then comes the shadowvzs trigger. Instead of creating new units, it just replaces Human starting units of each player by starting units for his race. Also, this solved Undead problem with ghoul+acolyte+gold mine, since every player starts with 5workers and town hall. Then its easier to replace than with undead.

Blahblah. I wonder why im explaining all this, coz i think i am the dumb one here, not you. But thank you, it seems that ive solved almost every problem with my map. For now. :D

but dont be surprised if you will find another topic from me in questions "help zone" section :D
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
I'll just leave this here for elaborating purposes:

JASS:
function MeleeStartingUnitsForPlayer takes race whichRace, player whichPlayer, location loc, boolean doHeroes returns nothing
    // Create initial race-specific starting units
    if (whichRace == RACE_HUMAN) then
        call MeleeStartingUnitsHuman(whichPlayer, loc, doHeroes, false, false)
    elseif (whichRace == RACE_ORC) then
        call MeleeStartingUnitsOrc(whichPlayer, loc, doHeroes, false, false)
    elseif (whichRace == RACE_UNDEAD) then
        call MeleeStartingUnitsUndead(whichPlayer, loc, doHeroes, false, false)
    elseif (whichRace == RACE_NIGHTELF) then
        call MeleeStartingUnitsNightElf(whichPlayer, loc, doHeroes, false, false)
    else
        // Unrecognized race - ignore the request.
    endif
endfunction

This is what happens when using this action:

Melee Game - Create Starting Units For Player

Now lets take an example with one of the races:

JASS:
call MeleeStartingUnitsHuman(whichPlayer, loc, doHeroes, false, false)

This will start creating units of the human race for a player at a starting location where it also needs to be specified if heroes need to be included or not.

This is what that function call does:
JASS:
function MeleeStartingUnitsHuman takes player whichPlayer, location startLoc, boolean doHeroes, boolean doCamera, boolean doPreload returns nothing
    local boolean  useRandomHero = IsMapFlagSet(MAP_RANDOM_HERO)
    local real     unitSpacing   = 64.00
    local unit     nearestMine
    local location nearMineLoc
    local location heroLoc
    local real     peonX
    local real     peonY
    local unit     townHall = null

    if (doPreload) then
        call Preloader( "scripts\\HumanMelee.pld" )
    endif

    set nearestMine = MeleeFindNearestMine(startLoc, bj_MELEE_MINE_SEARCH_RADIUS)
    if (nearestMine != null) then
        // Spawn Town Hall at the start location.
        set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING)
        
        // Spawn Peasants near the mine.
        set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0)
        set peonX = GetLocationX(nearMineLoc)
        set peonY = GetLocationY(nearMineLoc)
        call CreateUnit(whichPlayer, 'hpea', peonX + 0.00 * unitSpacing, peonY + 1.00 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX + 1.00 * unitSpacing, peonY + 0.15 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX - 1.00 * unitSpacing, peonY + 0.15 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX + 0.60 * unitSpacing, peonY - 1.00 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX - 0.60 * unitSpacing, peonY - 1.00 * unitSpacing, bj_UNIT_FACING)

        // Set random hero spawn point to be off to the side of the start location.
        set heroLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 384, 45)
    else
        // Spawn Town Hall at the start location.
        set townHall = CreateUnitAtLoc(whichPlayer, 'htow', startLoc, bj_UNIT_FACING)
        
        // Spawn Peasants directly south of the town hall.
        set peonX = GetLocationX(startLoc)
        set peonY = GetLocationY(startLoc) - 224.00
        call CreateUnit(whichPlayer, 'hpea', peonX + 2.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX + 1.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX + 0.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX - 1.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
        call CreateUnit(whichPlayer, 'hpea', peonX - 2.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)

        // Set random hero spawn point to be just south of the start location.
        set heroLoc = Location(peonX, peonY - 2.00 * unitSpacing)
    endif

    if (townHall != null) then
        call UnitAddAbilityBJ('Amic', townHall)
        call UnitMakeAbilityPermanentBJ(true, 'Amic', townHall)
    endif

    if (doHeroes) then
        // If the "Random Hero" option is set, start the player with a random hero.
        // Otherwise, give them a "free hero" token.
        if useRandomHero then
            call MeleeRandomHeroLoc(whichPlayer, 'Hamg', 'Hmkg', 'Hpal', 'Hblm', heroLoc)
        else
            call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_HERO_TOKENS, bj_MELEE_STARTING_HERO_TOKENS)
        endif
    endif

    if (doCamera) then
        // Center the camera on the initial Peasants.
        call SetCameraPositionForPlayer(whichPlayer, peonX, peonY)
        call SetCameraQuickPositionForPlayer(whichPlayer, peonX, peonY)
    endif
endfunction

If you noticed this part inside that function:
JASS:
if (doHeroes) then
        // If the "Random Hero" option is set, start the player with a random hero.
        // Otherwise, give them a "free hero" token.
        if useRandomHero then
            call MeleeRandomHeroLoc(whichPlayer, 'Hamg', 'Hmkg', 'Hpal', 'Hblm', heroLoc)
        else
            call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_HERO_TOKENS, bj_MELEE_STARTING_HERO_TOKENS)
        endif
endif

And if you have also noticed this:
JASS:
local boolean  useRandomHero = IsMapFlagSet(MAP_RANDOM_HERO)
Then you know why it made the first hero free.

If you don't then let me elaborate:
If the map's flag is set to have random hero's then a random hero will be spawned for the player.
If the map's flag is set to not have a random hero, a token will be given to that player so that the player can buy a free first hero.
It is a basic rule of melee maps to have a token at start when no random hero is given.

Also, notice that if you exclude hero's from the action:
Melee Game - Create Starting Units For Player
Then a hero token will not be given nor will a random hero spawn.

I hope you can comprehend what I tried to explain here and that you now slightly understand why the first hero was free.
Code:
"It was due to a token given to the player because the player was not given a random hero at start (which is a flag that can be set when you want to play a melee map).
And because the action: 'Melee Game - Create Starting Units For Player' included hero's"

I hope this explenation on why the first hero was free was helpfull.

Mouzyy said:
but dont be surprised if you will find another topic from me in questions "help zone" section :D
Keep them comming, we'll handle it.
 
Last edited:
Status
Not open for further replies.
Top