Page 1 of 1

using modifier values in a mod

Posted: Wed Jul 25, 2018 11:52 am
by Cordina
I have been looking on the internet and forum, but couldn't find a solution for my problem.
For a mod I'm working on, I need to get te value of a modifier used in the base game.
I don't have to use it on a new entity, I just need to read the value (i.e. the bonus given in the mining-drill-productivity-bonus).
Can anyone tell me how to read this value to be usable in the mod?

Re: using modifier values in a mod

Posted: Wed Jul 25, 2018 2:50 pm
by eradicator
LuaForce.mining_drill_productivity_bonus
https://lua-api.factorio.com/latest/LuaForce.html

Re: using modifier values in a mod

Posted: Fri Jul 27, 2018 8:27 am
by Cordina
eradicator wrote:LuaForce.mining_drill_productivity_bonus
https://lua-api.factorio.com/latest/LuaForce.html
Just tried this one, but it doesn't seem to work.
The game throws an error: "attempt to index global 'LuaForce' (a nil value)"
So how can I read the value of the modifier to make use of it?

Re: using modifier values in a mod

Posted: Fri Jul 27, 2018 10:28 am
by eradicator
A "LuaForce" is what factorio internally calls a team. Technology is per team, so if you want to read that you'll have to know what team you want to read it for. If you're having problems with that you should post some code and describe what you're trying to do instead of what you think the solution is.