reinitialise a scrip when used
Posted: Fri Aug 02, 2013 5:19 pm
Halli, hallo,
well another problem (linked to the spawn/destroy item post" viewtopic.php?f=14&t=5597
How can I re-initialize the following script to use it again?
actually, when I put 2 specific items on the altar it spawns another item, destroy the 2 specific items, and that's all (used to forge a particular armor).
But it can't be used more, what's a pity!
I ve tried many things, but I think I'm not god enough to script this
can anyone help me please?
well another problem (linked to the spawn/destroy item post" viewtopic.php?f=14&t=5597
How can I re-initialize the following script to use it again?
actually, when I put 2 specific items on the altar it spawns another item, destroy the 2 specific items, and that's all (used to forge a particular armor).
But it can't be used more, what's a pity!
I ve tried many things, but I think I'm not god enough to script this
can anyone help me please?
SpoilerShow
Code: Select all
function check()
local valid = {"adamantite_enriched", "adamantite_enriched"}
local counter = 0
for i in afor05:containedItems() do
local ok = false
for j = 1,#valid do
if i.name == valid[j] then
counter = counter + 1
ok = true
break
end
end
if not ok then
counter = -1
break
end
end
-- print(counter)
if counter == 2 then
if findEntity("afor05") ~= nil then
for i in afor05:containedItems() do
i:destroy()
end
afor05:destroy()
spawn("deep_temple_altar", 20, 2, 16, 1, "afor05")
playSound("Volcano")
spawn("fireburst", 20, 2, 16, 1)
spawn("shockburst", 20, 2, 16, 1)
afor05:addItem(spawn("adamantite_cuirass"))
playSound("discover_spell")
hudPrint("You have forged a cuirass!")
hudPrint("But the forge seems to be damaged now!")
end
end
end