Try this on for size:
Code: Select all
function extinguishWallTorches(torchHolders)
for i = 1, #torchHolders do
if torchHolders[i].name == "torch_holder" then
local id, level, x, y, facing = torchHolders[i].id, torchHolders[i].level, torchHolders[i].x, torchHolders[i].y, torchHolders[i].facing
print(id, x, y, facing)
torchHolders[i]:destroy()
spawn("torch_holder", level, x, y, facing, id)
end
end
end
Pass a table of torch holders (by id) to the function and it should destroy then recreate the torch holders in the same locations with the same ids as they originally had, effectively extinguishing the wall torches without destroying them or eliminating their fuel. This will help if you have other scripts which might reference a given torch holder by id.
Example usage:
Code: Select all
function pressurePlateTriggered()
local torchHolders = {torch_holder_1, torch_holder_2, torch_holder_3,}
script_entity_1.extinguishWallTorches(torchHolders)
end
To truly surprise a player and throw them into complete darkness, you can use the extinguishWallTorches function above in conjunction with the douse torches function by Lmaoboat found here:
viewtopic.php?p=37513#p37513
Hope this helps!
Working on a dungeon that displays a massive collection of assets while sorting them into convenient reusable plugin format (concept from some of leki's mods). Will contribute some of my own models as well eventually and follow that with custom dungeon.