Difference between revisions of "Quick Stat Tweaks"

From Zero-K
Jump to navigation Jump to search
Line 14: Line 14:
 
* Check infolog.txt in your install directory and fix your syntax errors.
 
* Check infolog.txt in your install directory and fix your syntax errors.
  
Check out the [https://springrts.com/wiki/Gamedev:UnitDefs unit def] and [https://springrts.com/wiki/Gamedev:WeaponDefs weapon def] pages on the SpringRTS wiki for definitions of many of the parameters.
+
Check out the [https://springrts.com/wiki/Gamedev:UnitDefs unit def] and [https://springrts.com/wiki/Gamedev:WeaponDefs weapon def] pages on the SpringRTS wiki for definitions of many of the parameters. Search the internet for tutorials on lua tables.
  
 
== Example ==
 
== Example ==
 +
Lets say we want to make Glaive healthier and faster. Start with an empty lua table.
 +
<nowiki>{
 +
}</nowiki>
 +
A search through the [https://github.com/ZeroK-RTS/Zero-K/blob/master/units unitdef repository] reveals that Glaive is known as cloakraid internally. [https://github.com/ZeroK-RTS/Zero-K/blob/master/units/cloakraid.lua This] is the file. Add an empty table with key 'cloakraid'.
 +
<nowiki>{
 +
    cloakraid = {},
 +
}</nowiki>
 +
The [https://springrts.com/wiki/Gamedev:UnitDefs SpringRTS wiki page on unitdefs] says that a unit's health is 'maxDamage' and its speed is 'maxVelocity'. [https://github.com/ZeroK-RTS/Zero-K/blob/master/units/cloakraid.lua The Glaive file] shows us the current value of these parameters, as well as their position in the structure of a unitdef. We can change these values like so:
 +
<nowiki>{
 +
    cloakraid = {
 +
        maxDamage = 500,
 +
        maxVelocity = 8,
 +
    },
 +
}</nowiki>
 +
Copy this text into a [base 64 encoder http://www.example.com] and click encode. Here is the resulting encoding.
 +
ewogICAgY2xvYWtyYWlkID0gewogICAgICAgIG1heERhbWFnZSA9IDUwMCwKICAgICAgICBtYXhWZWxvY2l0eSA9IDgsCiAgICB9LAp9
 +
Set the Tweak Units modoption to your encoding and start the game. Your infolog should indicate that the modoption loaded successfully.
 +
<nowiki>[f=-000001] Loading UnitDefs_posts
 +
[f=-000001] Loading tweakunits modoption
 +
[f=-000001] Loading tweakunits for cloakraid
 +
[f=-000001] Loading FeatureDefs_posts
 +
[f=-000001] Loading WeaponDefs_posts
 +
[f=-000001] Loading ArmorDefs_posts</nowiki>

Revision as of 22:38, 12 November 2019

The Tweak Units modoption can be used to modify many unit and weapon parameters. It can be used for rapidly testing balance changes or just for making a quick game mode. It has limitations and should not be used for large mod projects, see Mod Creation to get started on full modding.

Tweakunitswindow.jpg

Workflow

The Tweak Units modoption overwrites unit paramers (called unitDefs) as they are loaded. The modoption requires a base64 encoded lua array of differences. Here is how to use it.

  • Make a lua table in an empty file.
  • For each unit you wish to modify, add an empty table indexed by the internal name of the unit to your table.
  • Search for the units you wish to modify in the Zero-K repository.
  • Copy the parameters you wish to modify into the table, maintaining the structure of the unitDef table.
  • Base 64 encode your table.
  • Put the base 64 encoding of your table into the Tweak Units modoption.
  • Start the game.
  • Check infolog.txt in your install directory and fix your syntax errors.

Check out the unit def and weapon def pages on the SpringRTS wiki for definitions of many of the parameters. Search the internet for tutorials on lua tables.

Example

Lets say we want to make Glaive healthier and faster. Start with an empty lua table.

{
}

A search through the unitdef repository reveals that Glaive is known as cloakraid internally. This is the file. Add an empty table with key 'cloakraid'.

{
    cloakraid = {},
}

The SpringRTS wiki page on unitdefs says that a unit's health is 'maxDamage' and its speed is 'maxVelocity'. The Glaive file shows us the current value of these parameters, as well as their position in the structure of a unitdef. We can change these values like so:

{
    cloakraid = {
        maxDamage = 500,
        maxVelocity = 8,
    },
}

Copy this text into a [base 64 encoder http://www.example.com] and click encode. Here is the resulting encoding.

ewogICAgY2xvYWtyYWlkID0gewogICAgICAgIG1heERhbWFnZSA9IDUwMCwKICAgICAgICBtYXhWZWxvY2l0eSA9IDgsCiAgICB9LAp9

Set the Tweak Units modoption to your encoding and start the game. Your infolog should indicate that the modoption loaded successfully.

[f=-000001] Loading UnitDefs_posts
[f=-000001] Loading tweakunits modoption
[f=-000001] Loading tweakunits for cloakraid
[f=-000001] Loading FeatureDefs_posts
[f=-000001] Loading WeaponDefs_posts
[f=-000001] Loading ArmorDefs_posts