IntroductionThis is the first part of my series of guides on modding LiF:YO dedicated servers. In these guides it is assumed the reader has basic computer skills and knows for example how to modify data in a SQL database.
On server<->client communicationAlmost all PM's I receive with modding questions begin with "I changed X in the server database/XML files but it makes no difference in the game!", so let my address this mystery first.
The core problem here is a wrong perspective on the communication between the clients and the server. Most people seem to assume that the server determines for example the capacity of a Warehouse, and that the server sends this information to the client, which displays it to the player. This is not the case, because it would increase the server load needlessly. Every client connecting to the server would need to receive all this game data, every time the client reconnects.
Instead, game data like the capacity of warehouse is configured both on the client and the server. The client simply uses it's local data to display a value like the Warehouse capacity to the player, and will also refuse a deposit if it would exceed it's (client-side) capacity. The server doesn't even come into play (yet). This is the reason why your server-side changes didn't seem to work.
The server
does come into play when the client accepts the deposit. The deposit is send to the server, which also checks if the deposit does not exceed the Warehouse capacity on the server side. If it passes, the deposit takes effect, if not, the server replies to the client that it was denied after all.
So in the end, the server has the final say on pretty much everything, but very often the client has the first say. It works like this to minimize the data transfer between the server and the clients, since that is
the bottleneck on scalability of networked multiplayer games.
This means that a lot of modifications need to be done both server and client side in order to work properly. A notable exception is damage values for weapons/armour and damage calculations. If you think about it with the above in mind, it should become pretty obvious why client-side damage values and calculations would be useless. Another exception is Claim time values.
On the patch.sql fileIn the server files there is the file sql/patch.sql. This file contains SQL queries for the official patches. The patch.sql file is executed every time your server is restarted, and may revert your mod's changes, for example Claim times.
In my experience this patch.sql file only needs to be run once after every patch, and can then be deleted. It is remade after every official patch. You could also edit patch.sql file to edit out the conflicting patch changes if you don't feel comfortable with deleting the entire file.
How to'sIn this part we'll discuss the easiest of modifications, namely the ones that only require adjustments in database tables and in XML files. All relevant XML files can be found in the Data directory, on both the server and the client.
How to adjust container capacity and what types of objects can be stored in a container
Spoiler
Both the table objects_types and the client-side objects_types.xml file need to be modified for this to work.
Adjust MaxContSize to adjust how much "weight" can be stored inside the container.
To change the objects that can be stored in a container, you need to adjust the Length of the container (or in some cases the Length of the object to be stored). Every object has a Length, if the Length of the object to be stored is higher than the Length of the container, the game will refuse the deposit.
How to adjust an object's Claim time
Spoiler
This is a server-side modification.
Adjust the 'Owner Timeout' column in the objects_types table. A NULL value means there is no Claim time. The values are in seconds.
How to make an unclaimable object claimable
Spoiler
First give the object a Claim time as described in the how-to above.
On both server and client, edit skill_types.xml and fine the line:
- Code: Select all
<ability lvl="0" name="Claim/Unclaim" id="177">
Under it you'll find the line that starts with:
- Code: Select all
<ent_req type="object_type_id">
Followed with a sequence of objects_type ID's. Find the objects_types ID (either in the database table or objects_types.xml) of the object you want to make claimable, and insert it into the sequence.
How to adjust an object's weight
Spoiler
In the objects_types table and the client side objects_types.XML file, adjust the UnitWeight.
How to allow a building to be set as a Home
Spoiler
In the objects_types table, adjust MaxStackSize to set the amount of players that can have the building as a home at the same time. Naturally, a minimum value of 1 is required for this to work.
On both server and client, edit skill_types.xml and fine the line:
- Code: Select all
<ability lvl="0" name="Set as My Home" id="145">
Under it you'll find the line that starts with:
- Code: Select all
<ent_req type="object_type_id">
Followed with a sequence of objects_type ID's. Find the objects_types ID (either in the database table or objects_types.xml) of the object you want to function as a home, and insert it into the sequence.
How to adjust Skill experience gain when using abilities
Spoiler
Open skill_types.xml (most likely only server side) and fine the line with:
- Code: Select all
<ability_skill_mult>
Under the ability that you want to modify. The value that follows is your Skill experience gain multiplier.
How to change the welcome message on login
Spoiler
This is a client-side modification. Open cm_messages.xml and change <string id="688">
How to change armour protection values
Spoiler
Open cm_equipTypes.xml on the server. For every piece of armour you will see something like this, where the values are damage reduction multipliers:
- Code: Select all
<multiplier type="slash" value="0.53" />
<multiplier type="pierce" value="0.35" />
<multiplier type="blunt" value="0.27" />
The values are base protection values, and in-game the Quality level of the equipment serves as a percentile increase of the base value. So a piece of armour of Quality 100 doubles the damage reduction multipliers. At Quality 100 a base value of 0.50 will provide full immunity from the corresponding damage type, since the effective value would be 1.00
How to change recipes and their requirements
Spoiler
In the database, the table recipe and recipe_requirements are relevant, and on the client-side, recipe.xml and recipe_requirements.xml.
From recipe.xml:
- Code: Select all
<ID>313</ID>
<Name>Claymore</Name>
<Description></Description>
<StartingToolsID>453</StartingToolsID>
<SkillTypeID>4</SkillTypeID>
<SkillLvl>30</SkillLvl>
<ResultObjectTypeID>575</ResultObjectTypeID>
<CreatingDuration>5</CreatingDuration>
<SkillDepends>30</SkillDepends>
<Quantity>1</Quantity>
313 is the unique ID of this recipe, it's requirements will all refer to this ID.
StartingToolsID refers to the objects_types ID of the starting tools, in this case the Forge and Anvil.
SkillTypeID refers to the Skill ID found in the skills table or skill_types.xml, in this case Forging.
SkillLvl is the minimum still required.
ResultObjectTypeID refers to the actual Claymore object produced by this recipe.
SkillDepends is the influence of the Forging Skill level on the Quality of the resulting Claymore.
Quantity is the amount of Claymores produced per execution of this recipe.
Recipe_requirements should be obvious, the RecipeID refers to the ID of the actual recipe the requirement is part of. The tables and the XML files contain the same information, so with the above example it should all be obvious.
How to reconfigure Skill lines
Spoiler
Note: I highly recommend doing this only for new servers that have no playing characters on them. Delete your test/dev characters every time after you make this kind of changes.
In the skill_type table and skill_types.xml (I recommend changing the XML both server and client side, not only client side), every skill has a Parent and a Group.
Skills with Parent 0 are either independent skills or the first Skill of a Skill line. By changing the value you can reconfigure the lines, a Skill will be placed to the right of it's Parent Skill. I recommend sticking to the vanilla amount of skill-lines and independent skills, or else it will look messed up in the user interface.
The Group value determines whether the Skill belongs to the Crafting, Combat or Minor skills.
Final wordsFeel free to make requests, although in this part I'll only handle XML-files and database changes. If you can think of your own how-to's, you can post them here and I'll add them to the OP with credits.