Форум HeroesWorld-а - Показать сообщение отдельно - Скрипты
Тема: Скрипты
Показать сообщение отдельно
#2872
Старый 18.01.2019, 20:56
  #2872
^
AlekseyS
📖
Регистрация: 02.04.2018
Адрес: Минск
Сообщения: 203
Регистрация: 02.04.2018
Адрес: Минск
Сообщения: 203
По умолчанию
Re: Скрипты

AstralLeinСмени тайлы гномьим двеллингам. Я так делал в Плате за любовь.

Не получилось. Возвращаюсь к вопросу:
как определить в моем коде, что это двелы 1 уровня?
(Не обращайте внимание, что тут эльфийские строения)

	function dwellings()
for i, dw_type in {"FAIRIE_TREE", "WOOD_GUARD_QUARTERS", "HIGH_CABINS", "PRESERVE_MILITARY_POST"} do
for j, dw in GetObjectNamesByType(dw_type) do
ELF_DWLS[dw] = "откл"
SetObjectEnabled(dw, nil)
Trigger(4, dw, "TransformDwelling")
end
end
startThread(dwellings2)
end


startThread(dwellings)

function dwellings2()
while 1 do
repeat
sleep()
until IsPlayerCurrent(1)
for dwelling, state in ELF_DWLS do
if state == "вкл" then
ELF_DWLS[dwelling] = "откл"
SetObjectEnabled(dwelling, nil)
Trigger(4, dwelling, "TransformDwelling")
end
end
repeat
sleep()
until not IsPlayerCurrent(1)
for dwelling, state in ELF_DWLS do
if state == "откл" then
ELF_DWLS[dwelling] = "вкл"
SetObjectEnabled(dwelling, 1)
Trigger(4, dwelling, nil)
end
end
end
end


function TransformDwelling(hero, hut)
if GetCurrentPlayer() == 1 then
QuestionBox (path.."transformd.txt" , 'transformnok("'..hut..'")' );
end
end

function transformnok(hut)
if not (GetPlayerResource(1, CRYSTAL) >= 15 and GetPlayerResource(1,GEM) >= 10) then
ShowFlyingSign(path.."nores.txt",hut,-1,10)
return
end
SetPlayerResource(1,CRYSTAL, (GetPlayerResource(1,CRYSTAL) - 15))
SetPlayerResource(1,GEM, (GetPlayerResource(1,GEM) - 10))
PlayVisualEffect('/Effects/_(Effect)/Spells/Bless.xdb#xpointer(/Effect)', hut)
sleep(5)
Trigger(4, hut, nil)
ELF_DWLS[hut] = nil
ReplaceDwelling(hut,TOWN_HEAVEN)
sleep(1)
SetObjectOwner(hut,1)
SetObjectEnabled(hut,true)
sleep(1)
return function()
end
end
AlekseyS вне форума
Ответить с цитированием