The search keyword must be a single word (no spaces).
Function MeleeStartingUnitsUndead
- Line
- 8777
- Location
- blizzard.j
- Constant?
- no
- Type
- function
- Arguments
- player whichPlayer, location startLoc, boolean doHeroes, boolean doCamera, boolean doPreload
- Returns
- nothing
| 8777 | function MeleeStartingUnitsUndead takes player whichPlayer, location startLoc, boolean doHeroes, boolean doCamera, boolean doPreload returns nothing |
| 8778 | local boolean useRandomHero = IsMapFlagSet(MAP_RANDOM_HERO) |
| 8779 | local real unitSpacing = 64.00 |
| 8780 | local unit nearestMine |
| 8781 | local location nearMineLoc |
| 8782 | local location nearTownLoc |
| 8783 | local location heroLoc |
| 8784 | local real peonX |
| 8785 | local real peonY |
| 8786 | local real ghoulX |
| 8787 | local real ghoulY |
| 8788 | |
| 8789 | if (doPreload) then |
| 8790 | call Preloader( "scripts\\UndeadMelee.pld" ) |
| 8791 | endif
|
| 8792 | |
| 8793 | set nearestMine = MeleeFindNearestMine(startLoc, bj_MELEE_MINE_SEARCH_RADIUS) |
| 8794 | if (nearestMine != null) then |
| 8795 | // Spawn Necropolis at the start location.
|
| 8796 | call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) |
| 8797 | |
| 8798 | // Replace the nearest gold mine with a blighted version.
|
| 8799 | set nearestMine = BlightGoldMineForPlayerBJ(nearestMine, whichPlayer) |
| 8800 | |
| 8801 | // Spawn Ghoul near the Necropolis.
|
| 8802 | set nearTownLoc = MeleeGetProjectedLoc(startLoc, GetUnitLoc(nearestMine), 288, 0) |
| 8803 | set ghoulX = GetLocationX(nearTownLoc) |
| 8804 | set ghoulY = GetLocationY(nearTownLoc) |
| 8805 | set bj_ghoul[GetPlayerId(whichPlayer)] = CreateUnit(whichPlayer, 'ugho', ghoulX + 0.00 * unitSpacing, ghoulY + 0.00 * unitSpacing, bj_UNIT_FACING) |
| 8806 | |
| 8807 | // Spawn Acolytes near the mine.
|
| 8808 | set nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0) |
| 8809 | set peonX = GetLocationX(nearMineLoc) |
| 8810 | set peonY = GetLocationY(nearMineLoc) |
| 8811 | call CreateUnit(whichPlayer, 'uaco', peonX + 0.00 * unitSpacing, peonY + 0.50 * unitSpacing, bj_UNIT_FACING) |
| 8812 | call CreateUnit(whichPlayer, 'uaco', peonX + 0.65 * unitSpacing, peonY - 0.50 * unitSpacing, bj_UNIT_FACING) |
| 8813 | call CreateUnit(whichPlayer, 'uaco', peonX - 0.65 * unitSpacing, peonY - 0.50 * unitSpacing, bj_UNIT_FACING) |
| 8814 | |
| 8815 | // Create a patch of blight around the gold mine.
|
| 8816 | call SetBlightLoc(whichPlayer,nearMineLoc, 768, true) |
| 8817 | |
| 8818 | // Set random hero spawn point to be off to the side of the start location.
|
| 8819 | set heroLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 384, 45) |
| 8820 | else
|
| 8821 | // Spawn Necropolis at the start location.
|
| 8822 | call CreateUnitAtLoc(whichPlayer, 'unpl', startLoc, bj_UNIT_FACING) |
| 8823 | |
| 8824 | // Spawn Acolytes and Ghoul directly south of the Necropolis.
|
| 8825 | set peonX = GetLocationX(startLoc) |
| 8826 | set peonY = GetLocationY(startLoc) - 224.00 |
| 8827 | call CreateUnit(whichPlayer, 'uaco', peonX - 1.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING) |
| 8828 | call CreateUnit(whichPlayer, 'uaco', peonX - 0.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING) |
| 8829 | call CreateUnit(whichPlayer, 'uaco', peonX + 0.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING) |
| 8830 | call CreateUnit(whichPlayer, 'ugho', peonX + 1.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING) |
| 8831 | |
| 8832 | // Create a patch of blight around the start location.
|
| 8833 | call SetBlightLoc(whichPlayer,startLoc, 768, true) |
| 8834 | |
| 8835 | // Set random hero spawn point to be just south of the start location.
|
| 8836 | set heroLoc = Location(peonX, peonY - 2.00 * unitSpacing) |
| 8837 | endif
|
| 8838 | |
| 8839 | if (doHeroes) then |
| 8840 | // If the "Random Hero" option is set, start the player with a random hero.
|
| 8841 | // Otherwise, give them a "free hero" token.
|
| 8842 | if useRandomHero then |
| 8843 | call MeleeRandomHeroLoc(whichPlayer, 'Udea', 'Udre', 'Ulic', 'Ucrl', heroLoc) |
| 8844 | else
|
| 8845 | call SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_HERO_TOKENS, bj_MELEE_STARTING_HERO_TOKENS) |
| 8846 | endif
|
| 8847 | endif
|
| 8848 | |
| 8849 | if (doCamera) then |
| 8850 | // Center the camera on the initial Acolytes.
|
| 8851 | call SetCameraPositionForPlayer(whichPlayer, peonX, peonY) |
| 8852 | call SetCameraQuickPositionForPlayer(whichPlayer, peonX, peonY) |
| 8853 | endif
|
| 8854 | endfunction
|