Create Code:
Code: Select all
local function On_Built(event)
local entity = event.created_entity
--------- Battle Marker Built
if entity and entity.name == "battle_marker" then
writeDebug("Battle Marker Built")
local surface = event.created_entity.surface
local force = event.created_entity.force
local pos = event.created_entity.position
local dir = event.created_entity.direction
for i=1, 5000 do
surface.create_entity{name = "battle_marker_hidden", position = pos, force = force, direction = dir}
writeDebug("Hidden Marker built: " ..i)
end
end
end
Code: Select all
local function On_Remove(event)
--------- Remove Battle Marker
if (event.entity.name == "battle_marker") then
local surface = event.entity.surface
local pos = event.entity.position
for i=1, 5000 do
if surface.find_entity("battle_marker_hidden", pos) then
surface.find_entity("battle_marker_hidden", pos).destroy()
writeDebug("Hidden Marker Removed: " ..i)
else
writeDebug("Hidden Marker not found")
end
end
end
end
I can't figure out what I'm doing wrong to get the two positions to match.
Thanks.