antti wrote:Is there a specific reason why do you want to use destroy instead of setDoorState for example?
Destroying entities should be, in general, your last resort because it is more prone for all sorts of problems where the game might try to do something with an entity that just (possibly even during the same frame) ceased to exist. Basically when destroying entities you need to make sure that nothing (connectors, scripts or anything else) refers to them anymore.
function greedy()
hudPrint("Mimsy Frowns on the Greedy.")
hudPrint("But you shall have more than you ever imagined.")
playSound("goromorg_shield_hit")
playSound("goromorg_shield_break")
prison_secret_door_38:setDoorState("open")
prison_secret_door_39:setDoorState("open")
prison_secret_door_40:setDoorState("open")
prison_secret_door_41:setDoorState("open")
prison_secret_door_42:setDoorState("open")
prison_secret_door_43:setDoorState("open")
prison_secret_door_44:setDoorState("open")
prison_secret_door_45:setDoorState("open")
prison_secret_door_48:setDoorState("open")
prison_secret_door_49:setDoorState("open")
prison_secret_door_50:setDoorState("open")
prison_secret_door_51:setDoorState("open")
prison_secret_door_52:setDoorState("open")
end
function destroyer()
pressure_plate_hidden_48:destroy()
pressure_plate_hidden_47:destroy()
pressure_plate_hidden_46:destroy()
pressure_plate_hidden_45:destroy()
end
function protectionspell()
party:getChampion(1):setCondition("fire_shield", math.huge)
party:getChampion(2):setCondition("fire_shield", math.huge)
party:getChampion(3):setCondition("fire_shield", math.huge)
party:getChampion(4):setCondition("fire_shield", math.huge)
playSound("heal_party")
end
for your reference, destroyer() is triggered by the pressure plates it destroys.
protectionspell() is triggered by a wall button.
Why are you destroying the pressure plates? To prevent them from activating again? Use Activate Once for all of them, and include a check in the function to prevent the others from triggering:
greedyActivated = false
function greedy()
if greedyActivated == false then
greedyActivated = true
hudPrint("Mimsy Frowns on the Greedy.")
hudPrint("But you shall have more than you ever imagined.")
playSound("goromorg_shield_hit")
playSound("goromorg_shield_break")
prison_secret_door_38:setDoorState("open")
prison_secret_door_39:setDoorState("open")
prison_secret_door_40:setDoorState("open")
prison_secret_door_41:setDoorState("open")
prison_secret_door_42:setDoorState("open")
prison_secret_door_43:setDoorState("open")
prison_secret_door_44:setDoorState("open")
prison_secret_door_45:setDoorState("open")
prison_secret_door_48:setDoorState("open")
prison_secret_door_49:setDoorState("open")
prison_secret_door_50:setDoorState("open")
prison_secret_door_51:setDoorState("open")
prison_secret_door_52:setDoorState("open")
end
end
function destroyer()
pressure_plate_hidden_48:destroy()
pressure_plate_hidden_47:destroy()
pressure_plate_hidden_46:destroy()
pressure_plate_hidden_45:destroy()
end
function protectionspell()
party:getChampion(1):setCondition("fire_shield", math.huge)
party:getChampion(2):setCondition("fire_shield", math.huge)
party:getChampion(3):setCondition("fire_shield", math.huge)
party:getChampion(4):setCondition("fire_shield", math.huge)
playSound("heal_party")
end