Кто-нить может подсказать пожалуйста. У меня на карте выбор расы через чатик и когда вводишь цифру 3 должна быть Нежить, и создаются базовые юниты через триггеры в месте стартовой позиции. А что делать с Проклятым рудником, тк если я его триггерно создам, то на базе будет 2 рудника (один проклятый другой стандартный который стоял на карте изначально). Можно ли как-то сделать так, чтобы изначальный рудник стал проклятым. (допустим у эльфов можно через команду - моментально оплести рудник), а у нежити я хз как
Принятый ответ
Как видно из blizzard.j они тупо удаляют рудник и ставят порченный.
--===========================================================================
-- Starting Units for Undead Players
-- - 1 Necropolis, placed at start location
-- - 1 Haunted Gold Mine, placed on nearest gold mine
-- - 3 Acolytes, placed between start location and nearest gold mine
-- - 1 Ghoul, placed between start location and nearest gold mine
-- - Blight, centered on nearest gold mine, spread across a "large area"
--
---@param whichPlayer player
---@param startLoc location
---@param doHeroes boolean
---@param doCamera boolean
---@param doPreload boolean
function MeleeStartingUnitsUndead(whichPlayer, startLoc, doHeroes, doCamera, doPreload)
local useRandomHero = IsMapFlagSet(MAP_RANDOM_HERO) ---@type boolean
local unitSpacing = 64.00 ---@type real
local nearestMine = nil ---@type unit
local nearMineLoc = nil ---@type location
local nearTownLoc = nil ---@type location
local heroLoc = nil ---@type location
local peonX = nil ---@type real
local peonY = nil ---@type real
local ghoulX = nil ---@type real
local ghoulY = nil ---@type real
if (doPreload) then
Preloader( "scripts\\UndeadMelee.pld" )
end
nearestMine = MeleeFindNearestMine(startLoc, bj_MELEE_MINE_SEARCH_RADIUS)
if (nearestMine ~= nil ) then
-- Spawn Necropolis at the start location.
CreateUnitAtLoc(whichPlayer, FourCC('unpl'), startLoc, bj_UNIT_FACING)
-- Replace the nearest gold mine with a blighted version.
nearestMine = BlightGoldMineForPlayerBJ(nearestMine, whichPlayer)
-- Spawn Ghoul near the Necropolis.
nearTownLoc = MeleeGetProjectedLoc(startLoc, GetUnitLoc(nearestMine), 288, 0)
ghoulX = GetLocationX(nearTownLoc)
ghoulY = GetLocationY(nearTownLoc)
bj_ghoul[GetPlayerId(whichPlayer)] = CreateUnit(whichPlayer, FourCC('ugho'), ghoulX + 0.00 * unitSpacing, ghoulY + 0.00 * unitSpacing, bj_UNIT_FACING)
-- Spawn Acolytes near the mine.
nearMineLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 320, 0)
peonX = GetLocationX(nearMineLoc)
peonY = GetLocationY(nearMineLoc)
CreateUnit(whichPlayer, FourCC('uaco'), peonX + 0.00 * unitSpacing, peonY + 0.50 * unitSpacing, bj_UNIT_FACING)
CreateUnit(whichPlayer, FourCC('uaco'), peonX + 0.65 * unitSpacing, peonY - 0.50 * unitSpacing, bj_UNIT_FACING)
CreateUnit(whichPlayer, FourCC('uaco'), peonX - 0.65 * unitSpacing, peonY - 0.50 * unitSpacing, bj_UNIT_FACING)
-- Create a patch of blight around the gold mine.
SetBlightLoc(whichPlayer,nearMineLoc, 768, true)
-- Set random hero spawn point to be off to the side of the start location.
heroLoc = MeleeGetProjectedLoc(GetUnitLoc(nearestMine), startLoc, 384, 45)
else
-- Spawn Necropolis at the start location.
CreateUnitAtLoc(whichPlayer, FourCC('unpl'), startLoc, bj_UNIT_FACING)
-- Spawn Acolytes and Ghoul directly south of the Necropolis.
peonX = GetLocationX(startLoc)
peonY = GetLocationY(startLoc) - 224.00
CreateUnit(whichPlayer, FourCC('uaco'), peonX - 1.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
CreateUnit(whichPlayer, FourCC('uaco'), peonX - 0.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
CreateUnit(whichPlayer, FourCC('uaco'), peonX + 0.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
CreateUnit(whichPlayer, FourCC('ugho'), peonX + 1.50 * unitSpacing, peonY + 0.00 * unitSpacing, bj_UNIT_FACING)
-- Create a patch of blight around the start location.
SetBlightLoc(whichPlayer,startLoc, 768, true)
-- Set random hero spawn point to be just south of the start location.
heroLoc = Location(peonX, peonY - 2.00 * unitSpacing)
end
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
MeleeRandomHeroLoc(whichPlayer, FourCC('Udea'), FourCC('Udre'), FourCC('Ulic'), FourCC('Ucrl'), heroLoc)
else
SetPlayerState(whichPlayer, PLAYER_STATE_RESOURCE_HERO_TOKENS, bj_MELEE_STARTING_HERO_TOKENS)
end
end
if (doCamera) then
-- Center the camera on the initial Acolytes.
SetCameraPositionForPlayer(whichPlayer, peonX, peonY)
SetCameraQuickPositionForPlayer(whichPlayer, peonX, peonY)
end
end
Вот этой функцией
--===========================================================================
-- Replaces a gold mine with a blighted gold mine for the given player.
--
---@param goldMine unit
---@param whichPlayer player
---@return unit
function BlightGoldMineForPlayerBJ(goldMine, whichPlayer)
local mineX = nil ---@type real
local mineY = nil ---@type real
local mineGold = nil ---@type integer
local newMine = nil ---@type unit
-- Make sure we're replacing a Gold Mine and not some other type of unit.
if GetUnitTypeId(goldMine) ~= FourCC('ngol') then
return nil
end
-- Save the Gold Mine's properties and remove it.
mineX = GetUnitX(goldMine)
mineY = GetUnitY(goldMine)
mineGold = GetResourceAmount(goldMine)
RemoveUnit(goldMine)
-- Create a Haunted Gold Mine to replace the Gold Mine.
newMine = CreateBlightedGoldmine(whichPlayer, mineX, mineY, bj_UNIT_FACING)
SetResourceAmount(newMine, mineGold)
return newMine
end
`
ОЖИДАНИЕ РЕКЛАМЫ...
Чтобы оставить комментарий, пожалуйста, войдите на сайт.
Отредактирован nazarpunk
NazarPunk:
а что с этим сделать? Просто вставить в триггеры? Я просто не вижу функции перевести в jass
Отредактирован PT153