Anvil altar for smashing things
Posted: Mon Oct 15, 2012 4:09 am
I made a script for an altar that you can put a gem on and then smash with a hammer to reveal a key.
I hope someone other than me will find it useful.
Uses the "waltar" found here, but it will work the same if you change the word "waltar" to "altar" or "Alcove, I just think it looks better this way. 
Also, if anyone knows how to make it "activate" only when you break something on it, as opposed to when you add something to or remove something from it, please tell me.
I hope someone other than me will find it useful.
Code: Select all
cloneObject{
name = "grimforge_anvil",
baseObject = "waltar", -- should work with any alcove or altar variant
onInsertItem = function (self, item)
if item.name == "ogre_hammer" then
for i in self:containedItems() do
if i.name == "blue_gem" then
playSound("impact_blunt")
playSound("lightning_bolt_hit")
playSound("level_up")
i:destroy()
self:addItem(spawn("gold_key"))
break
end
end
end
return item.name == "blue_gem" and self:getItemCount() == 0
end,
}Also, if anyone knows how to make it "activate" only when you break something on it, as opposed to when you add something to or remove something from it, please tell me.