Auto-translated
Good afternoon. I have another question, but this time about scripts. How can I create a script so that if a Necromancer hero (Pelt with a script name) captures a human town and its buildings, they would burn down, just like in the campaign for Freya, and be replaced with Necromancer buildings and towns of the same level. Moreover, the hero must actually "enter" the garrison, and not just visit the town. Is this possible?
function InitBuildings()
for i, building in GetObjectNamesByType"PEASANT_HUT" do
Trigger(5, building, "TransformBuilding")
end
for i, building in GetObjectNamesByType"ARCHERS_HOUSE" do
Trigger(5, building, "TransformBuilding")
end
for i, building in GetObjectNamesByType"BARRACKS" do
Trigger(5, building, "TransformBuilding")
end
for i, building in GetObjectNamesByType"HEAVEN_MILITARY_POST" do
Trigger(5, building, "TransformBuilding")
end
end
function TransformBuilding(_, _, hero, building)
if hero == "Pelt" then
ReplaceDwelling(building, TOWN_NECROMANCY)
end
end
function TransformHavenTown(_, _, hero)
if hero == "Pelt" then
TransformTown("script name of the town", TOWN_NECROMANCY)
sleep(10)
SetObjectPosition("Pelt", GetObjectPosition("script name of the town"))
end
end
startThread(InitBuildings)
Trigger(5, "script name of the town", "TransformHavenTown")And it is desirable to set the hidden parameter CanCaptureOnlyNotVisit to true, otherwise the Necromancer might disappear.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4