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

Start Position Units

Status
Not open for further replies.
Level 1
Joined
May 23, 2014
Messages
2
Hello everybody.
I have a simple problem: I want to keep my castle at my start position but I want to delete the worker units.
Is somebody able to help me? c:
 
Level 12
Joined
Nov 3, 2013
Messages
989
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) this should be a variable with all playing players instead but w/e and do (Actions)
        • Loop - Actions
          • Set PlayerVar = Picked Player
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Race of PlayerVar) Equal to Human
            • Then - Actions
              • Unit - Create 1 Town Hall for PlayerVar at (PlayerVar start location) facing Default building facing degrees
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Race of PlayerVar) Equal to Night Elf
                • Then - Actions
                  • Unit - Create 1 TreeBaseShitElvesHaveLoL for PlayerVar at (PlayerVar start location) facing Default building facing degrees
                • Else - Actions
                  • ETC...
 
Create a new trigger named "CreateBase". Convert it to jass script, and delete everything in it... and then copy & paste this code:
JASS:
function Trig_Create_Base_Actions takes nothing returns nothing
    local integer i = 0
    local player p
    local race r
    loop
        set p = Player(i)
        if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING then
            set r = GetPlayerRace(p)
            if r == RACE_HUMAN then
                call CreateUnit(p, 'htow', GetStartLocationX(i), GetStartLocationY(i), 0)
            elseif r == RACE_ORC then
                call CreateUnit(p, 'ogre', GetStartLocationX(i), GetStartLocationY(i), 0)
            elseif r == RACE_UNDEAD then
                call CreateUnit(p, 'unpl', GetStartLocationX(i), GetStartLocationY(i), 0)
            elseif r == RACE_NIGHTELF then
                call CreateUnit(p, 'etol', GetStartLocationX(i), GetStartLocationY(i), 0)
            endif
        endif
        set i = i + 1
        exitwhen i > 11
    endloop
endfunction

function InitTrig_CreateBase takes nothing returns nothing
    set gg_trg_CreateBase = CreateTrigger(  )
    call TriggerAddAction( gg_trg_CreateBase, function Trig_Create_Base_Actions )
endfunction
Then you can use following to create a base for each player at his start location:
  • Trigger - Run CreateBase
You might want to put this action in your init trigger, and remove the action "CreateStartingUnits" from there.

Have not tested it, but should work.

Edit:
Seems I was too slow. :s
 
Status
Not open for further replies.
Top