Scenario... Using an altar that has custom item already added (power_ore_1), I then activate a particle effect (lightning_ore_1) when the custom object is present and deactivate particle effect when the item is removed. Initial state is the item is already on the altar (using add new item) with particle effect active.
The initial state works, but when the item is removed, the particle effect remains or I can place any item on the altar (torch) and the particle effect activates. I can switch the particle effect off with a connector, but the script should be able to interpret the custom item. I've also tried different altar states (always active, event activate/deactivate/any, etc.)
I also intend to add sound as well, but haven't gotten that far yet. I'm assuming I can just add "playSound ()" after "if itemFound then" and after "else"
Here's the code:
Code: Select all
function oreCheckno()
local itemFound = true
for i in checkOre1:containedItems() do
if i.name == "power_ore_1" then
itemFound = true
end
end
if itemFound then
lightning_ore_1:activate()
else
lightning_ore_1:deactivate()
end
end