Change entity's force

Place to get help with not working mods / modding interface.
Post Reply
drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Change entity's force

Post by drs9999 »

Is there a method or something else I can do to change the force a entity belongs to?

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: Change entity's force

Post by slpwnd »

No, the force is only readonly atm.

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Change entity's force

Post by drs9999 »

Thanks for the info.

Then see this as a suggestion for future updates ;)

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Change entity's force

Post by ficolas »

destroy and create it back

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Change entity's force

Post by drs9999 »

Exactly this is the problem.
It seems like that the entities which you spawn with create() belong to the neutral-force.

At first I thought that this is not a big problem, because you are able to interact with them.
But then I spawned a Lab next to some turrets that I built regularly. And the lab was destroyed instantly by the turrets.

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Change entity's force

Post by ficolas »

You need to specify the field "force" in the table you used to create the entity

drs9999
Filter Inserter
Filter Inserter
Posts: 831
Joined: Wed Mar 06, 2013 11:16 pm
Contact:

Re: Change entity's force

Post by drs9999 »

Not sure if I undestand..
Can you give me an example, please?

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Change entity's force

Post by ficolas »

Code: Select all

game.createentity{name="electric-turret", position={x=0, y=0}, force="enemy"} 
But im not sure so test it.

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: Change entity's force

Post by slpwnd »

You can't specify the force at the moment either :| It is in our issue list now.

ficolas
Smart Inserter
Smart Inserter
Posts: 1068
Joined: Sun Feb 24, 2013 10:24 am
Contact:

Re: Change entity's force

Post by ficolas »

Will it be available for 0.3? :)

Edit: yay im the first filter inserter :D

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: Change entity's force

Post by slpwnd »

ficolas wrote:Will it be available for 0.3? :)
Yes it will.

Post Reply

Return to “Modding help”