Skip to content
#2928
Auto-translated
AstralLein
Change the tiles for the dwarven dwellings. I did this in "A Price for Love."

It didn't work. I'm going back to the question:
how do I determine in my code that these are level 1 dwellings?
(Don't pay attention to the fact that these are elven structures)
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] = "off"
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 == "on" then
ELF_DWLS[dwelling] = "off"
SetObjectEnabled(dwelling, nil)
Trigger(4, dwelling, "TransformDwelling")
end
end
repeat
sleep()
until not IsPlayerCurrent(1)
for dwelling, state in ELF_DWLS do
if state == "off" then
ELF_DWLS[dwelling] = "on"
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
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения