Adding detailed info to PvP multiplay commands:

Anything related to the content on our wiki (https://wiki.factorio.com/)

Moderator: Bilka

Post Reply
BasKoning
Manual Inserter
Manual Inserter
Posts: 2
Joined: Thu Mar 31, 2016 8:41 pm
Contact:

Adding detailed info to PvP multiplay commands:

Post by BasKoning »

I would like to see the following information added to the PvP commands on the wiki at https://wiki.factorio.com/index.php?tit ... player#PvP :

Prerequisites:
- To play over the internet the server has to open router port 34197 and check 'Use P2P communications' while starting the server.
- Default is co-op mode. To play PvP properly you have to first allow to use console commands to set it up, while starting the server.
- To open the console, by default, type: ~ (check your options->controls->game->'Toggle LUA-Console' to inspect and set the console key if needed)

Preparation:
Create two (or more) forces, give them any name you like, for example:

Code: Select all

/c game.create_force('Force_1')
/c game.create_force('Force_2')
Set ceasefire to true or false as desired:

Code: Select all

/c game.forces['Force_1'].set_cease_fire('Force_2', false)
/c game.forces['Force_2'].set_cease_fire('Force_1', false)
This is ONE commandline, that will destroy al enemy bases within large area:

Code: Select all

/c local surface = game.local_player.surface
   for c in surface.get_chunks() do
       for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, force= "enemy"})) do
           entity.destroy()
       end
   end
Check large portion of the map (can take a while) to find a good second spot:

Code: Select all

/c game.local_player.force.chart(game.local_player.surface,{lefttop = {x = -1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})
Teleport to some good start position for the second force
teleport({X,Y}) uses x as horizontal, left is negative values, right is positive values
and uses y as vertical, top is negative values, bottom is positive values
For example, topleft corner of the now visible map is (-1000,-1000)
Just estimate a good second position from the map: for example: -400, 200

Code: Select all

/c game.get_player('YOUR_PLAYER_NAME').teleport({-400, 200})
If it is a good start position for the second force, lock that in as spawnpoint, for example: -400, 200

Code: Select all

/c game.forces['Force_2'].set_spawn_position({-400, 200}, game.get_surface(1))
Set RGB-Alfa color for your player on the map (alfa=transparancy):

Code: Select all

/c game.get_player('YOUR_PLAYER_NAME').color = {r=0.52, g=0.61, b=0.15, a=0.8} 

Do the command to clear enemy's from the second force location once more, to clear away an even patch of land for expansion for both players.

SAVE this game

When your friend connects:
Note: When connecting to the server, you only need to give the IP number, no port number is needed

Do these commands:

Set his color:

Code: Select all

/c game.get_player('FRIENDS_NAME').color = {r=0.22, g=0.99, b=0.99, a=0.8}
Show him his expansion area:

Code: Select all

/c game.get_player('FRIENDS_NAME').force.chart(game.get_player('FRIENDS_NAME').surface,{lefttop = {x =-1024, y = -1024}, rightbottom = {x = 1024, y = 1024}})
When all is agreed, start the game by assigning forces:

Code: Select all

/c game.get_player('FRIENDS_NAME').force = game.forces['Force_1']
/c game.get_player('YOUR_PLAYER_NAME').force = game.forces['Force_2']
This will reset each players map to a small patch. Critters will come after a while from outside and settle in the empty space.
SAVE the game, and to prevent cheating: quit, start again and load, but this time without allowing commands

Let your friend reconnect, and start playing PvP!

Post Reply

Return to “Wiki Talk”