Auto-translated
Okay?
function InitBuildings() -- function, its name, and the list of arguments it receives in parentheses
for i, building in GetObjectNamesByType"PEASANT_HUT" do -- iteration through the array of object names of type "PEASANT_HUT" (peasant huts)
Trigger(5, building, "TransformBuilding") -- trigger on capture (5), building - variable in the loop, TransformBuilding - the name of the function called upon capture
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 -- check the hero by name
ReplaceDwelling(building, TOWN_NECROMANCY) -- transform the building into the corresponding Necromancy building
end
end
function TransformHavenTown(_, _, hero)
if hero == "Pelt" then
TransformTown("scripted town name", TOWN_NECROMANCY) -- transform the town into a Necromancy town
sleep(10) -- pause for 2 seconds
SetObjectPosition("Pelt", GetObjectPosition("scripted town name")) -- move the hero to the town's coordinates (if the garrison is free, the hero will be placed there)
end
end
startThread(InitBuildings) -- start the function in a new thread; return values are ignored; does not wait for the function to complete
Trigger(5, "scripted town name", "TransformHavenTown")
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4