Page 1 of 1

player.force update bug when using custom force ?

Posted: Wed Mar 27, 2019 11:27 pm
by Gregzenegair
Hello,

I am currently modding the game, and I am playing with the player.force values as string.

When you set for the first time player.force = "force_1" it correctly sets the player's force from "player" to "force_1". The problem I noticed is when you want to update the force from "force_1" to "force_2" it does not work.

Could someone investigate on this ?

Re: player.force update bug when using custom force ?

Posted: Thu Mar 28, 2019 6:31 am
by Koub
[Koub] Moved to Modding help

Re: player.force update bug when using custom force ?

Posted: Thu Mar 28, 2019 7:25 am
by Gregzenegair
Hello,

Ok, I have found out the problem's origin. It is more a bug report than an ask for help, but well ...

So I noticed that if after calling player.set_controller({type = defines.controllers.ghost}) which detach the player's character, the call to player.force = "team_of_my_choice" won't work and won't change the player's team.

Somehow the player's character may hold a part of player's force data and you may not be able to change a player force without a character, still this his a strange behavior not documented.

Have a nice day.