Page 1 of 1
[Done] Death Log Values
Posted: Mon Dec 17, 2018 5:44 pm
by TheSAguy
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.
Re: Death Log Values
Posted: Mon Dec 17, 2018 5:51 pm
by Bilka
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
Re: Death Log Values
Posted: Mon Dec 17, 2018 7:31 pm
by TheSAguy
Could you possibly tell me how I access/read from this table?
I can't find any examples of how to do this.
Thanks.
Re: Death Log Values
Posted: Mon Dec 17, 2018 7:34 pm
by Klonan
TheSAguy wrote: Mon Dec 17, 2018 7:31 pm
Could you possibly tell me how I access/read from this table?
I can't find any examples of how to do this.
Thanks.
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
Posted: Mon Dec 17, 2018 7:37 pm
by TheSAguy
Thanks guys, I found one more example. I'll be able to figure it out now.
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
Thanks again!!