Help understanding the "result_units" key of the spawner

Place to get help with not working mods / modding interface.
Post Reply
jhechtf
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Aug 25, 2017 4:16 am
Contact:

Help understanding the "result_units" key of the spawner

Post 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.

jhechtf
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Aug 25, 2017 4:16 am
Contact:

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

Post 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?

Rseding91
Factorio Staff
Factorio Staff
Posts: 13250
Joined: Wed Jun 11, 2014 5:23 am
Contact:

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

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

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

Post 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+)
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding help”