Пока так. Если будут ошибки, говори какие, будем исправлять.
HAVEN_DWLS = {}
hutt = 0
function burn()
for i, dw_type in {"PEASANT_HUT", "ARCHERS_HOUSE", "BARRACKS", "HEAVEN_MILITARY_POST"} do
for j, dw in GetObjectNamesByType(dw_type) do
HAVEN_DWLS[dw] = "откл"
SetObjectEnabled(dw, nil)
Trigger(4, dw, "BurnHavenDwelling")
end
end
startThread(burn2)
end
startThread(burn)
function burn2()
while 1 do
repeat
sleep()
until IsPlayerCurrent(1)
for dwelling, state in HAVEN_DWLS do
if state == "вкл" then
HAVEN_DWLS[dwelling] = "откл"
SetObjectEnabled(dwelling, nil)
Trigger(4, dwelling, "BurnHavenDwelling")
end
end
repeat
sleep()
until not IsPlayerCurrent(1)
for dwelling, state in HAVEN_DWLS do
if state == "откл" then
HAVEN_DWLS[dwelling] = "вкл"
SetObjectEnabled(dwelling, 1)
Trigger(4, dwelling, nil)
end
end
end
end
function BurnHavenDwelling(hero, hut)
if GetCurrentPlayer() == 1 then
QuestionBox ( "/Maps/SingleMissions/NewRandomMap 43/burn1.txt" , 'burnok("'..hut..'")' , 'burnno("'..hut..'")');
end
end
function burnok(hut)
Trigger(4, hut, nil)
hutt = hutt + 1
HAVEN_DWLS[hut] = nil
end
function burnno(hut)
SetObjectEnabled(hut, 1)
Trigger(4, hut, nil)
sleep(1)
MakeHeroInteractWithObject('Nymus' , hut)
sleep(1)
SetObjectEnabled(hut, nil)
Trigger(4, hut, "BurnHavenDwelling")
end