Jass:MeleeStartingUnitsHuman
Aus Mappedia
| Funktion: MeleeStartingUnitsHuman | |
|---|---|
| Parameter: | player location boolean boolean boolean |
| Rückgabewert: | nothing |
| Autor: | Blizzard |
| Quelle: | Blizzard.j |
| Synchron: | Unbekannt |
Code
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
Parameter
| Typ | Name | Beschreibung |
|---|---|---|
| player | whichPlayer | |
| location | startLoc | |
| boolean | doHeroes | |
| boolean | doCamera | |
| boolean | doPreload |
