| 8705 | function MeleeStartingUnitsOrc takes player whichPlayer, location startLoc, boolean doHeroes, boolean doCamera, boolean doPreload returns nothing
|
| 8706 | local boolean useRandomHero = IsMapFlagSet(MAP_RANDOM_HERO)
|
| 8707 | local real unitSpacing = 64.00
|
| 8708 | local unit nearestMine
|
| 8709 | local location nearMineLoc
|
| 8710 | local location heroLoc
|
| 8711 | local real peonX
|
| 8712 | local real peonY
|
| 8713 |
|
| 8714 | if (doPreload) then
|
| 8715 | call Preloader( "scripts\\OrcMelee.pld" )
|
| 8716 | endif
|
| 8717 |
|
| 8718 | set nearestMine = MeleeFindNearestMine(startLoc, bj_MELEE_MINE_SEARCH_RADIUS)
|
| 8719 | if (nearestMine != null) then
|
| 8720 | // Spawn Great Hall at the start location.
|
| 8721 | call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING)
|
| 8722 |
|
| 8723 | // Spawn Peons near the mine.
|
| 8724 | set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0)
|
| 8725 | set peonX = GetLocationX(nearMineLoc)
|
| 8726 | set peonY = GetLocationY(nearMineLoc)
|
| 8727 | call CreateUnit(whichPlayer, 'opeo', peonX + 0.00 * unitSpacing, peonY + 1.00 * unitSpacing, bj_UNIT_FACING)
|
| 8728 | call CreateUnit(whichPlayer, 'opeo', peonX + 1.00 * unitSpacing, peonY + 0.15 * unitSpacing, bj_UNIT_FACING)
|
| 8729 | call CreateUnit(whichPlayer, 'opeo', peonX - 1.00 * unitSpacing, peonY + 0.15 * unitSpacing, bj_UNIT_FACING)
|
| 8730 | call CreateUnit(whichPlayer, 'opeo', peonX + 0.60 * unitSpacing, peonY - 1.00 * unitSpacing, bj_UNIT_FACING)
|
| 8731 | call CreateUnit(whichPlayer, 'opeo', peonX - 0.60 * unitSpacing, peonY - 1.00 * unitSpacing, bj_UNIT_FACING)
|
| 8732 |
|
| 8733 | // Set random hero spawn point to be off to the side of the start location.
|
| 8734 | set heroLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 384, 45)
|
| 8735 | else
|
| 8736 | // Spawn Great Hall at the start location.
|
| 8737 | call CreateUnitAtLoc(whichPlayer, 'ogre', startLoc, bj_UNIT_FACING)
|
| 8738 |
|
| 8739 | // Spawn Peons directly south of the town hall.
|
| 8740 | set peonX = GetLocationX(startLoc)
|
| 8741 | set peonY = GetLocationY(startLoc) - 224.00
|
| 8742 | call CreateUnit(whichPlayer, 'opeo', peonX + 2.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
|
| 8743 | call CreateUnit(whichPlayer, 'opeo', peonX + 1.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
|
| 8744 | call CreateUnit(whichPlayer, 'opeo', peonX + 0.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
|
| 8745 | call CreateUnit(whichPlayer, 'opeo', peonX - 1.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
|
| 8746 | call CreateUnit(whichPlayer, 'opeo', peonX - 2.00 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
|
| 8747 |
|
| 8748 | // Set random hero spawn point to be just south of the start location.
|
| 8749 | set heroLoc = Location(peonX, peonY - 2.00 * unitSpacing)
|
| 8750 | endif
|
| 8751 |
|
| 8752 | if (doHeroes) then
|
| 8753 | // If the "Random Hero" option is set, start the player with a random hero.
|
| 8754 | // Otherwise, give them a "free hero" token.
|
| 8755 | if useRandomHero then
|
| 8756 | call MeleeRandomHeroLoc(whichPlayer, 'Obla', 'Ofar', 'Otch', 'Oshd', heroLoc)
|
| 8757 | else
|
| 8758 | call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_HERO_TOKENS, bj_MELEE_STARTING_HERO_TOKENS)
|
| 8759 | endif
|
| 8760 | endif
|
| 8761 |
|
| 8762 | if (doCamera) then
|
| 8763 | // Center the camera on the initial Peons.
|
| 8764 | call SetCameraPositionForPlayer(whichPlayer, peonX, peonY)
|
| 8765 | call SetCameraQuickPositionForPlayer(whichPlayer, peonX, peonY)
|
| 8766 | endif
|
| 8767 | endfunction
|