Skip to content
User Avatar
#1707
Auto-translated
Damn, the script isn't working.
function burn()
----
for i, hut in GetObjectNamesByType('PEASANT_HUT') do
Trigger(4, hut, 'hutF')
end
-----
startThread(burn2)
end

startThread(burn)

---

fires = 0

function burn2(hero, hut)
while 1 do
sleep(1)
if GetCurrentPlayer() == 1 and fires == 0 then
SetObjectEnabled(hut , nil)
fires = 1
elseif GetCurrentPlayer() == 2 or GetCurrentPlayer() == 3 or GetCurrentPlayer() == 4 then
SetObjectEnabled(hut , true)
fires = 0
end
end
end

----

hutt = 0

----

fire2 = 0

function hutF(hero, hut)
if GetCurrentPlayer() == 1 and fire2 == 0 then
sleep(1)
QuestionBox ( "/Maps/SingleMissions/NewRandomMap 43/burn1.txt" , 'burnok' , 'burnno');
sleep(1)
end
end

function burnok(hero, hut)
sleep(1)
BlockGame()
--burn hut effects
hutt = hutt + 1
Trigger(4, hut, nil)
UnblockGame()
end

function burnno(hero, hut)
sleep(1)
fire2 = 1
SetObjectEnabled(hut, true)
sleep(1)
MakeHeroInteractWithObject('Nymus' , hut)
sleep(1)
SetObjectEnabled(hut, nil)
fire2 = 0
end


Basically, what I'm most interested in is how to make the script read the name of the hut and use it in other functions. If I write it in parentheses after the function name, it somehow doesn't work.
You can ignore the variables; there aren't any functions that use them yet.
I tried using GameVar to output the hut, but it doesn't read it.
And when I put it in quotes, it stops recognizing the object altogether

Whatever