• Drac346

Factorio .15 Server Customizations with LUA Commands


Note: The below commands will disable Achievements on the server.

I recently went about creating a Factorio server for the Failpire Community. In the game I wanted to achieve a few customizations. First, I wanted everyone to be able to have independent research trees for science. The goal is to allow each person to learn/discover/research at their own pace and to get some basic factorion skills along the way. As each person launched a rocket, I wanted the ability to join the team(s) together to create mega bases for continued science.

It took some hunting and teaching myself some LUA commands but I was able to create in game factions (called Forces) which act like teams in the game. Science is restricted per team which makes this a good solution for independent science. Additionally, I could merge two forces allowing me to meet the second objective.

In review.

Obj.1 – Independent Science for each person

Obj.2 – Merge Obj.1 scenarios together as each unit launches a rocket

Obj.3 – Custom starting locations for each person that is away from the default location

Obj.4 – Custom bind points per person at their base

Obj.5 – PvE Mode (between people)

Sol.1 – Create Forces in game for each person

Sol.2 – use LUA commands to merge forces (note, I don’t have this command listed since the server was unable to handle all of the mega bases we ended up with but the command does exist)

Sol.3 – Use teleport commands and map reveals to scout locations to identify bases. Then use teleport commands to move new players around as they join.

Sol.4 – Use LUA command to set bind points (I originally called this a success but I think the bind command was server wide and not player wide).

Sol.5 – Set peaceful mode between all of the player factions.

How to:

Factions (Sol.1 and Sol.5):

Let’s start with Obj.1 and Obj.5.

We need to first set the game biters to peaceful mode. This is a value that is configured on the biters as they spawn. Setting this before we go exploring the map will make it easier to explore to find those starting base locations.

In this example I’ll create 4 teams in total. There will be 3 custom factions for those that want to do science independently and a 4th faction (the default faction) for anyone who joins and wants to be on the shared science team. I’ll name the three factions f_player_name_# for the example but you can replace that with whatever name you want. I recommend keeping the “f_<name>” notation to keep factions easily separated for names used in later commands.

Now that the factions are created, we need to configure all of them to peaceful mode. This is painful to keep track of so I recommend writing this out in Notepad++ (no formatting). This value is one-for-one and it needs to be set each way. Start with the first force and set it to be peaceful with the other 3 (in the four Force scenario). Then continue to repeat for the other 3 forces.

The last step is to assign the player to the force. This only works once the player is logged into the game.

That completes the setup of the teams to isolate science to a per player basis (for 4 independent teams) and configures them to all be peaceful to each other.

How to:

General LUA Commands (Sol.3 and Sol.4):

Let’s start with Obj.3 and Obj.4.

The ability to meet the objectives of Req.3 and Req.4 are fairly simple and can be achieved with a single command. However, those commands use formatting that is more useful when combined with other commands. Instead of only linking the two commands necessary, I have a list of several useful commands that I picked up along the way.

Something to keep in mind as you read through these sections. LUA uses different formatting when you are talking about yourself as opposed to talking about someone else in the commands.

player = Me (the person entering the command

players[#] = is an array of all the players currently on the server, # is the currently player number in the array

Players[‘name’] = is the same as # in the array but you can also call the player by their ingame name.

As example of each use case of the above can be shown in the ‘print name’ command:

In the last example, you can see that LUA allows you to string commands together; separated with a semicolon. The command executed a FOR loop to print the name of everyone currently in the game. The order of the names will match their player number with the first name being player number 1 (not 0 as a traditional array).

It is also worth mentioning at the beginning of this section that you can set variables for use in LUA. In the example, person is a variable that is now set to the text after the equal sign. Anytime you need to enter game.players['player_name_1'] you can instead type person until you change the variable

Continuing with useful commands. We can get our current coordinates or the coordinates of someone else in the game. Don’t forget, you can replace [2] in the below example with [‘player_name’]

We can also teleport once you know the coordinates you want. This is useful to quickly travel the map. I found it most useful when scouting new base locations on a new map where I wanted to put the forces I created above. 0,0 is the starting location of the game.

Scouting for new bases is best enabled by revealing the map to prevent lengthy walking through trees. You can reveal the map in a square around an x and y coordinate (yourself, someone else, or provided grid). Furthermore, you can also have it refresh only revealed sections (like a radar) and you can have the map unrevealed. The unreveal does NOT unload the chunks from the server. Chunks are permanent once they are generated (which means bitters).

The game accepts a ‘peaceful mode’ command per player. I did not test this and I know biters store this value when they spawn. My suspicion is that this is global and not per force but it would need more testing. Do not forget to destroy all current in-game enemies (bitters) anytime you change the peaceful mode.

You can also create new patches of resources if you wanted to create custom starting locations. This works as a grid around a pair of coordinates; like previous commands.

When I was exploring for new bases, it was useful to reveal the map around 100 wide and then remove all the game generated enemies so those starting locations looked more like 0,0 (just with more resources).

This is how you set a spawn point. The command is pretty easy but I think this is server wide and not player wide. The LUA command accepts this on a per-player basis.

You can create a ‘ghost’ character that will allow you to run around the map (and through objects).

#Factorio #LUA

59 views

Recent Posts

See All

Site Migration 6/16/20

I'm migrating site content from my Azure MCV site to a new hosting platform. This is being performed so I can shift to a lower cost platform for basic web hosting while freeing up Azure resources for

Contact Drac

You can find Drac active on Discord at: http://discord.pas.team

©2020 by KrookedSkull