For some stuff I want to do I need the position of an entity when it is destroyed (aka it "died").
The actual underlying code is irrelevant at this point, my problem is that I cannot access the coordinates of the entity correctly.
Code: Select all
script.on_event(defines.events.on_entity_died, function(event)
game.print("something died!")
if event.entity.force.name == "enemy" then
game.print("it was a critter!")
game.print(event.entity.position)
end
end
)
But when the game should print the coordinates of the entity to me, I only get the y coordinate and some gibberish infront.
It looks like this:
"UnknownKey":-140.323764
I am 100% sure the number is the y coordinate, because it decreases accordingly if I pull the biters closer to 0,0 and kill them, but I have no clue where the x coordinate went. I've already looked through the API documentation, maybe I overlooked something?
Thanks in advance!