First:
how can I destroy a pressure_plate with a item placed on it, then spawn (on the same place) a new item and the same pressure plate?
I got the code, for alcove or altar. But it makes me an error if I change the decoration type by a pressure plate
It has to simulate a forge, when placing some raw material, it transforms it into another material, with a fire emitter for simulating flame.
The flames of the fire emitter are not really high, and the altar is more tall than the flames. It works fine, but it's not very realistic.
So that's the point to have something lower like a pressure plate.
SpoilerShow
Code: Select all
function checkAlcoveForItems()
-- Offer
local itemName = "raw_adamantite"
-- offer alcove
local altarID = afor02
-- checks if the offer alcove has an item
if altarID:getItemCount() == 0 then
hudPrint("You have to put a small piece of material in the altar!")
end
-- checks if the offer is equal to the item you want
for i in altarID:containedItems() do
if i.name == itemName then
hudPrint("The raw material is now enriched!")
removeItem()
spawn("fireburst", 20, 5, 15, 2)
spawn("deep_temple_altar", 20, 5, 15, 2, "afor02")
playSound("Volcano")
afor02:addItem(spawn("adamantite_enriched"))
else
hudPrint("Place a small piece of raw material in the altar.")
end
end
end
function removeItem()
if findEntity("afor02") ~= nil then
for i in afor02:containedItems() do
i:destroy()
end
afor02:destroy()
end
endis it possible to modify the script, and avoid a editor error if I put 2 or more required items on the altar?
if I use the actual script, and place 2 same items (like raw_adamantite) on the altar, the editor stop pre visualizing and I got an error "bad_object"
well I can put a text, "do not place 2 items at the same time", but if the player didn't follow this rules, He may certainly have a game crash.