Custom Scenario No Spawning

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
Quxzcover
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Oct 29, 2015 3:29 am
Contact:

Custom Scenario No Spawning

Post 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.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: Custom Scenario No Spawning

Post 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}
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

Quxzcover
Burner Inserter
Burner Inserter
Posts: 8
Joined: Thu Oct 29, 2015 3:29 am
Contact:

Re: Custom Scenario No Spawning

Post 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.

Hans Felix
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Mar 27, 2016 7:35 pm
Contact:

Re: Custom Scenario No Spawning

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

Marc90
Inserter
Inserter
Posts: 39
Joined: Wed Oct 07, 2015 5:42 pm
Contact:

Re: Custom Scenario No Spawning

Post 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

Post Reply

Return to “Gameplay Help”