Page 1 of 1

How to place enemy units?

Posted: Tue Jan 17, 2017 1:28 am
by Dobudakter
i want to place Units in game, like Biters. Wrote a mod for this, but they are friendly. Want them to be enemies. But how? Cant get it.

Re: How to place enemy units?

Posted: Tue Jan 17, 2017 10:55 am
by Adil
How did you even do that? By default created entities belong to "enemy" force.
Among the parameters to create-entity there is an argument "force", you can specify it.

http://lua-api.factorio.com/0.14.21/Lua ... ate_entity

Re: How to place enemy units?

Posted: Tue Jan 17, 2017 1:34 pm
by Dobudakter
I just used "place_result = unit[name]" in the "type = item". Yes, easy. Too easy.
And the "force = enemy" placed in the "type = unit", does nothing.
So, think you re right, i have to use more lua code. But i hoped for a more easy way.

Re: How to place enemy units?

Posted: Tue Jan 17, 2017 7:39 pm
by Dobudakter
i just want to spawn some enemies around me or somewhere, at begin of a game, just to see how it works. What do i have to do?

spawn_enemy(name, surf, pos)

ok, that sounds good, but how can i set the "pos", and what want that "surf"?