Create a new character

Place to get help with not working mods / modding interface.
Alkalyne
Inserter
Inserter
Posts: 25
Joined: Sun Jun 15, 2014 11:39 pm
Contact:

Create a new character

Post by Alkalyne »

Hello,

I'm using this tutorial (https://forums.factorio.com/forum/vie ... =53&t=6585) to set factorio on my dedicaced server.

So I ran this command :

Code: Select all

/c local char = game.players[1].character; game.players[1].character = nil; char.die()
So the dedicaced server does not play any "Characther" in the game.
And players can join, it works fine.

Player 1 : Nil => Server
Player 2 : Me
Player 3 : My Friend

But now, if I decide to save the game and download it on my PC when I try to use this save in singleplayer mode (or multiplayer mode but alone) I don't have any character on the screen since I'm using Player 1 (default) .

So my question is : Is there a way to change player in singleplayer mode or recreate a character for Player 1 ? using game.players[2].character; instead of game.players[1].character;

NOTE : if I use

Code: Select all

/c local char = game.players[2].character; game.players[1].character = char;
the screen move and inventory is updated with Player 2 inventory but I still don't have a character to play

I don't know if I'm clear
Alkalyne
Inserter
Inserter
Posts: 25
Joined: Sun Jun 15, 2014 11:39 pm
Contact:

Re: Create a new character

Post by Alkalyne »

After hours I just found the correct way to do it :

Code: Select all

/c game.players[1].character = game.createentity{name = "player", position = game.players[2].character.position, force = game.players[2].character.force}
(I'm using player 2 attributes it's simple]
Post Reply

Return to “Modding help”