Page 1 of 1

Custom Scenario No Spawning

Posted: Sun Jan 24, 2016 7:43 am
by Quxzcover
Whenever i load up a Custom Scenario i have made, it starts me in god mode. i have not found a way to be able to play me scenarios as a player.
I remember in really old versios you could literally just place a character to play as.
In some of the newer versions, but still a while ago, you could put in lua code "/c game.players[1].character = game.createentity({name="player", position = {0,0}, force = game.forces.player})" to be able to spawn yourself in. but whenever i use it now it says theres no such thing as "createentity", so i put "create_entity" and it still wont work. if there's any other way to fix the lua code please comment.
Neither of those options exist any more. is there anyway to spawn a player any more? or is there only god mode, because that defeats the purpose completely.

Re: Custom Scenario No Spawning

Posted: Sun Jan 24, 2016 9:58 am
by prg
Since support for different surfaces was added you now need to run something like

Code: Select all

/c game.local_player.character = game.local_player.surface.create_entity{name="player", position = {0,0}, force = game.forces.player}

Re: Custom Scenario No Spawning

Posted: Sun Jan 24, 2016 7:10 pm
by Quxzcover
Thanks or the code, ill start playing right away, but i still dont get why you have to use code to spawn in. why dont they just reintroduce the "player" entity while creating a map or something. it just creates hassle for the player.

Re: Custom Scenario No Spawning

Posted: Sun Mar 27, 2016 7:38 pm
by Hans Felix
Ok I used this code to test out what it does, but it spawned me a new character, anyway to switch back to my old one and delete the new one?

Re: Custom Scenario No Spawning

Posted: Tue Jun 14, 2016 8:24 pm
by Marc90
Hans Felix wrote:Ok I used this code to test out what it does, but it spawned me a new character, anyway to switch back to my old one and delete the new one?
First you have to enter god mode again:

Code: Select all

/c game.local_player.character = nil
Then you hover your mouse over the new character you want to delete and type in:
(Make sure you don't have anything left in the inventory, it will be lost!)

Code: Select all

/c game.local_player.selected.destroy()
And finally you hover your mouse over the old character and type in:
(Also make sure you don't have anything left in the god-mode inventory, it will also be lost!)

Code: Select all

/c game.local_player.character = game.local_player.selected