A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | This sheet contains references to all relevant workshop-related modding code as well as how to use them. Please read the table of contents and the START section below if you are beginning modding | |||||||||||||||||||||||||
2 | Table of Contents | Section Type | Use Ctrl + F (PC) or Search function (mobile) in order to skip to a section you need, copy whats listed exactly: | Function of section/code | ||||||||||||||||||||||
3 | Sections with brackets and no name or number (like [core] ) you can only have 1 of | Single | [core] | Core unit functions such as HP and death animation | ||||||||||||||||||||||
4 | Sections with NAME at the end can have multiples and be named | Multi | canBuild_NAME | Build queues for building new units | ||||||||||||||||||||||
5 | Single | [graphics] | Main image configuration and unit trails | |||||||||||||||||||||||
6 | Single | [attack] | Attack permissions against other units | |||||||||||||||||||||||
7 | MAX: 30 | Multi | turret_NAME | Turret that follows attack permissions and uses projectile | ||||||||||||||||||||||
8 | Multi | projectile_NAME | Can be used by turret and can spawn more projectiles | |||||||||||||||||||||||
9 | Single | [movement] | Speed and movement type characteristics | |||||||||||||||||||||||
10 | Single | [ai] | How AI may use this unit, mostly for buildings | |||||||||||||||||||||||
11 | !!! Arm and Leg can ONLY use numbers | Number | leg_ OR arm_ | Moveable cosmetics for mechs, infantry etc. | ||||||||||||||||||||||
12 | Multi | attachment_ | Units stacked onto original to make compound units | |||||||||||||||||||||||
13 | Multi | action_NAME OR hiddenAction_NAME | Actions that can do very wide range of things | |||||||||||||||||||||||
14 | Multi | effect_NAME | Visual effects spawned by unit that eventually disappear | |||||||||||||||||||||||
15 | Multi | animation_NAME | Animations for leg, arm or main body sprite | |||||||||||||||||||||||
16 | Not a section of its own | List | spawnUnits:LIST | Lists you can form for spawning units | ||||||||||||||||||||||
17 | Not a section of its own | List | spawnProjectiles:LIST | Lists you can form for spawning projectiles | ||||||||||||||||||||||
18 | Not a section of its own | Logic | logicBoolean_ | Advanced logic to place across all logic fields | ||||||||||||||||||||||
19 | Multi | placementRule_NAME | Allows creation of rules for buildings | |||||||||||||||||||||||
20 | Not a section of its own | List | Prices/Resources | Useable resources for prices using "price:" function | ||||||||||||||||||||||
21 | Multi | global_resource_NAME | Global resource collected by team shows up on top | |||||||||||||||||||||||
22 | Multi | resource_NAME | Local resource used by units can be used for ammo | |||||||||||||||||||||||
23 | Multi | decal_NAME | Versatile graphics can be stack to make 2.5D sprites | |||||||||||||||||||||||
24 | Use # before text to use in any section, example: #This is a note in [core] | Multi | comment_NAME | Used exclusively for notes, does not read anything | ||||||||||||||||||||||
25 | Multi | template_NAME | Used to create sections that can be referenced in unit | |||||||||||||||||||||||
26 | Is a file that you must create | File | NAME.template | Create chains of unit files doesn't load unless copyFrom: | ||||||||||||||||||||||
27 | Is a file that you must create | File | all-units.template | Put in root of mod, will apply to ALL unit .ini files | ||||||||||||||||||||||
28 | Is a file that you must create | File | mod-info.txt | Put in root of mod, will change some settings of mod | ||||||||||||||||||||||
29 | Ref | Projectile Draw Types | Default projectiles able to use in [projectile_NAME] | |||||||||||||||||||||||
30 | START | In order to create an unit, you need to create a file with extension of .ini. It can be named anything, even with unicode characters, and it must be in your mod folder inside the rustedWarfare/mods/units/MODNAME folder -- Then, you add the sections in with the code | The unit file extension needed: | |||||||||||||||||||||||
31 | There are some lines of code that are required before a unit can be useable. These lines of code can be set to anything appropriate, just need to have their fields filled out for initializing or it will give an error | Error for not having needed code: | ||||||||||||||||||||||||
32 | !!! THESE ARE REQUIRED CODE !!! | Example | ||||||||||||||||||||||||
33 | Section | Code | Option | |||||||||||||||||||||||
34 | [core] | name: ANY | unit name | |||||||||||||||||||||||
35 | maxHp: 200 | number | ||||||||||||||||||||||||
36 | price: 500 | number | ||||||||||||||||||||||||
37 | mass: 50 | number | ||||||||||||||||||||||||
38 | radius: 16 | number | ||||||||||||||||||||||||
39 | ||||||||||||||||||||||||||
40 | [graphics] | image: ANY.png | image file | |||||||||||||||||||||||
41 | ||||||||||||||||||||||||||
42 | [attack] | canAttack: true | true, false | |||||||||||||||||||||||
43 | canAttackFlyingUnits: true | true, false | ||||||||||||||||||||||||
44 | canAttackLandUnits: true | true, false | ||||||||||||||||||||||||
45 | canAttackUnderwaterUnits: false | true, false | ||||||||||||||||||||||||
46 | ||||||||||||||||||||||||||
47 | [movement] | movementType: | NONE, LAND, AIR, WATER, HOVER, BUILDING, OVER_CLIFF, OVER_CLIFF_WATER | |||||||||||||||||||||||
48 | ||||||||||||||||||||||||||
49 | ! | For starting out, it is recommended to check out the turret and projectile sections in order to get used to basic vanilla style units, but the modding reference offers a very wide range of things to change in your units, it's encouraged to take your time and read everything | ||||||||||||||||||||||||
50 | ||||||||||||||||||||||||||
51 | Version | Section | [core] | |||||||||||||||||||||||
52 | Added | Code | Value Type | Description | Example | |||||||||||||||||||||
53 | #==== | #==== | Necessary Code: will cause error if these are not included | |||||||||||||||||||||||
54 | name: | string | Defines the unit raw name, game uses it to identify as a unique name. (This is not displayed in-game) | name: customTank1 | ||||||||||||||||||||||
55 | mass: | int | The 'weight' of the unit, defines how it collides with other units, a greater value means it's tougher to push. | mass: 3000 | ||||||||||||||||||||||
56 | radius: | int | Circular area around the unit that makes it selectable. (mouse click/screen touch) | radius: 20 | ||||||||||||||||||||||
57 | price: | int / price | The unit cost from builders/buildings. Defaults to credits if no resource type is used | price: 500, gold=5, stone=10 | ||||||||||||||||||||||
58 | maxHp: | int | The max health for the unit. (will spawn with this value). | maxHp: 200 | ||||||||||||||||||||||
59 | #==== | #==== | Common Keys | |||||||||||||||||||||||
60 | buildSpeed: | float / s | Time it takes to build the unit. (may multiply with builder speed) | buildSpeed: 3s | ||||||||||||||||||||||
61 | class: | string | Reserved for future use, must be CustomUnitMetadata by default. Is not necessary to include, has no additional functions. | class: CustomUnitMetadata | ||||||||||||||||||||||
62 | techLevel: | int | Defines the Tech Level of the unit, there're 3 levels and each will appear in a different color in the GUI. | techLevel: 1 | ||||||||||||||||||||||
63 | altNames: | string(s) | Comma separated list of names. Like name but lower priority, useful for multiple optional mods. | altNames: custTank1, customTank1, cTank1 | ||||||||||||||||||||||
64 | 1.13.3 | strictLevel: | float | Defaults to 0. 1 = Errors if keys are duplicated. Add to "all-units.template" in root to apply to all units. | strictLevel: 1 | |||||||||||||||||||||
65 | isBio: | bool | Choose whether the unit is bioligical or not, affects sound and splat (unless hideScorchMark:true) | isBio: true | ||||||||||||||||||||||
66 | isBug: | bool | Changes some death defaults, and sort order in Sandbox. | isBug: false | ||||||||||||||||||||||
67 | 1.13 | isBuilder: | bool | Normally required if this unit places buildings. Defaults to [ai]useAsBuilder. | isBuilder: true | |||||||||||||||||||||
68 | 1.15 | streamingCost: | price | Like price but paid for overtime while this unit is being queued or built. Construction or queue is paused if resources run out while building. | streamingCost: gem=420 | |||||||||||||||||||||
69 | 1.15 | switchPriceWithStreamingCost: | bool | Shortcut to set streamingCost to price value and clear price, add to all-units.template to quickly switch a mod over to streaming resources. | switchPriceWithStreamingCost: true | |||||||||||||||||||||
70 | #==== | #==== | Unit Stats Keys | |||||||||||||||||||||||
71 | selfRegenRate: | float | Passive self repair rate. | selfRegenRate: 0.01 | ||||||||||||||||||||||
72 | maxShield: | int | The max shield hitpoints of the unit. Can start with 0 hitpoints if startShieldAtZero:true. | maxShield: 500 | ||||||||||||||||||||||
73 | startShieldAtZero: | bool | Unit starts with a 0 hitpoints shield on created if true. | startShieldAtZero: true | ||||||||||||||||||||||
74 | shieldRegen: | float | Passive shield regen rate. | shieldRegen: 0.15 | ||||||||||||||||||||||
75 | energyMax: | float | Defaults to 0. Energy that can be used as ammo for turrets, laser defense and actions. | energyMax: 1 | ||||||||||||||||||||||
76 | energyRegen: | float | Passive energy regen rate. | energyRegen: 0.001 | ||||||||||||||||||||||
77 | energyStartingPercentage: | float | Sets the percentage of charged energy when the unit is first built. | energyStartingPercentage: 0.5 | ||||||||||||||||||||||
78 | energyNeedsToRechargeToFull: | float | Disables weapons using energy after reaching zero till fully recharged if true. | energyNeedsToRechargeToFull: true | ||||||||||||||||||||||
79 | energyRegenWhenRecharging: | float | Regen rate while recharging. | |||||||||||||||||||||||
80 | 1.13 | armour: | int | Damage taken away from each hit. (not currently used in any vanilla units) | armour: 6 | |||||||||||||||||||||
81 | 1.13 | armourMinDamageToKeep: | int | Min damage to keep from received damage. Defaults to 1. | armourMinDamageToKeep: 2 | |||||||||||||||||||||
82 | 1.13.3 | borrowResourcesWhileAlive: | price | Takes these resources when created and returns them when removed or destroyed. | borrowResourcesWhileAlive: gold=10 | |||||||||||||||||||||
83 | 1.15 | borrowResourcesWhileBuilt: | price | Like borrowResourcesWhileAlive but doesn't take affect till built. Mostly useful for buildings like houses that have negative resources to add to the unit cap, etc. | borrowResourcesWhileBuilt: supplyCap = -10 | |||||||||||||||||||||
84 | 1.13.3 | generation_resources: | price | Income unit creates. (custom resource version) | generation_resources: credits=5, gold=20 | |||||||||||||||||||||
85 | 1.13.3 | generation_active: | logicBoolean | Disables generation_resources/credits when false. (logic_boolean) | generation_active: if not self.hp(lessThan=100) | |||||||||||||||||||||
86 | generation_credits: | int | Income unit creates. (credits only) | generation_credits: 2 | ||||||||||||||||||||||
87 | generation_delay: | int | How often generation_resources/credits is added. Defaults to 40. (changing not recommended) | generation_delay: 40 | ||||||||||||||||||||||
88 | #==== | #==== | UI and Graphics Keys | |||||||||||||||||||||||
89 | showInEditor: | bool | Set to false to hide unit in Sandbox editor. (Defaults to true) | showInEditor: false | ||||||||||||||||||||||
90 | displayText: | LocaleString | The unit name that the game shows to the player. | displayText: Custom Tank | ||||||||||||||||||||||
91 | 1.13 | displayText_{LANG}: | string | LANG = ISO 639-1 Code to show this text instead when game is in this language. | displayText_es: Tanque Personalizado | |||||||||||||||||||||
92 | displayDescription: | LocaleString | Unit description that the game shows to the player. | displayDescription: -Fast movement\n-Light damage | ||||||||||||||||||||||
93 | 1.13 | displayDescription_{LANG}: | string | LANG = ISO 639-1 Code to show this text instead when game is in this language. | displayDescription_es: -Movimiento rápido\n-Daño ligero | |||||||||||||||||||||
94 | displayLocaleKey: | string | Translation file key for unit name and description. | displayLocaleKey: units.mechArtillery | ||||||||||||||||||||||
95 | displayRadius: | int | Defaults to radius value. Set to show a larger or smaller selection circle UI on units. | displayRadius: 20 | ||||||||||||||||||||||
96 | uiTargetRadius | int | Defaults to displayRadius value. Radius used when attacking/reclaiming/etc this unit | uiTargetRadius: 10 | ||||||||||||||||||||||
97 | shieldRenderRadius: | int | Defaults is a little bigger than radius. Set to show a larger or smaller shield circle on units. | shieldRenderRadius: 12 | ||||||||||||||||||||||
98 | shieldDisplayOnlyDeflection: | bool | Hide shield unless deflecting shot if true. | shieldDisplayOnlyDeflection: true | ||||||||||||||||||||||
99 | shieldDeflectionDisplayRate: | float | Defaults to 4. High value causes shield deflection to fade disappear faster. | shieldDeflectionDisplayRate: 3 | ||||||||||||||||||||||
100 | 1.13.3 | showOnMinimap: | bool | Defaults to true. Hide units on minimap if false. | showOnMinimap: false |