Editing Quick Stat Tweaks
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | 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 | + | 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. |
− | [[File: | + | [[File:Tweakunitswindow.jpg]] |
− | |||
− | |||
== Workflow == | == Workflow == | ||
− | The Tweak Units modoption overwrites unit parameter (called unitDefs) as they are loaded. The modoption requires a base64 | + | The Tweak Units modoption overwrites unit parameter (called unitDefs) as they are loaded. The modoption requires a base64 encoded lua array of differences. Here is how to use it. |
− | * Make a | + | * Make a lua table in an empty file. |
− | * For each unit you wish to modify, add an empty table indexed by the | + | * 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 [https://github.com/ZeroK-RTS/Zero-K/blob/master/units Zero-K repository]. | * Search for the units you wish to modify in the [https://github.com/ZeroK-RTS/Zero-K/blob/master/units Zero-K repository]. | ||
* Copy the parameters you wish to modify into the table, maintaining the structure of the unitDef table. | * Copy the parameters you wish to modify into the table, maintaining the structure of the unitDef table. | ||
Line 16: | 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. Search the | + | 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. |
== Limitations == | == Limitations == | ||
Line 22: | Line 20: | ||
== Simple Example == | == Simple Example == | ||
− | In this example we make Glaive faster and | + | In this example we make Glaive faster and healthier. |
− | Start with an empty | + | 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'. | 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 = {}, | cloakraid = {}, | ||
− | }</ | + | }</nowiki> |
− | The [https://springrts.com/wiki/Gamedev:UnitDefs SpringRTS wiki page on unitdefs] says that a unit's | + | 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 = { | cloakraid = { | ||
− | + | maxDamage = 500, | |
− | + | maxVelocity = 8, | |
}, | }, | ||
− | }</ | + | }</nowiki> |
Copy this text into a [https://www.base64encode.org/ base64 encoder] and click encode. Here is the resulting encoding. | Copy this text into a [https://www.base64encode.org/ base64 encoder] 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. | 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 modoption |
− | [f=-000001] Loading tweakunits for cloakraid | + | [f=-000001] Loading tweakunits for cloakraid |
[f=-000001] Loading FeatureDefs_posts | [f=-000001] Loading FeatureDefs_posts | ||
[f=-000001] Loading WeaponDefs_posts | [f=-000001] Loading WeaponDefs_posts | ||
− | [f=-000001] Loading ArmorDefs_posts</ | + | [f=-000001] Loading ArmorDefs_posts</nowiki> |
== Advanced Example == | == Advanced Example == | ||
In this example we will change Bandit's damage and range, and add it to the Glaive changes. | In this example we will change Bandit's damage and range, and add it to the Glaive changes. | ||
− | As in the simple example, we find the [https://github.com/ZeroK-RTS/Zero-K/blob/master/units/shieldraid.lua Bandit's file] and see that it | + | As in the simple example, we find the [https://github.com/ZeroK-RTS/Zero-K/blob/master/units/shieldraid.lua Bandit's file] and see that it called shieldraid. To change Bandit and Glaive at the same time we add a new subtable to the table from the previous example. |
− | < | + | <nowiki>{ |
cloakraid = { | cloakraid = { | ||
− | + | maxDamage = 500, | |
− | + | maxVelocity = 8, | |
}, | }, | ||
shieldraid = {}, | shieldraid = {}, | ||
− | }</ | + | }</nowiki> |
− | Weapon parameters can be found in the [https://springrts.com/wiki/Gamedev:WeaponDefs SpringRTS page on weapon defs], and Zero-K stores them as a | + | Weapon parameters can be found in the [https://springrts.com/wiki/Gamedev:WeaponDefs SpringRTS page on weapon defs], and Zero-K stores them as a subtable within unitdefs. The range parameter is inside 'LASER' (the internal name of the Bandit's weapon), which is inside the weaponDefs table of Bandit. Weapon damage is further nested inside the damage sub-table of the weapondef. |
− | < | + | <nowiki>{ |
cloakraid = { | cloakraid = { | ||
− | + | maxDamage = 500, | |
− | + | maxVelocity = 8, | |
}, | }, | ||
shieldraid = { | shieldraid = { | ||
Line 75: | Line 73: | ||
}, | }, | ||
}, | }, | ||
− | }</ | + | }</nowiki> |
As before, we now take this text, [https://www.base64encode.org/ base64 encode] it, and copy it into Tweak Units. Encodings can be shortened by removing whitespace prior to encoding. | As before, we now take this text, [https://www.base64encode.org/ base64 encode] it, and copy it into Tweak Units. Encodings can be shortened by removing whitespace prior to encoding. | ||
− | + | e2Nsb2FrcmFpZCA9IHttYXhEYW1hZ2UgPSA1MDAsbWF4VmVsb2NpdHkgPSA4LH0sc2hpZWxkcmFpZCA9IHt3ZWFwb25EZWZzID0ge0xBU0VSID0ge3JhbmdlID0gNjAwLGRhbWFnZSA9IHtkZWZhdWx0ID0gNTAsfSx9LH0sfSx9 | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Happy hacking! | Happy hacking! | ||
− | [[File:Zk_1_7_11_0_cover.jpg | + | [[File:Zk_1_7_11_0_cover.jpg]] |
− | |||
− |