How to place enemy units?

Place to get help with not working mods / modding interface.
Dobudakter
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jan 17, 2017 1:18 am
Contact:

How to place enemy units?

Post 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.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: How to place enemy units?

Post 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
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Dobudakter
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jan 17, 2017 1:18 am
Contact:

Re: How to place enemy units?

Post 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.
Dobudakter
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Jan 17, 2017 1:18 am
Contact:

Re: How to place enemy units?

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

Return to “Modding help”