I was thinking of adding some Achievements to my mod for the number of biter types you killed.
The game already captures every name of biters killed, and displays that when you die or finish the game.
How can I read these values?
Ideally I'd like to sum the values of type of biter vs type and level.
In the log above there are 114 Fire biteres lvl 1 and 13 fire biters lvl 7. I'd like to just capture the value of 127 fire biters.
Could someone please help me in the correct direction here please?
Thanks.
[Done] Death Log Values
[Done] Death Log Values
Last edited by TheSAguy on Mon Dec 17, 2018 7:37 pm, edited 1 time in total.
Re: Death Log Values
https://lua-api.factorio.com/latest/Lua ... statistics on the force of the player. Input count should give you the kills if I am guessing correctly. Summing is just scripting once you have the values :P
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: Death Log Values
Could you possibly tell me how I access/read from this table?
I can't find any examples of how to do this.
Thanks.
I can't find any examples of how to do this.
Thanks.
Re: Death Log Values
This is from production score, but the statistic objects are the same:
Code: Select all
local production_statistics = game.player.item_production_statistics
local produced = production_statistics.input_counts
local consumed = production_statistics.output_counts
for name, value in pairs (consumed) do
if produced[name] then
produced[name] = produced[name] - value
else
produced[name] = -value
end
end
return produced
Re: Death Log Values
Thanks guys, I found one more example. I'll be able to figure it out now.
Thanks again!!
Code: Select all
for entity_name, kill_count in pairs(player.force.kill_count_statistics.input_counts) do
if is_biter(entity_name) then
biter_count = biter_count + kill_count
elseif is_spawner(entity_name) then
spawner_count = spawner_count + kill_count
else
other_count = other_count + kill_count
end
end