Page 1 of 1

Help understanding the "result_units" key of the spawner

Posted: Sat Sep 09, 2017 7:50 pm
by jhechtf
I'm working on a mod primarily for a friend of mine and myself. We want to have the ocassional "Godzilla Level" biter or spitter popup when a certain amount of enemies have been killed or a certain play time occurs in the game.

Problem is that I do not understand the unit spawner function. Also, when attempting to call "game.[literally anything]" inside that function it throws an error.

Any help in progressing my understanding on this one would be well appreciated.

Re: Help understanding the "result_units" key of the spawner

Posted: Thu Sep 14, 2017 2:03 am
by jhechtf
Bump. Any help?

If this doesn't work, then would it be possible to simply spawn the enemies somewhere? how would I go about placing the entity?

Re: Help understanding the "result_units" key of the spawner

Posted: Thu Sep 14, 2017 2:14 am
by Rseding91
It sounds like you don't understand how the basics of Factorio modding work at this point :)

This may help explain the different pieces of modding: http://lua-api.factorio.com/latest/Data-Lifecycle.html

Specifically you're trying to reference "game" in the prototypes stage of loading and there is no game at that point to reference.

Re: Help understanding the "result_units" key of the spawner

Posted: Thu Sep 14, 2017 10:54 am
by bobingabout
Download Bob's Enemies mod.

Take a look at my code, specifically for Spawners, and Leviathan biter/spitter.

This is likely the sort of thing you're after. They'll only appear with end game evolution factors (0.99+)