certif Posted October 14, 2024 Share Posted October 14, 2024 I'd like to make the lightning rod remove everything with the "heart" tag in a 1 tile radius around it whenever it is struck by lightning. If I knew how to remove stuff with a certain tag in a radius, I think I could make it work. Thanks for reading lightningrod.lua Link to comment https://forums.kleientertainment.com/forums/topic/160209-making-the-lightning-rod-remove-everything-with-a-certain-tag-in-a-radius-around-itself-when-struck/ Share on other sites More sharing options...
Glommer2 Posted October 29, 2024 Share Posted October 29, 2024 --can be sth like this local function removeheartinrange(inst) local x2, y2, z2 = inst.Transform:GetWorldPosition() local range = 4 --a tile is 4 wall grid local ents = TheSim:FindEntities(x2, y2, z2, range, { "heart" }, nil) for i, ent in ipairs(ents) do ent:Remove() end end AddPrefabPostInit("lightningrod",function(inst) if not GLOBAL.TheWorld.ismastersim then return inst end inst:ListenForEvent("lightningstrike", removeheartinrange) end ) Link to comment https://forums.kleientertainment.com/forums/topic/160209-making-the-lightning-rod-remove-everything-with-a-certain-tag-in-a-radius-around-itself-when-struck/#findComment-1755180 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now