[0.13.19] Forces command not working

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
silverlava
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Sep 14, 2016 10:34 pm
Contact:

[0.13.19] Forces command not working

Post by silverlava »

I'm trying to use force commands so my friends and I can do a PvP game.
The Multiplayer wiki page has a list of force commands that you can use to do this.
https://wiki.factorio.com/index.php?tit ... yer#Forces

I was able to run the first command and create a force with no problem, but can't figure out how to add players to the force.
The command I'm using in game: (I did call the force "force 1", and my name is set to "silverlava" in the options menu)
/c game.get_player('silverlava').force = game.forces['force 1']

This is the error it returns when I press enter:
Cannot execute command. Error: LuaGameScripts doesn't contain key get_player. stack traceback: [string "(the command I used)"]:1: in main chunk

This happened both in singleplayer and multiplayer.
I'm not quite sure what the error means, but my best guess is the command has changed from get_player to something else, and the wiki wasn't updated. Does anyone if there's a different command, or if not what I'm doing wrong?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: [0.13.19] Forces command not working

Post by DaveMcW »

/c game.players['silverlava'].force = game.forces['force 1']

silverlava
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Sep 14, 2016 10:34 pm
Contact:

Re: [0.13.19] Forces command not working

Post by silverlava »

DaveMcW wrote:/c game.players['silverlava'].force = game.forces['force 1']
Thank you! This command worked.

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.13.19] Forces command not working

Post by posila »

Hi, just a note: up-to-date documentation to Factorio API is here: http://lua-api.factorio.com/

Post Reply

Return to “Technical Help”