AbAb

在2022年2月19日 (星期六)加入
这是测试
(测试)
(这是测试)
第1行:
信息来自:[https://docs.google.com/spreadsheets/d/1aeP3pUic0IutZlgGix_cM8xR7LEH44gS4itAxETK954 Rusted Warfare: Beta Modding Reference]<br />信息更新时间:2023年1月5日 (四) 20:15 (CST)
<div style="border: 2px solid black; border-radius: 8px;">
<table>
<tr><th colspan="2">个人名片</th></tr>
<tr><td style="width: 100%;">用户名:</td><td style= "text-align: right;">abAb</td></tr>
<tr><td>QQ:</td><td style= "text-align: right;">1731438559</td></tr>
<tr><td>存在天数:</td><td style= "text-align: right;">{{#expr: ({{#time: U}}+ 28800 -{{#time: U|2022-2-20}})/(3600*24) round 0}}</td></tr>
<tr><td>编辑方向:</td><td style= "text-align: right;">mod代码</td></tr>
</table>
</div>
 
==<nowiki>[core]</nowiki>==
Test:<br /><!--
<div style="overflow:auto;">
{{单位横幅|
{| class="wikitable" style="background-color:black;color:yellow;"
图片名=坦克_高清.png|
| Code || Value Type || Description || Example
单位名=坦克|
|-
价格=350|
| #==== || #==== || Necessary Code: will cause error if these are not included ||
单位地址=坦克|
|-
单位描述=-只能攻击地面单位<br />-移动较快但生命值较低|
| name: || string || Defines the unit raw name, game uses it to identify as a unique name. (This is not displayed in-game) || name: customTank1
HP=210|
|-
Speed=1.10|
| 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
Attack=25/1.25s|
|-
Range=130|
| radius: || int || Circular area around the unit that makes it selectable. (mouse click/screen touch) || radius: 20
}}
|-
{{单位横幅|
| price: || int / price || The unit cost from builders/buildings. Defaults to credits if no resource type is used || price: 500, gold=5, stone=10
图片名=悬浮坦克_高清.png|
|-
单位名=悬浮坦克|
| class: || string || Reserved for future use, must be CustomUnitMetadata by default. || class: CustomUnitMetadata
价格=450|
|-
单位地址=悬浮坦克|
| maxHp: || int || The max health for the unit. (will spawn with this value). || maxHp: 200
单位描述=-轻装甲<br />-能够在水上前进<br />-可以攻击空中和地面单位<br />-用于直接作战往往不合算|
|-
HP=150|
| 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
Speed=1|
|-
Attack=23/1.5s|
| buildSpeed: || float / s || Time it takes to build the unit. (may multiply with builder speed) || buildSpeed: 3s
Range=140|
|-
}}
| #==== || #==== || Common Keys ||
{{单位横幅|
|-
图片名=建造者_高清.png|
| altNames: || string(s) || Comma separated list of names. Like name but lower priority, useful for multiple optional mods. || altNames: custTank1, customTank1, cTank1
单位名=建造者|
|-
价格=500|
| 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
单位地址=建造者|
|-
单位描述=-建造和维修建筑物<br />-不能攻击|
| isBio: || bool || Choose whether the unit is bioligical or not, affects sound and splat (unless hideScorchMark:true) || isBio: true
HP=170|
|-
Speed=0.80|
| isBug: || bool || Changes some death defaults, and sort order in Sandbox. || isBug: false
}}
|-
{{单位横幅|
| isBuilder: || bool || Normally required if this unit places buildings. Defaults to [ai]useAsBuilder. || isBuilder: true
图片名=登陆艇_高清.png|
|-
单位名=登陆艇|
| 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. ||
价格=600|
|-
单位地址=登陆艇|
| 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. ||
单位描述=-运输单位<br />-能够在地面和水上移动<br />-不能攻击|
|-
HP=450|
| #==== || #==== || Unit Stats Keys ||
Speed=0.89|
|-
}}
| selfRegenRate: || float || Passive self repair rate. || selfRegenRate: 0.01
{{单位横幅|
|-
图片名=基础机甲_高清.png|
| maxShield: || int || The max shield hitpoints of the unit. Can start with 0 hitpoints if startShieldAtZero:true. || maxShield: 500
单位名=基础机甲|
|-
价格=600|
| startShieldAtZero: || bool || Unit starts with a 0 hitpoints shield on created if true. || startShieldAtZero: true
单位地址=基础机甲|
|-
单位描述=-只能攻击地面单位<br />-相比普通坦克生命值更高,但移动也更缓慢|
| shieldRegen: || float || Passive shield regen rate. || shieldRegen: 0.15
HP=500|
|-
Speed=0.80|
| energyMax: || float || Defaults to 0. Energy that can be used as ammo for turrets, laser defense and actions. || energyMax: 1
Attack=23/0.61s|
|-
Range=130|
| energyRegen: || float || Passive energy regen rate. || energyRegen: 0.001
}}
|-
{{单位横幅|
| energyStartingPercentage: || float || Sets the percentage of charged energy when the unit is first built. || energyStartingPercentage: 0.5
图片名=侦察者_高清.png|
|-
单位名=侦察者|
| energyNeedsToRechargeToFull: || float || Disables weapons using energy after reaching zero till fully recharged if true. || energyNeedsToRechargeToFull: true
价格=700|
|-
单位地址=侦察者|
| energyRegenWhenRecharging: || float || Regen rate while recharging. ||
单位描述=-中型装甲<br />-低性价比单位<br />-能够透过迷雾看得更远<br />-能够在水面上移动<br />-能攻击空中和地面单位|
|-
HP=350|
| armour: || int || Damage taken away from each hit. (not currently used in any vanilla units) || armour: 6
Speed=1|
|-
Attack=17/0.83s|
| armourMinDamageToKeep: || int || Min damage to keep from received damage. Defaults to 1. || armourMinDamageToKeep: 2
Range=110|
|-
}}
| borrowResourcesWhileAlive: || price || Takes these resources when created and returns them when removed or destroyed. || borrowResourcesWhileAlive: gold=10
{{单位横幅|
|-
图片名=重型坦克_高清.png|
| 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
单位名=重型坦克|
|-
价格=800|
| generation_resources: || price || Income unit creates. (custom resource version) || generation_resources: credits=5, gold=20
单位地址=重型坦克|
|-
单位描述=-全副武装<br />-能攻击地面单位<br />-一定对空能力|
| generation_active: || logicBoolean || Disables generation_resources/credits when false. (logic_boolean) || generation_active: if not self.hp(lessThan=100)
HP=600|
|-
Speed=0.80|
| generation_credits: || int || Income unit creates. (credits only) || generation_credits: 2
Attack=50/1.16s|
|-
Range=160|
| generation_delay: || int || How often generation_resources/credits is added. Defaults to 40. (changing not recommended) || generation_delay: 40
}}
|-
{{单位横幅|
| #==== || #==== || UI and Graphics Keys ||
图片名=自行火炮_高清.png|
|-
单位名=自行火炮|
| showInEditor: || bool || Set to false to hide unit in Sandbox editor. (Defaults to true) || showInEditor: false
价格=900|
|-
单位地址=自行火炮|
| displayText: || LocaleString || The unit name that the game shows to the player. || displayText: Custom Tank
单位描述=-只能攻击地面单位<br />-远距离打击|
|-
HP=140|
| displayText_{LANG}: || string || LANG = ISO 639-1 Code to show this text instead when game is in this language. || displayText_es: Tanque Personalizado
Speed=0.89|
|-
Attack=80/4s|
| displayDescription: || LocaleString || Unit description that the game shows to the player. || displayDescription: -Fast movement\n-Light damage
Range=290|
|-
}}
| 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
{{单位横幅|
|-
图片名=防空机甲_高清.png|
| displayLocaleKey: || string || Translation file key for unit name and description. || displayLocaleKey: units.mechArtillery
单位名=防空机甲|
|-
价格=900|
| displayRadius: || int || Defaults to radius value. Set to show a larger or smaller selection circle UI on units. || displayRadius: 20
单位地址=防空机甲|
|-
单位描述=-只能攻击空中单位<br />-范围伤害<br />-不能对地攻击|
| uiTargetRadius || int || Defaults to displayRadius value. Radius used when attacking/reclaiming/etc this unit ||
HP=500|
|-
Speed=0.80|
| shieldRenderRadius: || int || Defaults is a little bigger than radius. Set to show a larger or smaller shield circle on units. || shieldRenderRadius: 12
Attack=115/2.20s|
|-
Range=190|
| shieldDisplayOnlyDeflection: || bool || Hide shield unless deflecting shot if true. || shieldDisplayOnlyDeflection: true
}}
|-
{{单位横幅|
| shieldDeflectionDisplayRate: || float || Defaults to 4. High value causes shield deflection to fade disappear faster. || shieldDeflectionDisplayRate: 3
图片名=重型气垫坦克_高清.png|
|-
单位名=重型气垫坦克|
| showOnMinimap: || bool || Defaults to true. Hide units on minimap if false. || showOnMinimap: false
价格=1000|
|-
单位地址=重型气垫坦克|
| showActionsWithMixedSelectionIfOtherUnitsHaveTag: || bool || Shows a merged action list if all units selected includes one of these tags. Useful for converted units. || showActionsWithMixedSelectionIfOtherUnitsHaveTag: true
单位描述=-全副武装<br />-能在水上移动<br />-可以攻击空中和地面单位|
|-
HP=450|
| showOnMinimapToEnemies || bool || Useful for stealth units ||
Speed=0.69|
|-
Attack=40/1.25s|
| #==== || #==== || Building Only Keys ||
Range=160|
|-
}}
| isBuilding: || bool || Defines if the unit is a building. || isBuilding: true
{{单位横幅|
|-
图片名=等离子坦克_高清.png|
| footprint: || ints || Left, up, right, down. Tiles taken up which block unit movement. Defaults to 0,0,0,0 = 1 center tile. || footprint: 0,0,1,1
单位名=等离子坦克|
|-
价格=1000|
| constructionFootprint: || ints || Tiles taken up for placement of other buildings. Defaults to 0,0,0,0 = 1 center tile. || constructionFootprint: -1,-1,1,3
单位地址=等离子坦克|
|-
单位描述=-拥有强大防御<br />-只能攻击地面单位<br />-有防护盾(能被电击绕过)|
| displayFootprint: || ints || Left, up, right, down. Only applies to buildings, just used for GUI. Defaults to footprint. || displayFootprint: 0,0,1,1
HP=220|
|-
Shield=430|
| buildingSelectionOffset: || int || Defaults to 0. Adds or removes padding on the drawn selection rect in UI. || buildingSelectionOffset: 4
Speed=0.80|
|-
Attack=100/1.66s|
| buildingToFootprintOffsetX: || float || Defaults to 10. Change the building position in the footprint on the X-axis. || buildingToFootprintOffsetX: 4
Range=165|
|-
}}
| buildingToFootprintOffsetY: || float || Defaults to 10. Change the building position in the footprint on the Y-axis. || buildingToFootprintOffsetY: 6
{{单位横幅|
|-
图片名=激光坦克_高清.png|
| placeOnlyOnResPool: || bool || Normally used for extractors, forces building construction in a resource pool. || placeOnlyOnResPool: true
单位名=激光坦克|
|-
价格=1600|
| selfBuildRate: || float || Rate unit builds itself when placed without a builder. || selfBuildRate: 0.0008
单位地址=激光坦克|
|-
单位描述=-可以攻击地面和空中单位<br />-不能同时对付多个敌人<br />-强大的单发射击,但是充能慢|
| ignoreInUnitCapCalculation || || defaults to true for buildings otherwise false. Set to true to not count this unit in unit cap. ||
HP=400|
|-
Speed=0.60|
| #==== || #==== || Misc Keys ||
Attack=350/6s|
|-
Range=190|
| copyFrom: || file(s) (ini) || Uses unit data from another ini file as default for this unit, supports multiple files. || copyFrom: ROOT:defaultTanks.template, tankT1.ini
}}
|-
{{单位横幅|
| dont_load: || bool || Do not load unit, and don't error on missing data. Can be useful when used with copyFrom. || dont_load: true
图片名=火炮机甲_高清.png|
|-
单位名=火炮机甲|
| overrideAndReplace: || string(s) || Overrides another unit with this unit. Build links and map positions to target unit will be replaced. || overrideAndReplace: builder, combatEngineer
价格=1400|
|-
单位地址=火炮机甲|
| onNewMapSpawn: || string || Values: emptyResourcePools_asNeutral, emptyOrOccupiedResourcePools_asNeutral, mapCenter_asNeutral, mapCenter_eachActiveTeam, spawnPoint_eachActiveTeam ||
单位描述=-能攻击地面<br />-射程远<br />-能够在边开火边移动|
|-
HP=500|
| globalScale: || float || Defaults to 1. Changing not recommended. || globalScale: 2
Speed=0.60|
|-
Attack=100/3.66s|
| isLocked: || bool || Disallow building of this unit. Can be used with overrideAndReplace to restrict units player can build. || isLocked: true
Range=290|
|-
}}
| isLockedIfGameModeNoNuke: || bool || Disallows building of this unit if nukes are disabled during match setup. || isLockedIfGameModeNoNuke: true
{{单位横幅|
|-
图片名=防空导弹坦克_高清.png|
| experimental: || bool || Tag unit as experimental. Affects zoomed out icon and end game stats. || experimental: true
单位名=防空导弹坦克|
|-
价格=2500|
| stayNeutral: || bool || Set to false to disable capture when unit is on the neutral team. || stayNeutral: false
单位地址=防空导弹坦克|
|-
单位描述=-远程对空导弹<br />-轻型护盾|
| createNeutral: || bool || Set to true to always spawn the unit on the neutral team. || createNeutral: true
HP=1100|
|-
Shield=700|
| createOnAggressiveTeam: || bool || Set to true to always spawn the unit on aggressive teams on single player matches. || createOnAggressiveTeam: true
Speed=0.60|
|-
Attack=120x2/3.86s|
| tags: || string(s) || List of comma separated strings. Used to classify units, create special actions and balances. || tags: tank, smallTank, piercingDamage
Range=340|
|-
}}
| defineUnitMemory || || Can define several variables for custom storage, unique for each unit. Allowed types: boolean, float/number, unit, string. || "defineUnitMemory: boolean nukeActive, boolean laserReady, float experience, unit nextTarget, unit homeBase, string customText
{{单位横幅|
|-
图片名=重型火炮_高清.png|
| || || Add a pair of square brackets to turn them into arrays for those specific data types || defineUnitMemory: unit[] squad, float[] mango
单位名=重型火炮|
|-
价格=3100|
| fogOfWarSightRange: || int || Sets number of tiles this unit can see through the fog of war. Defaults to 15. || fogOfWarSightRange: 18
单位地址=重型火炮|
|-
单位描述=-只能对地攻击<br />-较远射程<br />-自带较有限的激光防御|
| fogOfWarSightRangeWhileNotBuilt || int || Fog of War range when unit/building is incomplete. Defaults to fogOfWarSightRange ||
HP=600|
|-
Speed=0.60|
| softCollisionOnAll: || int || Creates a soft collision effect when touching other units. || softCollisionOnAll: 3
Attack=110/2.5s|
|-
Range=310|
| disableAllUnitCollisions: || bool || Unit cannot collide with others if true. || disableAllUnitCollisions: true
}}
|-
{{单位横幅|
| isUnrepairableUnit: || bool || No unit can repair this unit if true. || isUnrepairableUnit: true
图片名=战斗工程师_高清.png|
|-
单位名=战斗工程师|
| isUnselectable: || bool || If true unit cannot be selected. (includes AI players) || isUnselectable: true
价格=3500|
|-
单位地址=战斗工程师|
| isUnselectableAsTarget || bool || Defaults to isUnselectable. Can be used to create units that cannot be selected but can be targeted for attack, reclaim, etc ||
单位描述=-可以建造单位和T2建筑物<br />-带有重型装甲并且可以对地攻击<br />-在水上时可以攻击潜艇<br />-能自我修复并内置资源制造仪<br />-能在水上移动|
|-
HP=1000|
| isPickableStartingUnit: || bool || If true, unit is added to dropdowns for starting unit in game setup menus. || isPickableStartingUnit: true
Income=+$1
|-
Speed=1|
| startFallingWhenStartingUnit: || bool || Unit will appear falling from skies when starting unit if true. || startFallingWhenStartingUnit: true
Attack=30/0.83s, 45/2.5s|
|-
Range=170|
| soundOnAttackOrder: || sound(s) || List of sound names. Only one will be played on each attack order. Only .ogg and .wav formats. || soundOnAttackOrder: tankAttackOrder1.ogg, tankAttackOrder2.ogg
}}
|-
{{单位横幅|
| soundOnMoveOrder: || sound(s) || List of sound names. Only one will be played on each move order. Only .ogg and .wav formats. || soundOnMoveOrder: tankMoveOrder1.ogg, tankMoveOrder2.ogg
图片名=猛犸坦克_高清.png|
|-
单位名=猛犸坦克|
| soundOnNewSelection: || sound(s) || List of sound names. Only one will be played on each unit selection. Only .ogg and .wav formats. || soundOnNewSelection: tankSelection1.ogg, tankSelection2.ogg
价格=3900|
|-
单位地址=猛犸坦克|
| canNotBeDirectlyAttacked: || bool || No unit can directly target this unit. If true this will also skip this unit in victory/defeat checks. || canNotBeDirectlyAttacked: true
单位描述=-重型装甲<br />-能电击地面单位<br />-对建筑物伤害稍低,但攻击护盾效果拔群|
|-
HP=2600|
| canNotBeDamaged || bool || Defaults to value of canNotBeDirectlyAttacked (be careful setting this without canNotBeDirectlyAttacked, as AI will attack forever) ||
Speed=0.60|
|-
Attack=130/1.33s|
| canNotBeGivenOrdersByPlayer: || bool || If true unit will not take player or AI orders. || canNotBeGivenOrdersByPlayer: true
Range=190|
|-
}}
| canOnlyBeAttackedByUnitsWithTags: || strings(s) || List of tag strings, only units with these tags can directly target this unit. || canOnlyBeAttackedByUnitsWithTags: piercingTank, powerfulTank
{{单位横幅|
|-
图片名=移动炮塔_高清.png|
| disableDeathOnZeroHp || bool || "Setting to true allows unit to continue living even at 0 HP, useful for custom ""death"" action. Warning: If not used with an autoTrigger, etc units will attack this unit forever." ||
单位名=移动炮塔|
|-
价格=4500|
| allowCaptureWhenNeutralByAI || bool || When true, it lets to be captured on contact by AI as well. Defaults as false ||
单位地址=移动炮塔|
|-
单位描述=-能攻击地面单位<br />-可原地部署并获得额外射程与防御|
| #==== || #==== || Transport Keys ||
HP=800|
|-
Speed=0.40|
| transportSlotsNeeded: || int || Defaults to 1. Number of slots this unit uses up in a transport, experimentals are often set to 5. || transportSlotsNeeded: 2
Attack=110/1.16s|
|-
Range=200|
| maxTransportingUnits || int || Number of slots this units has for transporting other units. || maxTransportingUnits: 5
}}
|-
{{单位横幅|
| transportUnitsRequireTag: || string(s) || Only allows trasport of units that have one of these tags. || transportUnitsRequireTag: smallTank, soldier
图片名=机械师_高清.png|
|-
单位名=机械师|
| transportUnitsRequireMovementType: || movementTypes || Only allows trasport of units that have one of these movement types. || transportUnitsRequireMovementType: AIR, WATER
价格=5000|
|-
单位地址=机械师|
| transportUnitsBlockAirAndWaterUnits: || bool || Defaults to true. This unit can only transport LAND units if true. || transportUnitsBlockAirAndWaterUnits: false
单位描述=-建造机甲和T2建筑物<br />-配有防空导弹<br />-全副武装|
|-
HP=2000|
| transportUnitsEachUnitAlwaysUsesSingleSlot: || bool || Defaults to false. Units in this transport occupy 1 slot always if true, ignoring transportSlotsNeeded. || transportUnitsEachUnitAlwaysUsesSingleSlot: true
Income=+$1|
|-
Speed=0.85|
| transportUnitsKeepBuiltUnits: || bool || Makes built units stay inside transport instead of exiting it once ready if true. || transportUnitsKeepBuiltUnits: true
Attack=140/1.53s|
|-
Range=220|
| transportUnitsCanUnloadUnits: || LogicBoolean || Defaults to: if not self.isOverLiquid() and not self.isMoving(). This unit cannot unload units if false. || transportUnitsCanUnloadUnits: false
}}
|-
{{单位横幅|
| transportUnitsAddUnloadOption: || bool || Defines if unload button should be added to the unit menu || transportUnitsAddUnloadOption: false
图片名=机枪机甲_高清.png|
|-
单位名=机枪机甲|
| transportUnitsUnloadDelayBetweenEachUnit: || float || Changes the delay it takes between each unit getting unloaded. || transportUnitsUnloadDelayBetweenEachUnit: 12
价格=5000|
|-
单位地址=机枪机甲|
| transportUnitsKillOnDeath: || LogicBoolean || Defaults to true. If false transported units don't die when transport dies. || transportUnitsKillOnDeath: if self.isOverLiquid()
单位描述=-能攻击地面单位<br />-高射速<br />-开火速度逐渐加快<br />-有防护盾(能被电击绕过)|
|-
HP=600|
| transportUnitsHealBy: || float || Rate to heal units that are being transported. || transportUnitsHealBy: 0.1
Shield=800|
|-
Speed=0.60|
| transportUnitsBlockOtherTransports: || bool || Defaults to true, if false this transports can hold other transports. || transportUnitsBlockOtherTransports: false
Attack=55/3.90s|
|-
Range=210|
| whileNeutralTransportAnyTeam: || bool || This unit can transport units of any team while neutral if true. || whileNeutralTransportAnyTeam: true
}}
|-
{{单位横幅|
| whileNeutralConvertToTransportedTeam: || bool || Converts this unit to transported team while neutral. Useful with whileNeutralTransportAnyTeam. || whileNeutralConvertToTransportedTeam: true
图片名=特斯拉机甲_高清.png|
|-
单位名=特斯拉机甲|
| convertToNeutralIfNotTransporting: || bool || Reverts back this unit to neutral when unloaded. Useful with whileNeutralTransportAnyTeam. || convertToNeutralIfNotTransporting: true
价格=5200|
|-
单位地址=特斯拉机甲|
| transportUnitsOnTeamChangeKeepCurrentTeam: || bool || Keeps transported units on their orginal team when this unit is converted if true. || transportUnitsOnTeamChangeKeepCurrentTeam: true
单位描述=-对地闪电攻击<br />-可以绕过防护盾<br />-对建筑物伤害较低|
|-
HP=2000|
| #==== || #==== || Resource Node Keys ||
Speed=0.70|
|-
Attack=140x2/1.91s|
| resourceRate: || float || Used with canReclaimResources. Allows other teams to reclaim this unit. Normally used with neutral team. Use price to set what resources are gained. ||
Range=170|
|-
}}
| similarResourcesHaveTag: || string(s) || When this has been reclaimed harvester unit moves on to another resource with these tags. || similarResourcesHaveTag: goldResource
{{单位横幅|
|-
图片名=等离子机甲_高清.png|
| resourceMaxConcurrentReclaimingThis: || int || Defaults to unlimited. Set to restict how many units can reclaim this resource at the same time. || resourceMaxConcurrentReclaimingThis: 3
单位名=等离子机甲|
|-
价格=7000|
| reclaimPrice: || int || Like price but for resources. Useful for buildable resources. || reclaimPrice: gold=1000
单位地址=等离子机甲|
|-
单位描述=-可以对空与对地<br />-开火后需要装填<br />-射程较远|
| #==== || #==== || Resource Harvester Keys ||
HP=1200|
|-
Speed=0.60|
| canReclaimResources: || bool || If true this unit can gather resources, useful with resourceRate. || canReclaimResources: true
Attack=90/0.33s|
|-
Range=310|
| canReclaimResourcesNextSearchRange: || int || Defines the resource search range of this unit when its main gathered resource runs out. || canReclaimResourcesNextSearchRange: 100
}}
|-
{{单位横幅|
| canReclaimResourcesOnlyWithTags: || string(s) || This unit is only allowed to gather resources with these tags. || canReclaimResourcesOnlyWithTags: foodResource, goldResource
图片名=mechFlyingLanded_高清.png|
|-
单位名=mechFlyingLanded|
| canReclaimUnitsOnlyWithTags || string(s) || This is for reclaiming units, not for resources. See canReclaimResourcesOnlyWithTags ||
价格=8000|
|-
单位地址=mechFlyingLanded|
| resourceReclaimMultiplier || float || "Multiplies the builder's reclaim speed. Different from the related key ""nanoUnbuildSpeed""" ||
单位描述=mechFlyingLanded|
|-
HP=1500|
| #==== || #==== || Construction and Factory Keys ||
Speed=0.60|
|-
Attack=110/0.33s|
| canRepairUnitsOnlyWithTags || string(s) || ||
Range=310|
|-
}}
| canRepairBuildings: || bool || Can this can heal ally buildings (isBuilder:true is required) || canRepairBuildings: true
{{单位横幅|
|-
图片名=重型防空机械装甲_高清.png|
| canRepairUnits: || bool || Can this can heal ally units. (isBuilder:true is required), canRepairBuildings required for buildings. || canRepairUnits: true
单位名=重型防空机械装甲|
|-
价格=8500|
| autoRepair: || bool || Automatically try and repair damaged units in nano range. (isBuilder:true is required) || autoRepair: true
单位地址=重型防空机械装甲|
|-
单位描述=-非常强的远程对空能力<br />-区域范围防空<br />-弱对地攻击|
| nanoRange: || int || Defaults to 85. Defines the unit building/repair/reclaim range. || nanoRange: 110
HP=2500|
|-
Shield=500|
| nanoRepairSpeed: || float || Defaults to 0.2. Defines the unit nano repair/reclaim speed. || nanoRepairSpeed: 0.01
Speed=0.61|
|-
Attack=35/1.5s, 240x2/2.20s|
| nanoBuildSpeed: || float || Defaults to 1. Defines the unit nano building speed. (May multiply with target's buildSpeed) || nanoBuildSpeed: 0.9
Range=310|
|-
}}
| nanoUnbuildSpeed: || float || How fast a builder reclaims an incomplete building (defaults to 1) ||
{{单位横幅|
|-
图片名=喷火机甲_高清.png|
| nanoReclaimSpeed: || float || How fast a builder reclaims a normal unit (not a resource unit) ||
单位名=喷火机甲|
|-
价格=12000|
| nanoRangeForRepairIsMelee: || bool || Defines if this unit must touch its target to repair it. || nanoRangeForRepairIsMelee: true
单位地址=喷火机甲|
|-
单位描述=-范围火焰伤害<br />-只能对地攻击<br />-生命值高能够自我修复|
| nanoRangeForReclaimIsMelee: || bool || Defines if this unit must touch its target to reclaim it. || nanoRangeForReclaimIsMelee: true
HP=4500|
|-
Speed=0.60|
| nanoRangeForRepair: || int || Defines a specific range for the repair action of this unit. || nanoRangeForRepair: 60
Attack=12x2/0.08s|
|-
Range=170|
| nanoRangeForReclaim: || int || Defines a specific range for the reclaim action of this unit. || nanoRangeForReclaim: 60
}}
|-
{{单位横幅|
| nanoFactorySpeed: || float || Defaults to 1. Multiplies the buildSpeed value of the created unit if this unit is a factory. || nanoFactorySpeed: 1.2
图片名=实验坦克_高清.png|
|-
单位名=实验坦克|
| extraBuildRangeWhenBuildingThis: || int || Temporarily adds extra build range to builders to build this unit. Useful for water based buildings. || extraBuildRangeWhenBuildingThis: 90
价格=14000|
|-
单位地址=实验坦克|
| builtFrom_{NUM}_name: || string(s) || Useful if adding this unit to build to existing buildings. Like canBuild but in opposite direction. || builtFrom_1_name: landFactory, airFactory
单位描述=-全副武装<br />-能攻击地面单位<br />-对空能力较弱|
|-
HP=6000|
| builtFrom_{NUM}_pos: || float || Order this build link appears in UI. Using canBuild instead is more recommended. || builtFrom_1_pos: 0.1
Speed=0.30|
|-
Attack=120x4/2.66s, 60x2/3.16s|
| builtFrom_{NUM}_forceNano: || bool || Build as if this is a building if true. (even if it's a unit) || builtFrom_1_forceNano: true
Range=310|
|-
}}
| builtFrom_{NUM}_isLocked: || LogicBoolean || If true this unit cannot be built in this build link. (can be conditioned if logicBooleans are used) || builtFrom_1_isLocked: if self.hp(lessThan=100)
{{单位横幅|
|-
图片名=概念型悬浮坦克_高清.png|
| builtFrom_{NUM}_isLockedMessage: || LocaleString || Message shown when this build link is locked. || builtFrom_1_isLockedMessage: -Needs more population
单位名=概念型悬浮坦克|
|-
价格=21000|
| exit_x: || float || Where created or unloaded units appears from the transport or building. Defaults to 0. || exit_x: 0
单位地址=概念型悬浮坦克|
|-
单位描述=-高度全副武装并带有护盾<br />-可以攻击地面和空中单位<br />-能在水上移动|
| exit_y: || float || Where created or unloaded units appears from the transport or building. Defaults to 5. || exit_x: 5
HP=3500|
|-
Shield=5000|
| exit_dirOffset: || float || Defaults to 180 for units and 0 for buildings. Defines the exit direction of created or unloaded units. || exit_dirOffset: 140
Speed=0.60|
|-
Range=180|
| exit_heightOffset: || float || Defaults to 0. Defines the height where created or unloaded units appears. || exit_heightOffset: 16
}}
|-
{{单位横幅|
| exit_moveAwayAmount: || float || Defaults to 70. Defines the distance that created or unloaded units moves from this unit. || exit_moveAwayAmount: 10
图片名=实验型战斗蜘蛛_高清.png|
|-
单位名=实验型战斗蜘蛛|
| exitHeightIgnoreParent || bool || Ignores parent height for exit height; useful for separating attachments with their parents for building ||
价格=70000|
|-
单位地址=实验型战斗蜘蛛|
| #==== || #==== || Death Keys ||
单位描述=-拥有超强防御,但移动缓慢<br />-能建造单位与建筑物<br />-自动修复附近的单位<br />-自带激光防御<br />-能在水上移动<br />-自我修复并内置资源制造仪<br />-死亡后核爆 (如果未禁止核弹)|
|-
HP=10000|
| dieOnConstruct: || bool || Deletes this unit when it starts to build if true. (target building/unit likely will need selfBuildRate set) || dieOnConstruct: true
Income=+$18|
|-
Speed=0.5|
| dieOnZeroEnergy: || bool || Kills this unit if energy level reaches zero when true. || dieOnZeroEnergy: true
Attack=80x2/0.66s, 190/2.16s|
|-
Range=290|
| numBitsOnDeath: || int || Defines the number of scattered bit fragments when this unit dies. || numBitsOnDeath: 20
}}
|-
{{单位横幅|
| nukeOnDeath: || bool || Unit will spawn a nuke detonation built-in effect when dies if true. || nukeOnDeath: true
图片名=模块化蜘蛛_高清.png|
|-
单位名=模块化蜘蛛|
| nukeOnDeathRange: || float || Defines the nuke effect range when using nukeOnDeath. || nukeOnDeathRange: 140
价格=90000|
|-
单位地址=模块化蜘蛛|
| nukeOnDeathDamage: || float || Defines the nuke effect area damage when using nukeOnDeath. || nukeOnDeathDamage: 2000
单位描述=-最多可在顶部建造6个自定义炮塔或模块<br />-装甲非常重但速度较慢<br />-如果附加了任何武器则会降低基本速度<br />-可以建造单位和建筑物<br />-可以在附近的单位进行自动维修<br />-可以在附近的单位进行自动维修<br />-内置建造者<br />-死亡后核爆 (如果未禁止核弹)|
|-
HP=10000|
| nukeOnDeathDisableWhenNoNuke: || bool || Defaults to false. If true this unit will not explode with nuke when nukes are disabled in skirmish maps. || nukeOnDeathDisableWhenNoNuke: true
Shield=5000|
|-
Income=+$30|
| fireTurretXAtSelfOnDeath: || turret ref || Auto-shoot a specific turret when this unit dies. || fireTurretXAtSelfOnDeath: turret_1
Speed=0.60|
|-
Range=290|
| explodeOnDeath: || bool || Defaults to true. Disables the unit death explode built-in effect if false. || explodeOnDeath: false
}}
|-
{{单位横幅|
| explodeOnDeathGroundCollision: || boolean || Defaults to true. Disables the explode built-in effect on death when unit touches ground if false. || explodeOnDeathGroundCollision: false
图片名=实验悬浮型气垫船_高清.png|
|-
单位名=实验悬浮型气垫船|
| explodeTypeOnDeath: || preset effects || options: verysmall, small, normal, large, largeUnit, building, buildingNoShockwaveOrSmoke, verylargeBuilding ||
价格=140000|
|-
单位地址=实验悬浮型气垫船|
| effectOnDeath: || effect(s) ref || Spawns built-in or custom effects when unit dies. || effectOnDeath: shockwave, CUSTOM:pieces*3, CUSTOM:deathSound
单位描述=-可建造单位<br />-对地与对空攻击<br />-反核防御<br />-可添加瞬移模块<br />-可运输单位<br />-部署可获得额外的射程、火力和护盾|
|-
HP=8000|
| effectOnDeathGroundCollision: || effect(s) ref || Like effectOnDeath but when unit touches ground. Useful for flying units. || effectOnDeathGroundCollision: CUSTOM:bigExplosion
Income=+$30|
|-
Speed=0.40|
| unitsSpawnedOnDeath: || string(s) || Spawns these units when dies. Comma separated unit identifiers. || unitsSpawnedOnDeath: tank*5, hoverTank
Attack=35x2/0.41s, 350/2.16s|
|-
Range=320|
| unitsSpawnedOnDeath_setToTeamOfLastAttacker: || bool || Units spawned on death will appear on the last attacker team if true. || unitsSpawnedOnDeath_setToTeamOfLastAttacker: true
}}-->
|-
<div>Credits&nbsp;</div>
| hideScorchMark: || bool || Disables the death scorch mark leaved when unit dies if true. || hideScorchMark: true
<div style="width:400px;border:1px solid black;">
|-
<div style="width:calc(350/140000*100%);background: green;text-align: right;">350</div>
| soundOnDeath: || string(s) || Sets a custom sound for this unit death. || soundOnDeath: tankExplosion1.ogg, tankExplosion2.ogg
|-
| effectOnDeathIfUnbuilt: || effect(s) ref || If the unit was not completed, and is destroyed, play this effect. Defaults to effectOnDeath || effectOnDeathIfUnbuilt: CUSTOM:implode
|-
| #==== || #==== || Action Keys ||
|-
| autoTriggerCooldownTime: || time (seconds) || Post automatic action cooldown (Not detection cooldown). Defaults to 1s. Warning: Setting this too low for many units might effect performance depending on the action effects. ||
|-
| autoTriggerCooldownTime_allowDangerousHighCPU: || bool || Allows for auto action cooldown lower than 0.2s. Default to false. Not recommended. ||
|-
| autoTriggerCheckRate || enum || options: everyFrame (default), every4Frames, every8Frames. Note: all triggers regardless of check rate are checked when first created and after an auto trigger cooldown. Note: Adding [core]autoTriggerCheckRate:every8Frames to all-units.template could have a large performance boost for mods with complex autoTriggers. || autoTriggerCheckRate:every8Frames
|-
| updateUnitMemory || memory || Faster memory update than [action_#] setUnitMemory. Useful on many applications. ||
|-
| updateUnitMemoryRate || int || Sets how often the memory is updated. Defaults at 1s. settings it to 0 will update memory every frame. ||
|-
| @memory || || A template-friendly method of defineUnitMemory. Declare name followed by type, separated by a colon || @memory fish:unit
|-
| || || || @memory bullets:number
|-
| || || Add a pair of square brackets for array memory type || @memory myTargets:unit[]
|-
| #==== || #==== || Deprecated Keys (can be used but there are better ways) ||
|-
| action_#_convertTo: || string || Deprecated in 1.13, use [action_x] sections instead || action_1_convertTo: customTank_2
|-
| action_#_pos: || float || Order action appears in UI || action_1_pos: 0.1
|-
| action_#_price: || int || The price of your action for the unit. (All your sub actions will be linked to the # you use) || action_1_price: 1000
|-
| action_#_text: || string || A display text when you select your unit's action, used to explain it's purpose. || action_1_text: Upgrade to Custom Tank 2
|-
| action_#_description: || string || The action description. || action_1_description: -Converts the tank
|-
| action_#_addEnergy: || float || Adds energy to unit. Has no effect unless energyMax is set || action_1_addEnergy: 10
|-
| action_#_whenBuilding_cannotMove: || bool || Stops unit moving while action is being applied. Useful for deploy like actions. || action_1_whenBuilding_cannotMove: true
|-
| canBuild_#_name/pos/isLocked: || string || Use canBuild section instead. || canBuild_1_name: tank
|}
</div>
==<nowiki>[canBuild_NAME]</nowiki>==
 
<div style="overflow:auto;">
<div>Health&nbsp;</div>
{| class="wikitable" style="background-color:black;color:yellow;"
<div style="width:400px;border:1px solid black;">
| Code || Value Type || Description || Example
<div style="width:calc(210/10000*100%);background: lightgreen;text-align: right;">210</div>
|-
| name: || string(s) || "List of unit identifiers this unit can create. Can be buildings or units. Add ""setRally"" to create a rally button" || name: setRally, tank, hoverTank, heavyTank
|-
| pos: || float || Order build link appears in this unit UI. || pos: 0.1
|-
| tech: || int || Tech level. Mostly just affects build link colour in this unit UI. Defaults to 1. || tech: 2
|-
| forceNano: || bool || Builds target as if it was a building if true. (even if it's a unit) || forceNano: true
|-
| isVisible: || LogicBoolean || Hide this build link if true in this unit UI. || isVisible: if not self.energy(greaterThan=100)
|-
| isLocked: || LogicBoolean || Dynamically locks this build option and shows isLockedMessage if true. || isLocked: if self.hp(lessThan=100)
|-
| isLockedMessage: || string || Set to tell to players why a unit is locked. || isLockedMessage: -Needs 2 Barracks
|-
| isLockedMessage_{LANG}: || string || LANG = ISO 639-1 Code to show this text instead when game is in this language. || isLockedMessage_es: -Necesita 2 Cuarteles
|-
| isLockedAlt: || LogicBoolean || Another reason for this to be locked. Just allows a different message to be shown. || isLockedAlt: if self.energy(greaterThan=90)
|-
| isLockedAltMessage: || string || Message for isLockedAlt. || isLockedAltMessage: -Needs less energy
|-
| isLockedAlt2: || LogicBoolean || Like isLockedAlt but to show one more message. || isLockedAlt2: if self.isMoving()
|-
| isLockedAlt2Message: || string || Message for isLockedAlt2. || isLockedAlt2Message: -Needs to be quiet
|-
| addResources: || price(s) || Adds these resources to self when placing the building or producing the unit. || addResources: ammo=5, setFlag=1
|-
| price: || price(s) || Overrides builded units/buildings price. Defaults to target unit prices. || price: credits=1000, ammo=5
|-
| isGuiBlinking: || LogicBoolean || Generates a blinking effect in UI if true. || isGuiBlinking: true
|}
</div>
==<nowiki>[graphics]</nowiki>==
 
<div style="overflow:auto;">
<div>Speed&nbsp;</div>
{| class="wikitable" style="background-color:black;color:yellow;"
<div style="width:400px;border:1px solid black;">
| Code || Value Type || Description || Example
<div style="width:calc(1.1/2.5*100%);background: lightblue;text-align: right;">1.1</div>
|-
| #==== || #==== || Necessary code ||
|-
| || file (image) || image: ||
|-
| #==== || #==== || Common Keys ||
|-
| image: || file (image) || File path to png image. ||
|-
| image_back: || file (image) || An optional image drawn behind other units. Useful for factories that units exit ||
|-
| image_shield || file (image) || Image to show as a custom shield ||
|-
| image_wreak: || file (image) || Image to use when unit dies. Can be NONE to leave no wreak ||
|-
| image_offsetX: || int || Use this to adjust the graphics of a unit if it is too far off one side ||
|-
| image_offsetY: || int || Use this to adjust the graphics of a unit if it is too far off one side ||
|-
| image_offsetH: || int || Use this to adjust the height of the graphic, especially when using decals ||
|-
| image_floatingPointSize || int || Fixes of by 1 pixel sizing for images with widths and/or height that has odd value ||
|-
| isVisible || logic || If false will hide the unit. ||
|-
| isVisibleToEnemies || bool || Only visible to player and allies when false. Recommend with showOnMinimapToEnemies. Useful for stealth units. ||
|-
| teamColoringMode || || How pixels are used for team coloring, options: pureGreen (default), hueAdd, hueShift, disabled ||
|-
| teamColorsUseHue: || bool || False: Green pixels on unit gets converted to team color. True: Whole unit is tinted the team colour. Defaults to false ||
|-
| scaleImagesTo: || float || Resize image to fit this value in pixels. Effects leg, and shadow images as well. ||
|-
| imageScale: || float || Resize image. Defaults to 1. Effects leg, and shadow images as well. ||
|-
| drawLayer: || string || Land units normally default to ground or ground2 if transport. || wreaks, underwater, bottom, ground, ground2, experimentals, air, top
|-
| whenBeingBuiltMakeTransparentTill || float || How long the transparent effect is applied to incomplete units, set to 0 to disable completely || Default: 1
|-
| icon_zoomed_out || file (image) || ||
|-
| icon_zoomed_out_neverShow || bool || ||
|-
| icon_build || file (image) || Displays icon of the unit on Build Panel ||
|-
| #==== || #==== || Turrets (images can also be set on each turret) ||
|-
| image_turret: || file (image) || Default image for all turrets, can also be set per turret ||
|-
| teamColorsOnTurret || bool || Defaults false. Apply team colours on turret as well. Also effects pre-turret images ||
|-
| scaleTurretImagesTo: || float || Will cause crash if image_turret is not specified, even if image is set per turret ||
|-
| lock_body_rotation_with_main_turret: || bool || Locks body image locked to first turret's direction ||
|-
| lock_leg_rotation_with_main_turret || bool || Locks legs and arms to first turret's direction ||
|-
| #==== || #==== || Shadow ||
|-
| image_shadow: || file (image) || Image file, NONE, or AUTO. (AUTO will use image and make it transparent black only.) ||
|-
| shadowOffsetX: || float || ||
|-
| shadowOffsetY: || float || ||
|-
| image_shadow_frames || bool || If shadow image should use frame animation of main image ||
|-
| lock_shadow_rotation_with_main_turret: || bool || Locks body image shadow locked to first turret's direction ||
|-
| #==== || #==== || Effects and animation ||
|-
| total_frames || int || Defaults to 1. Animations require this. ||
|-
| frame_width: || int || Calculated for you if total frames is set, but can be overridden ||
|-
| frame_height: || int || Defaults to image height ||
|-
| default_frame || int || Default frame when not playing an animation ||
|-
| splastEffect: || bool || True to create a water wave effect when over water. Default false ||
|-
| dustEffect: || bool || True to create a dust effect when over land. Default false ||
|-
| splastEffectReverse: || bool || True to also create effect when unit is reversing ||
|-
| dustEffectReverse: || bool || True to also create effect when unit is reversing ||
|-
| movementEffect || effect || Custom movement effect, can be anything || eg: movementEffect: smoke, CUSTOM:fastDust*2, CUSTOM:pop*5
|-
| movementEffectReverse || effect || ||
|-
| movementEffectRate || float || ||
|-
| movementEffectReverseFlipEffects || bool || Create effect as if unit has rotated 180 when reversing ||
|-
| repairEffect || effect ref || Custom movement effect, can be anything. Replaces default effect from builders ||
|-
| repairEffectAtTarget || effect || ||
|-
| repairEffectRate || int || Defaults to 5 ||
|-
| reclaimEffect || effect || ||
|-
| reclaimEffectAtTarget || effect || ||
|-
| reclaimEffectRate || int || ||
|-
| rotate_with_direction: || bool || Defaults to true. Makes unit body image locked to 0 degrees when false. Often used with animation_direction_* ||
|-
| animation_direction_units: || float || 45 for 8 directions, 90 for 4 direction animation. Used with rotate_with_direction:false ||
|-
| animation_direction_strideX: || int || Animation frames to offset on direction change. ||
|-
| animation_direction_strideY: || int || Animation frames to offset on direction change. Used with frame_height. ||
|-
| animation_direction_starting: || float || Direction for first frame ||
|-
| disableLowHpFire || bool || ||
|-
| disableLowHpSmoke || || ||
|-
| showTransportBar: || bool || ||
|-
| showHealthBar || bool || ||
|-
| showEnergyBar || bool || ||
|-
| showShieldBar || bool || ||
|-
| showQueueBar || bool || ||
|-
| showShotDelayBar || bool || ||
|-
| showSelectionIndicator || bool || Shows select circle/box if true ||
|-
| #==== || #==== || Deprecated Keys (can be used but there are better, more adaptable ways) ||
|-
| animation_TYPE_start: || int || TYPE can be set to: attack, moving, idle. Use [animation] section instead for more control || animation_moving_start: 0
|-
| animation_TYPE_end: || int || End frame, must be larger then start || animation_moving_end: 3
|-
| animation_TYPE_scale_start: || float || Scale unit image. Defaults to 1. Useful for bio units or breathing effects. ||
|-
| animation_TYPE_scale_end: || float || Scale unit image. Defaults to 1. Useful for bio units or breathing effects. ||
|-
| animation_TYPE_speed: || float || Delay for each frame of animation. Larger values cause slower animation ||
|-
| animation_TYPE_pingPong: || bool || Play animation in reverse before repeating. Useful with scale_start/scale_end ||
|}
</div>
==<nowiki>[attack]</nowiki>==
 
<div style="overflow:auto;">
<div>Damage&nbsp;</div>
{| class="wikitable" style="background-color:black;color:yellow;"
<div style="width:400px;border:1px solid black;">
| Code || Value Type || Description || Example
<div style="width:calc(25/5400*100%);background: red;text-align: right;">25</div>
|-
| canAttack: || bool || If set to false, can not attack any unit. Regards of other canAttack options below. ||
|-
| canAttackFlyingUnits: || LogicBoolean || can also be narrowed per turret. Note: not required if canAttack is false. ||
|-
| canAttackLandUnits: || LogicBoolean || can also be narrowed per turret ||
|-
| canAttackUnderwaterUnits: || LogicBoolean || can also be narrowed per turret ||
|-
| maxAttackRange: || float || (multiplied by globalScale) ||
|-
| canAttackNotTouchingWaterUnits: || LogicBoolean || Default true. If false unit can only attack units in contact with the water. Used for units with torpedos. (can also be set per turret) ||
|-
| canOnlyAttackUnitsWithTags || tags || Will only attack units that has the specified tags. ||
|-
| canOnlyAttackUnitsWithoutTags || tags || Can only attack units without the specified tags. ||
|-
| turretMultiTargeting || bool || Allow each turrets to fire at a different target at the same time. Very useful if [turret]limitingAngle is used ||
|-
| isMelee: || bool || Used with a low attack range (like maxAttackRange: 9) makes src and target radius get added to range, and effects AI. ||
|-
| meleeEngangementDistance || int || Makes unit move to attack nearby units. Defaults to 250 for melee, and 0 for non melee (Works even if non-melee, but might be unexpected to players) ||
|-
| turretRotateWithBody || bool || Are all turrets rotated when body rotates. Defaults to true ||
|-
| attackMovement: || string || normal/bomber. bomber attack movement will retreat when energy runs out ||
|-
| dieOnAttack: || bool || Will die when it attacks. ||
|-
| isFixedFiring: || bool || Must aim body at target to shoot. Will often make the unit need to stop before it can aim and shoot. ||
|-
| aimOffsetSpread: || float || Offset each shot multiplied by target radius. Defaults to 0.6 || aimOffsetSpread:0 will make unit always attack center
|-
| stopTargetingAfterFiring || bool || Unit stops targeting after firing a shot. Rarely used or needed. ||
|-
| disablePassiveTargeting: || bool || Unit only attacks manually ordered target. Rarely used or needed. ||
|-
| showRangeUIGuide || bool || Will it show the range indicator. Useful for showing ranges in radar and related structures. ||
|-
| shootDelayMultiplier || float || Defaults to 1. Can be dynamically changed with setUnitStats ||
|-
| shootDamageMultiplier || float || Defaults to 1. Can be dynamically changed with setUnitStats ||
|-
| #==== || #==== || Deprecated Keys - can be used but better to set these per turret ||
|-
| turretSize: || float || (multiplied by globalScale) ||
|-
| turretTurnSpeed: || float || ||
|-
| shootDelay: || float || Global delay, can also use delay on each turret ||
|}
</div>
==<nowiki>[turret_NAME]</nowiki>==
 
<div style="overflow:auto;">
{{DISPLAYTITLE:单位名称}}
{| class="wikitable" style="background-color:black;color:yellow;"
 
| Code || Value Type || Description || Example
'''单位名称'''(单位英文名)是一种高级的防空单位。
{| style="float:right;border:1px solid black" class="wikitable"
|+基本信息
! colspan="3" |'''''(单位名称)'''''
|-
| #==== || #==== || Necessary Code ||
! colspan="3" |''(图片文件)''
|-
| || float || x: ||
|价格
| colspan="2" |''(单位价格)''
|-
| || float || y: ||
|生命值
| colspan="2" |''(生命值)''
|-
| #==== || #==== || Positioning/Stats ||
|质量
| colspan="2" |''(单位质量)''
|-
| x: || float || ||
| rowspan="2" |速度
|旋转速度
|''(旋转速度)''
|-
| y: || float || ||
|移动速度
|''(移动速度)''
|-
| copyFrom: || turret ref || Copy all values from another turret as defaut values for this turret || copyFrom: 1
|科技等级
| colspan="2" |''T2科技''
|-
| projectile || projectile ref || Projectile fired from this turret. || eg: projectile: torpedo
| colspan="3" |
|-
''
| altProjectile || projectile ref || Alternative projectile fired from this turret when altProjectileCondition is true ||
* 额外信息
|-
''
| altProjectileCondition || LogicBoolean || Used with altProjectile ||
|-
| barrelX || float || Defaults to 0. Controls horizontal position for projectile spawn. ||
|-
| barrelY || float || Defaults to size. Note: size and barrelY have the same meaning ||
|-
| barrelHeight || float || Height of barrel in 3d. Effect projectile and shoot flame starting height ||
|-
| height: || float || Height of the unit in 3D, to be used with decals ||
|-
| size: || float || Controls the distance between the center of the turret and the point from where projectiles spawn. || size: 5
|-
| turnSpeed || float || Max turn speed of the turret ||
|-
| turnSpeedAcceleration || float || Defaults to disabled, and full turn speed is used. ||
|-
| turnSpeedDeceleration || float || Defaults to turnSpeedAcceleration. Setting this higher than turn acceleration might allow faster targets to be hit ||
|-
| idleDir || float || Defaults to 0 ||
|-
| idleDirReversing || float || Defaults to idleDir+180 unless attached to another turret (as attached turret will often be rotating when reversing) ||
|-
| shouldResetTurret: || bool || Defaults true. False to disable the reseting turret angle when idle ||
|-
| idleSweepAngle || int || "Disabled by default. Controls how far the turret will ""look"" left and right" ||
|-
| idleSweepDelay || float || Controls the delay between idleSweep movements ||
|-
| idleSweepSpeed || float || Controls the speed with which the turret sweeps when idle ||
|-
| idleSweepCondition || LogicBoolean || Disable idle sweep if false ||
|-
| idleSweepAddRandomDelay || float || Default 1-20 depends on idleSweepDelay, used to stop sweep syncing up with other units ||
|-
| idleSweepAddRandomAngle || int || Default 0 ||
|-
| attachedTo: || turret ref || Id of another turret to attach to, will be positioned relative to it, and rotate with it. ||
|-
| slave: || bool || Locks this turret's direction and shot cooldown to attached turret. Often used with warmup for multiple barrel guns ||
|-
| isMainNanoTurret: || bool || Defaults to false. Turret to use for creating buildings, etc. should only be true on one turret, and should have canShoot set to false ||
|-
| energyUsage: || float || Required energy to fire weapon. Same as resourceUsage: energy=X ||
|-
| resourceUsage || price || can be in credits/energy/hp/shield/ammo. Stops firing if not met || resourceUsage: credits=5, energy=5, hp=100, shield=5, ammo=1
|-
| #==== || #==== || Timing ||
|-
| delay: || float || Override global shootDelay for this turret ||
|-
| linkDelayWithTurret || turret ref || When this other turret fires the cooldown delay on this turret will be reset/removed ||
|-
| warmup: || float || Delay before firing a shot. ||
|-
| warmupCallDownRate || float || Rate to reduce warmup when turret is not ready to fire at any targets ||
|-
| warmupNoReset || bool || Defaults to false. When true warmup is not reset after firing a shot and turret doesn't wait for warnup. Used with warmupCallDownRate and warmupShootDelayTransfer. ||
|-
| warmupShootDelayTransfer || float || Defaults to 0, amount to reduces the next shot delay depending on warmup. When used with warmupNoReset, can make a each shot faster. ||
|-
| #==== || #==== || On Shoot ||
|-
| onShoot_freezeBodyMovementFor: || || Freezes body movement while shooting. ||
|-
| barrelOffsetX_onOddShots: || float || 0 by default. Sets a barrelX offset only during odd numbered shots, useful for twin-barreled units. Use with barrelX ||
|-
| #==== || #==== || Targeting control ||
|-
| aimOffsetSpread: || || ||
|-
| canShoot: || bool || Defaults to true ||
|-
| canAttackFlyingUnits: || LogicBoolean || Narrows targeting for this turret, note targeting for the whole unit in [attack] is applied first. (so you can only use this to target less not more) ||
|-
| canAttackLandUnits: || LogicBoolean || ||
|-
| canAttackUnderwaterUnits: || LogicBoolean || ||
|-
| canAttackNotTouchingWaterUnits: || LogicBoolean || Default true. If false unit can only attack units in contact with the water. Used for units with torpedos. ||
|-
| canOnlyAttackUnitsWithTags: || tags || ||
|-
| canOnlyAttackUnitsWithoutTags: || tags || ||
|-
| canAttackCondition: || LogicBoolean || Normally, used to optionally disable a turret based on a LogicBoolean. Eg: this unit's height || canAttackCondition: if not self.flying
|-
| canAttackMaxAngle: || float || Max angle to target for turret to be allowed for fire. Defaults to 5, don't set lower. Can be set to 181 for turrets that don't need to turn to fire missiles. ||
|-
| clearTurretTargetAfterFiring: || bool || Clears the turrets sub-target when using multi-targeting ||
|-
| limitingRange: || float || Make this turret have less range than the maxAttackRange. Do not apply this to all turrets change maxAttackRange instead. ||
|-
| limitingAngle || || Linked with idleDir. Turret will only be able to fire at units +/- this angle. ||
|-
| limitingMinRange: || || Sets minimum range for turret. || limitingMinRange: 200
|-
| interceptProjectiles_withTags: || || Currently used with anti-nuke units. ||
|-
| interceptProjectiles_andTargetingGroundUnderDistance: || || ||
|-
| interceptProjectiles_andUnderDistance: || || Defaults to 2000, distance inflight before firing ||
|-
| interceptProjectiles_andOverHeight: || || Defaults to 0 ||
|-
| laserDefenceEnergyUse: || float || Set to enable a projectile laser defence from this turret. Should also set the energyMax in core. ||
|-
| #==== || #==== || Graphics and effects ||
|-
| invisible: || LogicBoolean || Don't render this turret, but still can shoot, etc. ||
|-
| image: || file (image) || Use custom image. Overrides unit's main turret image ||
|-
| image_applyTeamColors || bool || ||
|-
| image_drawOffsetX || float || ||
|-
| image_drawOffsetY || float || ||
|-
| "chargeEffectImage: || || ||
|-
| file (image) || Used with warmup. Shows a scaling effect image on turret barrel when charging. || ||
|-
| warmupStartEffect || effect ref || ||
|-
| shoot_sound: || string || Can be linked to an .ogg or .wav file, or one of the default game sounds (list at bottom of reference) || shoot_sound: tank_firing | shoot_sound: missile.wav | shoot_sound: ROOT:audio/shoot.ogg
|-
| shoot_sound_vol: || float || ||
|-
| shoot_flame: || effects || Current types are: small, large, smoke, shockwave, or CUSTOM: effectSectionName || eg: shoot_flame: smoke, CUSTOM:lightFade, CUSTOM:pop*5
|-
| shoot_light || color || ||
|-
| idleSpin: || float || Spin rate when idle, used on missile turrets ||
|-
| onShoot_playAnimation || animation ref || Play a custom animation from an [animation] section after firing this turret ||
|-
| onShoot_triggerActions || action refs || Trigger these actions each time this turret fires ||
|-
| onShoot_freezeBodyMovementFor || time || ||
|-
| unloadUpToXUnitsAndGiveAttackOrder || int || Unloads X units at turret barrel locations and gives them the attack order of turret target ||
|-
| recoilOffset || float || Push turret forward or back after firing for a recoil effect. Value in pixels. ||
|-
| recoilOutTime || float || Time to get to offset position after firing ||
|-
| recoilReturnTime || float || Time to return to default position ||
|-
| showRangeUIGuide || bool || ||
|}
</div>
 
==<nowiki>[projectile_NAME]</nowiki>==
==来源==
<div style="overflow:auto;">
来源
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|+获取
! colspan="2" |(单位名称)
|-
| #==== || #==== || Necessary Code ||
| rowspan="1" | 人为建造
| 建造地点
|-
| || int || directDamage: or areaDamage: ||
| rowspan="1" | 自然生成
| 生成地图
|-
| || || life: ||
|-
| #==== || #==== || Core ||
|-
| life: || || How long till this projectile gets removed if it hasn't hit a target, 300 might be a good starting point, change depending on speed and range ||
|-
| deflectionPower: || float || Defaults to 1. Energy needed for laser defence to deflect. -1 to disable deflection (only disable for special weapons like flames) ||
|-
| explodeOnEndOfLife || bool || Default to false. True to explode at end of life with all side effects and area damage instead of disappearing. Good for making area-denial weapons. ||
|-
| autoTargetingOnDeadTarget: || bool || Retarget to nearby unit if target dies while in transit ||
|-
| autoTargetingOnDeadTargetRange || int || The range which it will select a new target if old target has died ||
|-
| autoTargetingOnDeadTargetLead || float || The lead it will try to have on the new target ||
|-
| unloadUpToXUnitsFromSource || int || Unload X units from source unit, to projectile explode location ||
|-
| teleportSource || bool || Move unit that shot this projectile to projectile explode location ||
|-
| spawnUnit || unit types || Spawn new units of this type at projectile explode location || eg: spawnUnit: heavyTank, tank*5, hoverTank(offsetX=10)
|-
| spawnProjectilesOnEndOfLife || projectile ref || Spawns new projectiles on end of life, useful for secondary projectiles || spawnProjectilesOnEndOfLife: torpedo_split(offsetDir=90), torpedo_split(offsetDir=-90)
|-
| spawnProjectilesOnExplode || projectile ref || Projectiles to spawns when this projectile hits it's target ||
|-
| spawnProjectilesOnCreate || || Spawns projectiles on creation of this projectile, useful for making true shotgun-like projectile spread ||
|-
| convertHitToSourceTeam || bool || Convert units hit to the team that fired this projectile. Useful to make capturing systems ||
|-
| tags || tags || Useful for projectile interceptions (e.g. Nuke and Anti-Nuke Interaction) ||
|-
| flameWeapon: || bool || Generates small flames on hit (only cosmetic) ||
|-
| delayedStartTimer || float || Hide for x time before showing and updating effect. ||
|-
| #==== || #==== || Damage ||
|-
| directDamage: || int || Damage to target unit on hit. Does not work with targetGround:true as it won't have a clear unit to target ||
|-
| areaDamage: || int || Damages on arrival of target with an area effect, use areaRadius to adjust size of damage. targetGround needs this to damage ||
|-
| areaRadius: || float || How wide areaDamage effects. Note this drops off (unless areaDamageNoFalloff is used) ||
|-
| areaDamageNoFalloff || bool || Removes the falloff from areaDamage ||
|-
| areaRadiusFromEdge || bool || Applies damage from edge of units instead of center. Mostly effects large units. ||
|-
| areaExpandTime || float || Applies area damage as an expanding blast wave rather than instantly. Useful for nuke projectiles ||
|-
| areaHitAirAndLandAtSameTime || bool || Defaults to false ||
|-
| areaHitUnderwaterAlways || bool || Defaults to false ||
|-
| areaIgnoreUnitsCloserThan || int || Units closer than this range aren't effected. Rarely needed. Not recommended for normal projectiles. ||
|-
| buildingDamageMultiplier || float || Defaults to 1 ||
|-
| shieldDamageMultiplier || float || Defaults to 1. || eg: 0 to do no damage to shields and 2 to do double damage
|-
| shieldDefectionMultiplier || float || Defaults to 1. The amount of shield to bypass || eg: 0 to ignore shields and directly damage hull
|-
| hullDamageMultiplier || float || Defaults to 1. Can be used to create EMP weapons that affect shields only || eg: 0 to ignore hull and only damage shields
|-
| ignoreParentShootDamageMultiplier || bool || ||
|-
| armourIgnoreAmount || int || Amount of armour to ignore on target and do damage as if this armour was not there ||
|-
| friendlyFire || bool/string || Lets area effect projectiles damage own team units (can't damage allies). Useful for nuke-like weapons || friendlyFire: false / friendlyFire: true / friendlyFire: only-ignoreEnemy
|-
| mutatorX_ifUnitWithTags || tags || Applies mutators to this projectile if target has corresponding tags || eg: mutator1_ifUnitWithTags: infantry
|-
| mutatorX_ifUnitWithoutTags || tags || Same as ifUnitWithTags, but applies if target doesn't have the set tags || eg: mutator1_ifUnitWithoutTags: strongArmour
|-
| mutatorX_directDamageMultiplier || float || Changes directDamage. Defaults to 1. Be careful not to confuse players using this as the effect may not be clear. Use amour instead when possible ||
|-
| mutatorX_areaDamageMultiplier || float || Same as directDamageMultiplier but for areaDamage. Defaults to 1. ||
|-
| mutatorX_changedExplodeEffect || effect || Change explode effect if this mutator is active. Eg make a bounce off amour effect. Helps to make the damage change more clear to players (Doesn't work with targetGround.) ||
|-
| mutatorX_addResourcesDirectHit || resource || Add resource to all hit units. Warning: Be careful not be break units from other mods by adding random resources or energy to them that they don't expect. ||
|-
| mutatorX_addResourcesAreaHit || resource || ||
|-
| #==== || #==== || Movement ||
|-
| targetGround || bool || Target ground, and don't home in on target. Note: only areaDamage is applied if targeting ground. ||
|-
| targetGround_includeTargetHeight || bool || Default false. for area affect AA weapons ||
|-
| targetGroundHeightOffset || float || Default 0. for shooting over or under a target. Useful for projectiles that split and rain down. ||
|-
| speed: || float || Projectile default travel speed ||
|-
| targetSpeed: || float || Accelerate to this speed ||
|-
| targetSpeedAcceleration || float || Controls the speed rampup for targetSpeed ||
|-
| ballistic: || bool || Makes projectiles fly up into the air and come down, instead of going in a straight line ||
|-
| ballistic_delaymove_height: || float || ||
|-
| ballistic_height: || float || ||
|-
| targetGroundSpread: || float || Randomly makes the shot inaccurate by this amount. Also used by weapons like the flamethrower ||
|-
| speedSpread: || float || Randomly change the starting projectile speed by this amount ||
|-
| instant || bool || Hit target instantly ||
|-
| instantReuseLast: || bool || Recycles last projectile fired, only one projectile ever exists. Can turn lasers into beam weapons by using lower rate of fire and setting this to true ||
|-
| instantReuseLast_alsoChangeTurretAim || bool || Make turret's aim include last projectile's spread and sweep offsets, useful for beam weapons ||
|-
| instantReuseLast_keepAreaDamageList || bool || Default false. Keeping the list was the normal behaviour in 1.13 making area damage not apply a second time but this is not useful. Use this only if you want the old behaviour. ||
|-
| interceptProjectile_removeTargetLifeOnly || bool || Defaults to false. When false projectiles are just removed. Could be true to make hit projectiles explode or split when hit ||
|-
| disableLeadTargeting || bool || Disable the lead targeting calculations when aiming at a moving target. Defaults false. ||
|-
| leadTargetingSpeedCalculation || float || The expected speed of this projectile for targetGround lead target calculation. Defaults to 'targetSpeed' if set otherwise 'speed'. ||
|-
| initialUnguidedSpeedHeight || || Sets vertical speed for projectiles with targetGround. Use gravity to make smooth arching projectiles ||
|-
| gravity: || || Controls the pull for projectiles that target ground. Use together with initialUnguidedSpeedHeight ||
|-
| turnSpeed || float || Limits the turn speed of a projectile, making them inaccurate even with directDamage ||
|-
| wobbleAmplitude || float || How wide the projectile will wobble ||
|-
| wobbleFrequency || float || How often the projectile will wobble ||
|-
| pushForce || float || Push (or pull with a negative value) the units that get hit. Divided by target mass ||
|-
| pushVelocity || float || Push (or pull with a negative value) the units that get hit. Ignores target mass ||
|-
| moveWithParent || bool || Move projectile as parent moves. Useful for beam effects that need to stick to source turret. ||
|-
| sweepOffset || float || Useful for beam effects. ||
|-
| sweepOffsetFromTargetRadius || float || Add to sweep offset by factor of target's radius. 0.4 would be 40% || sweepOffsetFromTargetRadius: 0.4
|-
| sweepSpeed || float || Useful for beam effects. ||
|-
| retargetingInFlight || bool || Can retarget a new target mid-flight, perfect for flak-style weapons and projectiles that collide ||
|-
| retargetingInFlightSearchDelay || float/time || How long between searching for new targets. Default 5 ||
|-
| retargetingInFlightSearchRange || int || Range which targets are reselected. Default 120 ||
|-
| retargetingInFlightSearchLead || float || The lead of the projectile to try to hit the target. Default 15 ||
|-
| retargetingInFlightSearchOnlyTags || tag ref || Only retarget units with these tags ||
|-
| #==== || #==== || Graphics and effects ||
|-
| color || color || Recolors this projectile using a hex value. || color: #bebe50
|-
| invisible || bool || ||
|-
| image: || file (image) || Use custom image. Overrides drawType and frame ||
|-
| drawType || int || Built-in image to use. 0:projectiles.png 1:projectiles_large.png 2:projectiles2.png || drawType:1
|-
| drawSize: || float || Scale image. Defaults to 1 ||
|-
| frame || int || Built-in image frame to use, starts at zero. ||
|-
| hitSound: || bool || Default true ||
|-
| explodeEffect || effect ref list || || explodeEffect: smallExplosion, CUSTOM:myExplodeEffect
|-
| explodeEffectOnShield || effect ref list || Use this effect if shield is active on target ||
|-
| teamColorRatio || float || Mix 0-1 of team colour into color field ||
|-
| teamColorRatio_sourceRatio || float || default is (1-teamColorRatio). Keep more of color when mixing. Note this might saturate colors. ||
|-
| drawUnderUnits || bool || ||
|-
| effectOnCreate || effect ref list || ||
|-
| shouldRevealFog || bool || Reveal fog to player on explode ||
|-
| alwaysVisibleInFog || bool || ||
|-
| nukeWeapon || bool || Shows on mini-map when fired. Some other side effects as well. ||
|-
| trailEffect || bool/effect || true for built-in defaults, but can also point to any custom effects ||
|-
| trailEffectRate || float || Defaults to 3 ||
|-
| lightCastOnGround || bool || ||
|-
| lightSize: || float || ||
|-
| lightColor || color || || lightColor: #ffe92b
|-
| largeHitEffect: || bool || Creates a large explosion and accompanying sound on hit (only cosmetic) ||
|-
| lightingEffect: || bool || Draw as lighting works best with instant:true ||
|-
| laserEffect: || bool || Draw as laser works best with instant:true ||
|-
| beamImage || file (image) || Image to use for beam and laser effect type projectiles. Image is repeated vertically depending on the distance to target. ||
|-
| beamImageOffsetRate || float || ||
|-
| beamImageStart || int || Frame start of beam animationeffect ||
|-
| beamImageStartRotated || bool || Defaults false. True to rotate with turret angle ||
|-
| beamImageEnd || int || Frame end of beam animation effect ||
|-
| beamImageEndRotated || bool || Defaults false ||
|}
</div>
 
==<nowiki>[movement]</nowiki>==
==优点==
<div style="overflow:auto;">
* 优点
{| class="wikitable" style="background-color:black;color:yellow;"
 
| Code || Value Type || Description || Example
==缺点==
|-
* 缺点
| movementType: || string || Defines what kind of terrain the unit will be able to move, along with other properties of unit types. || movementType: LAND
 
|-
==单位设计==
| slowDeathFall: || bool || Used with large aircraft. Makes the unit fall slowly while maintaining its speed at the time of death. || slowDeathFall: true
* 单位设计
|-
 
| moveSpeed: || float || Maximum movement speed of the unit. || moveSpeed: 1.2
==作用==
|-
作用
| moveAccelerationSpeed: || float || Defines how fast units accelerate to max speed. || moveAccelerationSpeed: 0.07
 
|-
==你知道吗==
| moveDecelerationSpeed: || float || Don't make this too low or units will have trouble stopping at waypoints || moveDecelerationSpeed: 0.17
你知道吗
|-
| reverseSpeedPercentage: || float || 0.6 default. Over 0.4 will reverse for short distances (at 40% speed). If set to 1 will drive in reverse same as forwards. Useful if slow turning || reverseSpeedPercentage: 0
|-
| landOnGround: || bool || Should flying unit land when idle. || landOnGround: false
|-
| targetHeight: || float || Defaults to 0 but if AIR movementType default is 35 || targetHeight: 25
|-
| targetHeightDrift: || float || Smooth animated height change. Defaults to 0 but if AIR movementType default is 1.5 || targetHeightDrift: 1
|-
| startingHeightOffset: || float || ||
|-
| heightChangeRate: || float || Rate at which the unit changes height, either from converting or drifting || heightChangeRate: 3
|-
| fallingAcceleration: || float || The acceleration in which a unit drops ||
|-
| fallingAccelerationDead: || float || fallingAcceleration but when destroyed ||
|-
| maxTurnSpeed: || float || ||
|-
| turnAcceleration: || float || ||
|-
| moveSlidingMode: || bool || Makes the unit slide when moveDecelerationSpeed is lower, making them drift and feel natural ||
|-
| moveIgnoringBody: || bool || Allows the unit to move without fully turning in the direction its moving, useful for ships and air units ||
|-
| moveSlidingDir: || int || ||
|-
| joinsGroupFormations: || bool || Defaults to true. Changing not recommended ||
|}
</div>
==<nowiki>[ai]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| useAsBuilder: || bool || Set to true if unit can build or repair buildings. Defaults to [core]isBuilder. ||
|-
| useAsTransport || bool || Defaults to true if unit can transport units ||
|-
| useAsHarvester || bool || Defaults to true if unit can reclaim resources ||
|-
| disableUse: || bool || Disallow AI building this unit or building ||
|-
| ai_upgradePriority || float || Defaults to 0.06. Set between 0-1, higher means AI is more likely to upgrade this unit before others ||
|-
| #==== || #==== || Buildings only ||
|-
| buildPriority: || float || 0-1. AI uses 0.8 for first land factory, 0.48 for air factory, 0.47 for first turret. ||
|-
| noneInBaseExtraPriority: || float || Adds to buildPriority, if this unit doesn't exist in the AIs base ||
|-
| noneGlobalExtraPriority: || float || Adds to buildPriority, if this unit doesn't exist in the any where on the map ||
|-
| recommendedInEachBaseNum || float || Defaults to 0 ||
|-
| recommendedInEachBasePriorityIfUnmet || float || Defaults to 0.5. Overrides buildPriority ||
|-
| upgradedFrom: || string || Create link to another unit to preserve max counts for upgraded and non-upgraded types in same base. ||
|-
| maxGlobal: || int || ||
|-
| maxEachBase: || int || ||
|-
| notPassivelyTargetedByOtherUnits || bool || Useful for walls, etc ||
|-
| lowPriorityTargetForOtherUnits || || Useful for units that cannot attack back. Eg walls ||
|-
| whenUsingAsHarvester_recommendedInEachBase || || ||
|-
| whenUsingAsHarvester_recommendedGlobal || || ||
|-
| whenUsingAsHarvester_includeOtherHarvesterCounts || || ||
|-
| onlyUseAsHarvester_ifBaseHasUnitTagged || || ||
|}
</div>
==<nowiki>[leg_{NUM] / [arm_{NUM}]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| x: || float || Sets position of the foot on the X axis. ||
|-
| y: || float || Sets position of the foot on the Y axis. ||
|-
| copyFrom: || int || Copy from another leg. Useful to only need to set leg values once || copyFrom: 1
|-
| attach_x: || float || Sets the leg's attach point on the X axis. ||
|-
| attach_y: || float || Sets the leg's attach point on the Y axis. ||
|-
| rotateSpeed: || float || ||
|-
| endDirOffset || || Target foot/end rotation relative to body ||
|-
| lockMovement || bool || Lock to unit body. Useful if walking unit converted to a flying unit. ||
|-
| heightSpeed: || float || ||
|-
| moveSpeed || || ||
|-
| moveWarmUp || || ||
|-
| holdDisMin: || float || Defaults to 7. Reposition leg at this distance if neighbor legs are not already repositioning. ||
|-
| holdDisMax: || float || Defaults to 16. Force reposition of leg at this distance. ||
|-
| holdDisMin_maxMovingLegs || || ||
|-
| hold_moveOnlyIfFurthest || || ||
|-
| holdDisMin_checkNeighbours || || ||
|-
| hardLimit: || float || Defaults to 50. Force leg to never go this far. Better to not be reached. ||
|-
| estimatingPositionMultiplier || float || defaults to 1. Predicts were unit will be for leg placement based on unit speed. ||
|-
| #==== || #==== || Graphics and effects ||
|-
| hidden: || logic boolean || ||
|-
| image_end || file (image) || ||
|-
| image_end_shadow || file (image) || ||
|-
| image_end_teamColors || || ||
|-
| image_foot || file (image) || same as image_end ||
|-
| image_foot_shadow || file (image) || ||
|-
| image_middle || file (image) || ||
|-
| image_leg || file (image) || same as image_middle ||
|-
| draw_foot_on_top || bool || ||
|-
| drawOverBody || bool || Draw over body ||
|-
| drawUnderAllUnits || bool || Draw over all units ||
|-
| drawDirOffset || float || ||
|-
| dust_effect: || bool || Spawns dust particles on each step. ||
|-
| spinRate || float || Makes arm/leg spin, like idleSpin for turrets ||
|-
| favourOppositeSideNeighbours || || calculate neighbours with X 10 times closer than Y ||
|-
| drawLegWhenZoomedOut || || For performance, defaults changes based on unit size ||
|-
| drawFootWhenZoomedOut || || For performance, defaults changes based on unit size ||
|-
| liftingHeightOffset || int || ||
|-
| targetHeight || int || ||
|-
| targetHeightRelative || bool || ||
|-
| resetAngle: || float || Unused ||
|}
</div>
==<nowiki>[attachment_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| x || float || ||
|-
| y || float || ||
|-
| height || float || ||
|-
| idleDir || int || ||
|-
| idleDirReversing || int || ||
|-
| isVisible || bool || ||
|-
| onCreateSpawnUnitOf || unit ref || ||
|-
| isUnselectable || bool || Defaults to false ||
|-
| canAttack || bool || Defaults to true. Set to false to stop this attachment attacking. ||
|-
| canBeAttackedAndDamaged || bool || ||
|-
| deattachIfWantingToMove || bool || If the unit is ordered to move, it will detach. This includes waypoints from actions. ||
|-
| lockLegMovement || bool || ||
|-
| keepAliveWhenParentDies || bool || Defaults to false ||
|-
| setDrawLayerOnTop || bool || ||
|-
| setDrawLayerOnBottom || bool || ||
|-
| addTransportedUnits || bool || ||
|-
| lockRotation || bool || ||
|-
| rotateWithParent || bool || ||
|-
| resetRotationWhenNotAttacking || bool || Similar to shouldResetTurret:for turrets. ||
|-
| prioritizeParentsMainTarget || bool || It will priotize targeting the main target. Defaults to true. ||
|-
| alwaysAllowedToAttackParentsMainTarget || bool || Will always attack the parents main target. ||
|-
| onParentTeamChangeKeepCurrentTeam || bool || Defaults false. If true attached units are not converted when parent changes team. Eg from [projectile]convertHitToSourceTeam ||
|-
| onConvertKeepExistingUnitInSameSlot || bool || ||
|-
| unloadInCurrentPosition || bool || Defaults false. If true transported attached units are kept current attached location when unloading ||
|-
| keepWaypointsNeedingMovement || bool || Defaults false. If true attached units keep waypoints with movement even while they cannot move. Useful if they will be automatically deattached soon. ||
|-
| smoothlyBlendPositionWhenExistingUnitAdded || bool || ||
|-
| showAllActionsFrom || LogicBoolean || Show all actions of the units attached in the parent unit list when selected ||
|-
| createIncompleteIfParentIs: || bool || If parent hasn't been built, create attachment with the same built value. Links built values till attachment is complete. Useful for buildings built with nano. ||
|-
| redirectDamageToParent: || bool || Redirects damage done to this attachment to the parent instead of damaging itself directly ||
|-
| redirectDamageToParent_shieldOnly: || bool || ||
|}
</div>
==<nowiki>[action_NAME] / [hiddenAction_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| text || string || ||
|-
| textPostFix: || string || Text shown as suffix, useful with textAddUnitName to create text UI || "text: [ textPostFix: ] textAddUnitName: unitRef self.attachment(slot=""${slotId}"")"
|-
| text_{LANG} || string || ||
|-
| description || string || A display text when you select your unit's action, used to explain it's purpose. ||
|-
| description_{LANG} || string || ||
|-
| displayType || list || none, rally, upgrade, queueUnit, building, action, infoOnly, infoOnlyNoBox, infoOnlyStockpile ||
|-
| displayRemainingStockpile || bool || Queue is shown as number of times action can be triggered based on price ||
|-
| pos || float || Order action appears in UI ||
|-
| iconImage || file (image) || ||
|-
| iconExtraImage || file (image) || Drawn over top of icon image. Useful for upgrade icons, etc ||
|-
| iconExtraColor || colour || Defaults to #64FFFFFF ||
|-
| iconExtraIsVisible || LogicBoolean || ||
|-
| unitShownInUI || unitRef/unitType || Display this unit. (as if this action built this unit) || eg: unitShownInUI: unitRef self.transporting(slot=0) or unitShownInUI: heavyTank
|-
| guiBuildUnit || || ||
|-
| setBuilt || float || Designates how built the unit is from a percentage of 0-100% with a number between 0 and 1. ||
|-
| tags || tags || To be used with the withTag parameter for self.queueSize(withTag=x) and queueItemAdded and queueItemCanceled events ||
|-
| id || string || Allow same/equivalent actions to be more easily connected when converting between units, to preserve queues, calldowns, etc. (Normally action order is used but can be unstable.) ||
|-
| #==== || #==== || Unit Reference - Dynamically parts from already existing units, useful w/ isAlsoViewableByEnemies || self, self.parent(), self.transporting(slot=x), self.attachment(slot=X)
|-
| textAddUnitName || unitRef/unitType || Add this unit's name to this action's text || " eg: textAddUnitName: unitRef self.attachment(slot=""1"")"
|-
| descriptionAddFromUnit || unitRef/unitType || Add this unit's description to this action's description ||
|-
| descriptionAddUnitStats: || unitRef/unitType || Add this unit's stats (eg HP, energy, resources) to this action's description || descriptionAddUnitStats: unitRef self.parent()
|-
| unitShownInUIWithHpBar || bool || default true, Only used when unitShownInUI is a unitRef ||
|-
| unitShownInUIWithProgressBar || bool || default true, Only used when unitShownInUI is a unitRef. Replaces HP bar if active ||
|-
| #==== || #==== || Requirements for player/AI to use in UI ||
|-
| alwaysSinglePress || bool || Defaults false. When true no confirmation needed on mobile, when used with canPlayerCancel:false and allowMultipleInQueue:false will also hide the queue interface. ||
|-
| price || resources || The price of your action for the unit. Disables action if not available. Defaults to credits if unlabelled || price: credits=5, energy=5, hp=100, shield=5, ammo=1
|-
| isActive || LogicBoolean || Defaults true. If false then action is disabled and shown in red in UI. ||
|-
| isVisible || LogicBoolean || Defaults true. If false action is hidden from UI and disabled. ||
|-
| isLocked || LogicBoolean || Defaults false. If true action is disabled, and a lock icon is shown. Mostly used for no nuke game modes ||
|-
| isLockedMessage || LocaleString || ||
|-
| isLockedAlt || LogicBoolean || Another reason for this to be locked. Can just use OR on isLocked, but this allows a different message to be shown ||
|-
| isLockedAltMessage || LocaleString || ||
|-
| isLockedAlt2 || LogicBoolean || ||
|-
| isLockedAlt2Message || LocaleString || ||
|-
| allowMultipleInQueue || || When false makes it so only one action can be queued of this type (useful for keeping actions with conditions from being spammed) ||
|-
| onlyOneUnitAtATime || bool || When action is picked in UI, only one unit selected with get this action. Defaults to false. ||
|-
| isGuiBlinking || LogicBoolean || Flashes in UI to draw attention to it. Might be annoying if used often, recommended only for temporarily states/messages ||
|-
| isAlsoViewableByAllies || bool || Allows ally players to see actions from this unit, useful for showing stats to other players (eg missile count, items collected) ||
|-
| isAlsoViewableByEnemies || bool || Allows enemy players to see actions from this unit, useful for showing stats to other players (eg missile count, items collected) ||
|-
| #==== || #==== || AI - How the AI uses this action ||
|-
| ai_isHighPriority || LogicBoolean || Use this for faction selection actions or other high priority actions such as building high priority units ||
|-
| ai_isDisabled || LogicBoolean || Defaults false. Stop AI using this action. (Note when ai_isHighPriority is true this might be ignored) ||
|-
| ai_considerSameAsBuilding || || Be careful with ||
|-
| #==== || #==== || Triggers - These skip the queue and do not use price, ignores isLocked, buildTime, etc || (Use 2 actions and alsoQueueAction to automatically add an action to the queue)
|-
| autoTriggerOnEvent: || || "Parameters: created, completeAndActive, destroyed, killedAnyUnit, queuedUnitFinished, queueItemAdded(withActionTag=""#""), queueItemCancelled(withActionTag=""#""), teleported, touchTargetSuccess, newWaypointGivenByPlayer, teamChanged, transportingNewUnit, transportUnloadedOrRemovedUnit, tookDamage(withTag=""#""), newMessage(withTag=""#""), enteredTransport, leftTransport, attachmentRemoved" || withTag parameter for tookDamage uses tag from projectile and it is optional. withTag parameter for newMessage uses message tags.
|-
| autoTrigger || LogicBoolean || When true triggers the effects of this action instantly (ignoring price, isActive, isVisible, buildSpeed, etc) || autoTrigger: if self.overWater(), autoTrigger: if self.customTimer(laterThanSeconds=5)
|-
| autoTriggerCheckRate || enum || options: everyFrame (default), every4Frames, every8Frames. This overrides autoTriggerCheckRate set on [core] Note: all triggers regardless of check rate are checked when first created and after an auto trigger cooldown. Note: Adding [core]autoTriggerCheckRate:every8Frames to all-units.template could have a large performance boost for mods with complex autoTriggers. || autoTriggerCheckRate:every8Frames
|-
| #==== || #==== || While action is queued ||
|-
| buildSpeed || time || || buildSpeed: 5s
|-
| highPriorityQueue || bool || Defaults to false. If true this action skips all other low priority actions in queue. Useful for fireTurret actions. ||
|-
| canPlayerCancel || bool || ||
|-
| whenBuilding_cannotMove || bool || Stops unit moving while action is being applied. Useful for deploy like actions. ||
|-
| whenBuilding_playAnimation || animation ref || ||
|-
| whenBuilding_rotateTo || float || Rotate unit body to this direction when action is in active queue ||
|-
| whenBuilding_rotateTo_orBackwards || bool || If true allow rotation in 180 degrees from whenBuilding_rotateTo when this is a smaller angle ||
|-
| whenBuilding_rotateTo_waitTillRotated || bool || Pause action queue till rotation is finished ||
|-
| whenBuilding_temporarilyConvertTo || unit ref || Convert to another unit while action is in active queue. Note: actions from the original unit will be kept ||
|-
| whenBuilding_temporarilyConvertTo_keepFields || || Don't change these fields when using whenBuilding_temporarilyConvertTo (both to and from), useful with setUnitStats ||
|-
| whenBuilding_triggerAction || action ref || ||
|-
| whenBuilding_rotateTo_aimAtActionTarget || bool || BETA NOTE: is broken in some cases ||
|-
| whenBuilding_rotateTo_rotateTurretX || turret ref || ||
|-
| spawnEffectsOnQueue || effect ref || Effects to spawn at unit when action is first added to queue ||
|-
| playSoundToPlayerOnQueue || sound ref || Global sound to play to unit's player only when action is first added to queue ||
|-
| #==== || #==== || Misc outcomes / Results (What happens) (Note: Must be at least one outcome for an action to show) ||
|-
| requireConditional || || Skip all effects of this action if this evaluates to false ||
|-
| convertTo || unit ref || Convert your unit into another unit. properties are preserved. ||
|-
| convertTo_keepCurrentTags || || Keep current and temporarily tags and ignores default tags on convertTo target. ||
|-
| convertTo_keepCurrentFields || fields || "Don't change these fields when converting, useful with setUnitStats (Allowed fields: maxHp, maxShield, shieldRegen, maxEnergy, armour, mass, shootDelayMultiplier, moveSpeed, maxAttackRange.) ||
|-
| addEnergy || float || Adds energy to unit. Has no effect unless energyMax is set. (Same as addResources: energy=X) ||
|-
| addResources || resources || Add these resources when action finishes. || addResources: credits=5, energy=-5, hp=-100, shield=5, ammo=1
|-
| addResourcesScaledByAIHandicaps || resources || Same as addResources, but increased or decreased depending on AI difficulty level ||
|-
| addResourcesWithLogic || dynamic resources || Like addResources but allows logic to be used for the resource value || addResourcesWithLogic: hp = select( self.parent.energy>5, 10, 20 )
|-
| setResourcesWithLogic || dynamic resources || Sets target resources to this value instead of adding. Becareful with global resources. || setResourcesWithLogic: hp=self.parent.hp - 10, energy = self.energy / 2
|-
| deleteSelf || || Remove self with no explosions or sounds ||
|-
| resetCustomTimer || LogicBoolean || Reset timer used with self.customTimer() ||
|-
| setBodyRotation || || ||
|-
| setUnitStats || fields values || Allows changing of a select number of fields dynamically without converting. Supports =/+=/-=, with dynamic maths/logic. Changeable fields: maxHp, hp, maxShield, shield, shieldRegen, maxEnergy, energy, armour, mass, shootDelayMultiplier, shootDamageMultiplier, moveSpeed, maxTurnSpeed, maxAttackRange, fogOfWarSightRange, nanoRange, selfRegenRate ||
|-
| resetUnitStats || boolean || Reset changes made by setUnitStats to base values ||
|-
| setUnitMemory || key value pairs || Change this unit's memory, values can be set with logic. Memory must first be defined with defineUnitMemory || "setUnitMemory: """"""
|-
| || || In setting array memories, it is important to put the array index (supports dynamic values) || "setUnitMemory: myTargets[4]=nearestUnit(withTag=""fish"")"
|-
| setCustomTarget1: || unit ref || Used for unit linking without requiring unit memories or markers. It is the unit that built this by default. || setCustomTarget1: self.parent
|-
| setCustomTarget2: || unit ref || Like setCustomTarget1 and with the same use. It is none by default. || setCustomTarget2: lastDamagedBy
|-
| sendMessageTo: || unit ref || Sends a message to a targeted unit || "sendMessageTo: unitref nearestUnit(withinRange=100, withTag=""fish"")."
|-
| sendMessageWithTags: || Message Tag || Useful for message detection in an autoTriggerOnEvent event, eg autoTriggerOnEvent:newMessage(withTag=xyz) ||
|-
| sendMessageWithData || key-value || The data that will be sent to the targeted unit. Allows multiple key-value pairs with any dynamic data type, use eventData() to read this data in the event || "sendMessageWithData: fish=""nice!"", cat=self.activeWaypointTarget, amount=4, xyz=memory.something"
|-
| refundAllQueuedItems || boolean || Refunds the spent price in the queue of a specific action; Includes set flags in price. ||
|-
| removeAllQueuedItemsWithoutRefund || boolean || Clears the queue without refunding ||
|-
| #==== || #==== || Outcome - Chaining Actions ||
|-
| alsoTriggerAction || action refs || Trigger to results of another action as well. Ignores action's requirements. || alsoTriggerAction: addCredits, playSound
|-
| alsoQueueAction || action refs || Adds another action into the normal unit's queue. Ignores action's requirements ||
|-
| alsoTriggerOrQueueActionConditional || LogicBoolean || Defaults true. alsoTriggerAction and alsoQueueAction are ignored if this works out to be false. ||
|-
| alsoTriggerOrQueueActionWithTarget || unitref || Changes the target of the triggered action, normally defaults to the current action target. Effects things like fireTurretXAtGround, spawnUnits, thisActionTarget(), etc ||
|-
| alsoTriggerActionRepeat || logicNumber || Repeats the alsoTriggerAction call, thisActionIndex changed on each repeat - Useful to create loops or work with arrays ||
|-
| #==== || #==== || Outcome - Sounds ||
|-
| playSoundAtUnit || sound ref || Local sound to play when action finishes ||
|-
| playSoundGlobally || sound ref || Global sound to play to all players in game ||
|-
| playSoundToPlayer || sound ref || Global sound to play to unit's player only ||
|-
| #==== || #==== || Outcome - Fire projectile from turret ||
|-
| fireTurretXAtGround || turret ref || When action finishes fire target turret at point on ground, bypasses canShoot rules in turret. || fireTurretXAtGround: nukeSilo
|-
| fireTurretXAtGround_withOffset || point || If not set player targets the ground with GUI, if a point is set this step is skipped || fireTurretXAtGround_withOffset: 0,0
|-
| fireTurretXAtGround_withProjectile || projectile ref || Used with fireTurretXAtGround. Defaults to target turret's normal projectile. ||
|-
| fireTurretXAtGround_withTarget || unitref || Fires a turret aimed at the location of the indicated unit or marker ||
|-
| fireTurretXAtGround_count || || Number of projectiles to fire. Defaults to 1 ||
|-
| fireTurretXAtGround_onlyOverPassableTileOf || || Only allow tiles crossable by this movement type to be selected || LAND,BUILDING,WATER,HOVER, etc
|-
| fireTurretXAtGround_showGuideDecals || decal refs || Draws decals at the target location. Recommend setting up decals with layer: inactive ||
|-
| #==== || #==== || Outcome - Spawning ||
|-
| spawnUnits || || Spawn units at action's target. See 'Spawn units line' section in this doc for details. || eg: spawnUnits: heavyTank, tank*5, hoverTank(offsetX=10)
|-
| produceUnits || || Like spawnUnits but unit exits as if it was produced normally, and gets a move away waypoint ||
|-
| spawnEffects || effect ref || Effects to spawn at unit ||
|-
| #==== || #==== || Outcome - Position ||
|-
| offsetSelfAbsolute: || point3d || Offsets unit position absolutely by this point || offsetSelfAbsolute: 0, 0, 40 [x,y,height]
|-
| teleportTo || unit ref/marker || Changes unit position to this position. ||
|-
| #==== || #==== || Outcome - Transport Changes ||
|-
| addUnitsIntoTransport || unitTypes || Creates and add units into transport, use self.transportingCount() to check for space before adding || addUnitsIntoTransport: tank*3, heavyTank(neutralTeam=true)
|-
| transportTargetNow || unit ref || Instantly tries to transports existing units on the map into this transport. Might fail if rules don't allow this unit to be transported. ||
|-
| deleteNumUnitsFromTransport || int || ||
|-
| deleteNumUnitsFromTransport_onlyWithTags || string(s) || ||
|-
| startUnloadingTransport || bool || ||
|-
| forceUnloadTransportNow || bool || For unload all units, or slot targeted by forceUnloadTransportNow_onlyOnSlot. Unloads even if no space or overwater, etc ||
|-
| forceUnloadTransportNow_onlyOnSlot || int || ||
|-
| #==== || #==== || Outcome - Waypoint Changes ||
|-
| clearAllWaypoints || bool || Clears all waypoints, be careful not to annoy players by removing their orders, prepending waypoints is often better ||
|-
| clearActiveWaypoint || bool || ||
|-
| addWaypoint_type || || move, attackMove, guard, loadInto, loadUp, attack, reclaim, repair, touchTarget, build, follow, setPassiveTarget ||
|-
| addWaypoint_unitType || || Only for use with addWaypoint_type:build ||
|-
| addWaypoint_prepend || bool || Add to the start of the waypoint queue or the end ||
|-
| addWaypoint_triggerActionIfFailed || actions || If target_nearestUnit fails to find a match so waypoint cannot be added then trigger this action ||
|-
| addWaypoint_triggerActionIfMatched || actions || ||
|-
| addWaypoint_maxTime || time || Automatically remove this waypoint if it has been active for longer than this time. ||
|-
| addWaypoint_target_nearestUnit_tagged || tags || ||
|-
| addWaypoint_target_nearestUnit_team || relation || own|neutral|allyNotOwn|ally|enemy|any|notOwn ||
|-
| addWaypoint_target_nearestUnit_maxRange || float || ||
|-
| addWaypoint_target_mapMustBeReachable || bool || ||
|-
| addWaypoint_target_fromReference || unit ref || || addWaypoint_target_fromReference: self.memory.lastDock
|-
| addWaypoint_position_offsetFromSelf || point || ||
|-
| addWaypoint_position_fromAction || bool || ||
|-
| addWaypoint_position_randomOffsetFromSelf || || Same as above, but random. ||
|-
| addWaypoint_position_relativeOffsetFromSelf || point || ||
|-
| addWaypoint_target_randomUnit_tagged || || ||
|-
| addWaypoint_target_randomUnit_team || || ||
|-
| addWaypoint_target_randomUnit_maxRange || || ||
|-
| #==== || #==== || Outcome - Cooldown ||
|-
| addAllActionCooldownsTime || || ||
|-
| addActionCooldownTime || || Player cannot use action again for this amount of time ||
|-
| addActionCooldownApplyToActions || action ids || Sets addActionCooldownTime's target. Defaults to this action. ||
|-
| clearAllActionCooldowns || || ||
|-
| #==== || #==== || Outcome - Animation ||
|-
| playAnimation || animation id || ||
|-
| playAnimationIfNotPlaying || bool || Don't restart animation if this animation is already playing ||
|-
| finishPlayingLastAnimation || bool || Finish last animation, including blend out ||
|-
| stopLastAnimation || bool || Stop last animation, skipping blend out ||
|-
| switchToNeutralTeam || boolean || Change team to neutral. This team is allied to all other teams. Will be captured by nearby units unless [core]stayNeutral:true is used ||
|-
| switchToAggressiveTeam || boolean || Change to a built-in team that is aggressive to all other teams. Does not get captured. ||
|-
| switchToTeam || logicNumber || Team id to switch to. Starts at 0. (but -1 for a neutral team, -2 for aggressive Team) ||
|-
| #==== || #==== || Outcome - Take Resources from other units ||
|-
| takeResources || customPrice || Resources to take (required to use take resources). And at-least 1 include key is needed. || takeResources: hp=5, gold=10
|-
| takeResources_includeUnitsInTransport || bool || ||
|-
| takeResources_includeParent || bool || Include attachment parent or transport parent ||
|-
| takeResources_includeReference || unit ref || || [action]takeResources_includeReference: self.lastDamagedBy
|-
| takeResources_includeUnitsWithinRange || float || ||
|-
| takeResources_includeUnitsWithinRange_team || TeamRelation || Used with includeUnitsWithinRange, defaults to own. Can be: own|ally|allyNotOwn|enemy|neutral|any ||
|-
| takeResources_excludeUnitsWithoutTags || tags || ||
|-
| takeResources_excludeUnitsWithTheseResources || customPrice || ||
|-
| takeResources_excludeUnitsWithoutAllResources || bool || Defaults to true. ||
|-
| takeResources_triggerActionIfAnyCollected || action refs || ||
|-
| takeResources_triggerActionIfNoneCollected || action refs || ||
|-
| takeResources_triggerActionForEach || action refs || Calls this action for each unit found by takeResource with the unit as thisActionTarget, and thisActionIndex counting up from zero. ||
|-
| takeResources_discardCollected || bool || Just take resources from targets, don't add(or remove) to self ||
|-
| takeResources_keepResourcesOnTarget || bool || Don't add/remove resource from target. This clones resources. Use with takeResources_discardCollected and takeResources_triggerActionIfAnyCollected to make a resource detector. ||
|-
| takeResources_maxUnits || int || Defaults to 1. ||
|-
| takeResources_directTransferStoppingAtZero || bool || If less resources on target than transfer amount, only remaining resources will be transfered. Doesn't support use with some other takeResources_* keys ||
|-
| #==== || #==== || Outcome - Convert Resources ||
|-
| convertResource_from || customResource || Name of custom resource to take from ||
|-
| convertResource_to || customResource || Name of custom resource to give to ||
|-
| convertResource_minAmount || float || Skip if less than this amount in 'from'. Defaults to 0. Likely not needed for most use cases ||
|-
| convertResource_maxAmount || float || Max amount to transfer between 'from' and 'to' ||
|-
| convertResource_multiplyAmountBy || float || Defaults to 1. Amount to multiply when adding on 'to' (does not effect amount taken on 'from') ||
|-
| #==== || #==== || Outcome - Set Resources ||
|-
| resourceAmount || customResource || Name of custom resource to set with the below 3 keys. All keys are optional, and can be used together. || resourceAmount: oil
|-
| resourceAmount_setValue || float || Absolute value to set this resource to, ignores current value of resource. Skipped by default || resourceAmount_setValue: 20
|-
| resourceAmount_addOtherResource || customResource || Name of another custom resource to add to this on. Can be used without resourceAmount_setValue, to just add resources. Or with resourceAmount_setValue:0 to copy a resource value. ||
|-
| resourceAmount_multiplyBy || float || Defaults to 1. Multiple the current or new value by ||
|-
| #==== || #==== || Outcome - Attachment changes ||
|-
| attachments_addNewUnits || unit types || ||
|-
| attachments_deleteNumUnits || int || ||
|-
| attachments_onlyOnSlots || attachment ids || Restrict attachments_* actions to these attachments ||
|-
| disconnectFromParent || bool || ||
|-
| attachments_unload || bool || Unload all attachments. Can be used with attachments_onlyOnSlots. Same as unloading transported units ||
|-
| attachments_disconnect || bool || Disconnect all attachments in the place they are right now. Can be used with attachments_onlyOnSlots. ||
|-
| #==== || #==== || Outcome - Tag changes ||
|-
| temporarilyAddTags || tags || Add tag to this unit until it is converted or reset (unless convertTo_keepCurrentTags is used) ||
|-
| temporarilyRemoveTags || tags || Remove tag from this unit until it is converted or reset (unless convertTo_keepCurrentTags is used) ||
|-
| resetToDefaultTags || bool || Reset to standard tags ||
|-
| addGlobalTeamTags || tags || Add a tag to player's team. Use with self.globalTeamTags() to create unlocks and upgrades. Unique tags are best to not conflict with other mods. ||
|-
| removeGlobalTeamTags || tags || Remove a tag from player's team. ||
|-
| #==== || #==== || Outcome - Show Message ||
|-
| showMessageToPlayer || string || Sends a message to the player controlling the unit ||
|-
| showMessageToPlayer_{LANG} || string || Note: This format is support on nearly all strings that show to player even when reference doesn't show it ||
|-
| showMessageToAllPlayers || string || Sends a message to all players || Eg: showMessageToAllPlayers: %{self.playerName} has captured a point
|-
| showMessageToAllEnemyPlayers || string || || showMessageToAllEnemyPlayers: Team %{self.playerName} has %{self.resource.gold}
|-
| showQuickWarLogToPlayer || string || Sends a Quick War Log message to the player controlling the unit (in the lower lef) ||
|-
| showQuickWarLogToAllPlayers || || Sends a Quick War Log message to all players (in the lower lef) ||
|-
| debugMessage || || Only shows in Sandbox with Debug mode on. ||
|}
</div>
==<nowiki>[effect_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| drawType || || normal|displacement (displacement only shows when shader effects are turned on) ||
|-
| life || float || Defaults 200. Time till effect is removed. Set low as possible to reduce effect overhead. || life: 70
|-
| lifeRandom || float || Random offset life by +/- this value || lifeRandom: 12
|-
| alsoEmitEffects || effect ref || Create more effects when created, useful for meta-effects. Note: other 'alsoEmitEffects' on created effects are ignored. ||
|-
| alsoEmitEffectsOnDeath || effect ref || Create these effects when life runs out. ||
|-
| ifSpawnFailsEmitEffects || effect ref || If 'spawnChance' for this effects fails then emit these effects instead ||
|-
| alsoPlaySound || sound ref || ||
|-
| createWhenOffscreen || bool || Defaults false. ||
|-
| createWhenZoomedOut || bool || Defaults true ||
|-
| createWhenOverLiquid || bool || Defaults true ||
|-
| createWhenOverLand || bool || Defaults true ||
|-
| spawnChance || float || Default 1. If less than 1 effect only has a random chance of being created ||
|-
| showInFog || bool || Default false ||
|-
| delayedStartTimer || float || Hide for x time before showing and updating effect. ||
|-
| liveAfterAttachedDies || bool || Defaults false when attachedToUnit is being used ||
|-
| priority || string || Defaults to high. verylow/low/high/veryhigh/critical. Takes effect when too many effects are being shown at once. ||
|-
| #==== || #==== || Movement ||
|-
| attachedToUnit || bool || Attach to unit or projectile that created this effect. Will move with this object. ||
|-
| alwayStartDirAtZero || bool || Ignore source/attached unit dir ||
|-
| atmospheric || bool || Apply drag to slow this effect down and add small wind effects ||
|-
| physics || bool || Fall to ground and bounces. Needs height to take effect. ||
|-
| physicsGravity || float || Defaults to 1. height speed acceleration when physics: true ||
|-
| xOffsetRelative || float || Offset starting effect position. Relative to direction of attached turret, projectile, unit ||
|-
| yOffsetRelative || float || Offset starting effect position. Relative to direction of attached turret, projectile, unit ||
|-
| xOffsetRelativeRandom || float || Random offset by +/- this value ||
|-
| yOffsetRelativeRandom || float || Random offset by +/- this value ||
|-
| xOffsetAbsolute || float || Offset starting effect by position ignoring direction of attached turret, projectile, unit ||
|-
| yOffsetAbsolute || float || Offset starting effect by position ignoring direction of attached turret, projectile, unit ||
|-
| xOffsetAbsoluteRandom || float || Random offset by +/- this value ||
|-
| yOffsetAbsoluteRandom || float || Random offset by +/- this value ||
|-
| xSpeedRelative || float || ||
|-
| ySpeedRelative || float || ||
|-
| xSpeedRelativeRandom || float || Randomly change by -value to value ||
|-
| ySpeedRelativeRandom || float || Randomly change by -value to value ||
|-
| xSpeedAbsolute || float || ||
|-
| ySpeedAbsolute || float || ||
|-
| xSpeedAbsoluteRandom || float || Randomly change by -value to value ||
|-
| ySpeedAbsoluteRandom || float || Randomly change by -value to value ||
|-
| hOffset || float || height offset from source ||
|-
| hOffsetRandom || float || Randomly change by -value to value ||
|-
| hSpeed || float || height speed ||
|-
| hSpeedRandom || float || Randomly change by -value to value ||
|-
| dirOffset || float || rotation ||
|-
| dirOffsetRandom || float || Randomly change by -value to value ||
|-
| dirSpeed || float || rotation speed ||
|-
| dirSpeedRandom || float || Randomly change by -value to value ||
|-
| #==== || #==== || Graphics ||
|-
| frameIndex || int || frame of to use ||
|-
| frameIndexRandom || || ||
|-
| stripIndex || int/string || A built-in image set to use. Cannot be used with custom image || effects/explode_big/light_50/flame/effects/effects2/projectiles/projectiles2/explode_bits
|-
| image || image || Custom image file to use. Cannot be used with stripIndex. ||
|-
| imageShadow || image || Custom image file to use for shadows ||
|-
| scaleTo || float || Defaults to 1 ||
|-
| scaleFrom || float || Defaults to 1 ||
|-
| color || color || Defaults #FFFFFFFF ||
|-
| teamColorRatio || || 0-1 ||
|-
| drawUnderUnits || bool || ||
|-
| fadeInTime || float || Fade alpha from 0% to 100% for this time at start ||
|-
| fadeOut || bool || Fade alpha from 100% to 0% based on life. Set alpha is higher than 1 to delay fade ||
|-
| alpha || || Capped between 0-1. Can be set higher than 1 to delay fadeOut effects ||
|-
| shadow || || True to draw a shadow. Forced true if imageShadow is used ||
|-
| pivotOffset || float || Similar to dirOffset, this will also rotate relative keys and child elements ||
|-
| pivotOffsetRandom || float || ||
|-
| #==== || #==== || Animation ||
|-
| total_frames || int || Total frames of 'image', used with animation or frameIndex. Only needed with custom images ||
|-
| animateFrameStart || int || ||
|-
| animateFrameEnd || int || ||
|-
| animateFramePingPong || int || ||
|-
| animateFrameSpeed || time || ||
|-
| animateFrameSpeedRandom || time || ||
|-
| animateFrameLooping || bool || Defaults false. When false effect is removed when animation ends ||
|}
</div>
==<nowiki>[animation_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| onActions : Unknown || || move, attack, idle, underConstruction, underConstructionWithLinkedBuiltTime, queuedUnits ||
|-
| onActionsQueuedUnitPlayAt : float || || For onAction: queuedUnits. Amount queue needs to reach before starting, set between 0-1 ||
|-
| blendIn : time || || Blend with last animation for this time ||
|-
| blendOut : time || || Blend with next animation for this time ||
|-
| pingPong || bool || Play animation in reverse after it ends ||
|-
| KeyframeTimeScale : float || float || Scales all keyframe times, useful to make an animation faster/slower without changing everything ||
|-
| #==== || #==== || Keyframes - create as many as needed ||
|-
| arm#_[time] || || Adds a keyframe at time. Use multiple times to create animation. || eg: arm1_5s: {x: 5, dir: 90 }
|-
| leg#_[time] || || Adds a keyframe at time. Use multiple times to create animation. ||
|-
| body_[time] || || Adds a keyframe at time for body. Only frame and scale allowed on body || eg: body_4s: {frame: 4, scale: 0.5}
|-
| effect_[time] || || "Spawn effects while playing an animation ||
|-
| eg: effect_2s: {name:CUSTOM|myExplode, x: 0,y: 5} || || ||
|-
| direction_units || float || Overrides [graphics]animation_direction_units while this animation is playing ||
|-
| direction_strideX: || int || Overrides [graphics]animation_direction_strideX ||
|-
| direction_strideY: || int || Overrides [graphics]animation_direction_strideY ||
|-
| direction_starting: || float || Overrides [graphics]animation_direction_starting ||
|-
| #==== || #==== || Deprecated Keys (can be used but there are better ways) ||
|-
| start : int || || Start image frame. deprecated ||
|-
| end : int || || End image frame. deprecated ||
|-
| scale_start : float || || Start scale. Deprecated, use body keyframes instead. ||
|-
| scale_end : float || || End scale. Deprecated, use body keyframes instead. ||
|-
| speed : float || || Speed, smaller is faster. Only effects start, end, scale_start, scale_end ||
|}
</div>
==Spawn units line==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || || Description || Example
|-
| #==== || #==== || Most units spawning keys support multiple units with parameters || spawnUnits: crates*10(neutralTeam=true), tank(spawnChance=0.5)
|-
| neutralTeam || || Spawn the unit on the neutral team instead of the same team as source ||
|-
| setToTeamOfLastAttacker || || Spawn the unit on the last attacker of source (useful on [core]unitsSpawnedOnDeath) ||
|-
| spawnChance || || Chance this unit will spawn. Defaults to 1. ||
|-
| spawnSource || unit ref || Changes spawn location and team of spawned units to this unit ref. || [action]spawnUnits: tank(spawnSource=memory.lastLocation)
|-
| maxSpawnLimit || || Useful with spawnChance, max number of units to spawn in total || spawnUnits: treeA(spawnChance=0.5, maxSpawnLimit=1), treeB(maxSpawnLimit=1)
|-
| gridAlign || || Align spawn location to grid, useful for buildings ||
|-
| skipIfOverlapping || bool || Don't spawn this unit if spawn in an invalid location. Eg on units or over water when LAND based ||
|-
| offsetX || float || ||
|-
| offsetY || float || ||
|-
| offsetRandomX || float || ||
|-
| offsetRandomY || float || ||
|-
| offsetRandomDir || float || ||
|-
| offsetHeight || float || ||
|-
| offsetDir || float || ||
|-
| addResources || resource ref || Give spawn unit those resources, can be used to set flags that trigger actions || spawnUnits: crates(addResources=gold:30|stone:10, spawnChance=0.5)
|-
| transportedUnitsToTransfer || int || Puts the designated amount of transported units into the transport of the spawned unit. || spawnUnits: transporter(transportedUnitsToTransfer=5)
|-
| copyWaypointsFrom || unit ref || Copies all waypoints on target to created units. || spawnUnits: tank(copyWaypointsFrom=self)
|-
| alwayStartDirAtZero || bool || ||
|-
| techLevel || int || Usually used in BR maps, controls the size of safe zones. 1 techLevel = 10x10 tiles = 200 pixels in diameter ||
|}
</div>
==Spawn Projectiles line==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || || Description || Example
|-
| #==== || #==== || Most projectile spawning keys used for projectile ref || spawnProjectilesOnEndOfLife: secondary*3(spawnChance=0.5)
|-
| spawnChance || float || Chance this projectile will spawn. Defaults to 1. || spawnChance: 0.5
|-
| maxSpawnLimit || int || Maximum amount to spawn ||
|-
| recursionLimit || int || Prevents loops, useful with spawning itself so it doesn't infinitely spawn, good for chain exploding || recursionLimit: 5 (Recommended no more than 4 if spawning more than 3 projectiles)
|-
| offsetX || float || ||
|-
| offsetY || float || ||
|-
| xOffsetRelative || float || Similar to offsetX, but the offset is relative to the position of the projectile ||
|-
| yOffsetRelative || float || Similar to xOffsetRelative, but for Y axis ||
|-
| offsetRandomX || float || Random value to offset in the X axis only ||
|-
| offsetRandomY || float || Random value to offset in the Y axis only ||
|-
| offsetRandomXY || float || The offset in both directions to randomly spawn, makes truly random spawning within an area ||
|-
| offsetHeight || float || ||
|-
| offsetDir || degrees || ||
|-
| offsetRandomDir || degrees || ||
|}
</div>
==LogicBoolean==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Returns || Description || Example
|-
| true || bool || ||
|-
| false || bool || ||
|-
| if || || Start all logic booleans with if, unless just using true/false ||
|-
| and || bool || || if self.isInWater() and self.energy(greaterThan=1)
|-
| or || bool || || if (self.energy(greaterThan=1) or self.ammo(greaterThan=1)) and self.isFlying()
|-
| not || bool || || if not self.isOverLiquid()
|-
| < || bool || Return true if number on left is smaller ||
|-
| > || bool || Return true if number on right is smaller ||
|-
| <= || bool || Return true if number on left is smaller or equal ||
|-
| >= || bool || Return true if number on right is smaller or equal ||
|-
| == || bool || Return true if number, unit, string, bool on both sides is the same ||
|-
| != || bool || Return true if number, unit, string, bool on both sides different ||
|-
| + || same type || Add two numbers or join two strings ||
|-
| - || same type || Subtract two numbers ||
|-
| / || same type || Divide two numbers ||
|-
| * || same type || Multiply two numbers ||
|-
| % || same type || Divides two numbers and returns the remainder ||
|-
| #==== || #==== || Unit location and movement ||
|-
| self.isUnderwater() || bool || ||
|-
| self.isAtGroundHeight() || bool || ||
|-
| self.isFlying() || bool || ||
|-
| self.isMoving() || bool || ||
|-
| self.isReversing() || bool || ||
|-
| self.isAtTopSpeed() || bool || ||
|-
| self.isInWater() || bool || Touching water ||
|-
| self.isOverwater() || bool || Touching or over a water tile ||
|-
| self.isOverLiquid() || bool || ||
|-
| self.isOverClift() || bool || ||
|-
| self.isOverPassableTile() || bool || (parameters: type) || Type Values: NONE, LAND, BUILDING, HOVER, OVER_CLIFF, OVER_CLIFF_WATER, AIR, WATER
|-
| self.isOverOpenLand() || bool || shortcut for self.isOverPassableTile(type='LAND') ||
|-
| #==== || #==== || Unit stats ||
|-
| self.hasResources() || bool || Checks if unit has these resources. Can check multiple resources at the same time (all price parameters). || self.hasResources(credits=1, energy=2)
|-
| self.resource() || float / bool || Checks a single resource (parameters: type, greaterThan, lessThan) (1.15 returns float with no parameters) || self.resource(type=gold) >= 10
|-
| self.resource.RESOURCE_TYPE || float || Shortcut for: self.resource(type='RESOURCE_TYPE') || addResourcesWithLogic: hp += self.resource.gold
|-
| self.isResourceLargerThan || bool || Compare two resource between each other, note multiplyTargetBy doesn't make any changes. (parameters: source=x, compareTarget=x, byMoreThan=x, multiplyTargetBy=x) ||
|-
| self.hp() || float / bool || (parameters: greaterThan, lessThan, empty, full). (1.15 returns float with no parameters) ||
|-
| self.maxHp() || float / bool || (parameters: greaterThan, lessThan, empty, full). (1.15 returns float with no parameters) ||
|-
| self.height() || float / bool || (parameters: greaterThan, lessThan, empty, full) (1.15 returns float with no parameters) ||
|-
| self.ammo() || int / bool || Returns int if no parameters, boolean with any parameters (parameters: greaterThan, lessThan, empty, full) ||
|-
| self.isAmmoEmpty() || bool || shortcut for self.ammo(empty=true) ||
|-
| self.ammoIncludingQueued() || int / bool || Also includes ammo from actions still in queue (parameters: greaterThan, lessThan, empty, full) || if self.ammoIncludingQueued(lessThan=12)
|-
| self.energy() || float / bool || (parameters: greaterThan, lessThan, empty, full) (1.15 returns float with no parameters) || if self.energy() > 50
|-
| self.energyIncludingQueued() || float / bool || Also includes energy from actions still in queue (parameters: greaterThan, lessThan, empty, full) ||
|-
| self.isEnergyFull() || bool || shortcut for self.energy(full=true) ||
|-
| self.isEnergyEmpty() || bool || shortcut for self.energy(empty=true) ||
|-
| self.maxEnergy() || float / bool || Returns maximum energy (defaults to energyMax value in core, dynamically adjusts to changed value made by setUnitStats) ||
|-
| self.isEnergyRecharging() || bool || Checks if unit energy is passively recharging ||
|-
| self.shield() || float / bool || (parameters: greaterThan, lessThan, empty, full) (1.15 returns float with no parameters) ||
|-
| self.maxShield() || float / bool || Returns the maximum shield value (defaults to maxShield value in core, but dynamically adjusts to changes made with setUnitStats) ||
|-
| self.kills() || int / bool || (parameters: greaterThan, lessThan) (1.15 returns int with no parameters) ||
|-
| self.queueSize() || int / bool || "(parameters: greaterThan, lessThan, full, empty, equalTo) (1.15 returns float with no parameters) 1.15p9 adds a new parameter: withActionTag=""#""" ||
|-
| self.teamId() || int || Return team id of unit or marker. Starts at 0. (but -1 for a neutral team) ||
|-
| self.teamName() || string || Returns allied group team name ||
|-
| self.playerName() || string || Returns player's name ||
|-
| self.x(), self.y(), self.z() || float || Returns the unit's coordinate parts ||
|-
| self.dir() || float || Returns the unit's direction ||
|-
| self.priceCredits() || || Returns the price of the unit ||
|-
| self.speed() || float || Returns current speed of the unit ||
|-
| self.builtAmount() || float || Returns the current value of build progression of the unit ||
|-
| self.completed() || bool || Shortcut for self.builtAmount() == 1 ||
|-
| self.maxMoveSpeed() || float || Returns the top speed of the unit ||
|-
| #==== || #==== || Misc ||
|-
| self.hasFlag() || bool || Boolean flag saved into units for mods to use. (parameters: id=0-31) || Use addResources in action change this vaule
|-
| self.tags() || bool || (parameters: includes) ||
|-
| self.globalTeamTags() || bool || (parameters: includes) ||
|-
| self.transportingCount() || int || (parameters: greaterThan, lessThan, empty) (1.15 returns int with no parameters) ||
|-
| self.numberOfAttachedUnits() || int / bool || (withTag, greaterThan, lessThan) (1.15 returns int with no parameters) ||
|-
| self.isAttacking() || bool || ||
|-
| self.hasActiveWaypoint() || bool || ([type=WAYPOINT_TYPE]) ||
|-
| self.transportingUnitWithTags() || bool || (parameters: includes) || self.transportingUnitWithTags(includes='human')
|-
| self.hasParent() || bool || For both attachments and transports (parameters: [withTag=x] ) ||
|-
| self.hasTakenDamage() || float / bool || (parameters: withinSeconds=X, laterThanSeconds=X) (v1.15 returns float in seconds with no parameters) || self.hasTakenDamage(withinSeconds=1)
|-
| self.timeAlive() || float / bool || (parameters: withinSeconds=X, laterThanSeconds=X) (v1.15 returns float in seconds with no parameters) ||
|-
| self.lastConverted() || float / bool || (parameters: withinSeconds=X, laterThanSeconds=X) (v1.15 returns float in seconds with no parameters) ||
|-
| self.customTimer() || float / bool || (parameters: withinSeconds=X, laterThanSeconds=X) (v1.15 returns float in seconds with no parameters) ||
|-
| self.isOnNeutralTeam() || bool || ||
|-
| self.numberOfUnitsInTeam() || int / bool || (parameters: withTag, greaterThan, lessThan, withinRange, incompleteBuildings, factoryQueue) (v1.15 returns int with no parameters) || numberOfUnitsInTeam(withTag='techUnlockBuilding', greaterThan=0)
|-
| self.numberOfUnitsInAllyTeam() || int / bool || ||
|-
| self.numberOfUnitsInAllyNotOwnTeam() || int / bool || (parameters: withTag, greaterThan, lessThan, withinRange, incompleteBuildings, factoryQueue) (v1.15 returns int with no parameters) ||
|-
| self.numberOfUnitsInEnemyTeam() || int / bool || (parameters: withTag, greaterThan, lessThan, withinRange, incompleteBuildings, factoryQueue) (v1.15 returns int with no parameters) ||
|-
| numberOfUnitsInNeutralTeam() || int / bool || (parameters: withTag, greaterThan, lessThan, withinRange, incompleteBuildings, factoryQueue) (v1.15 returns int with no parameters) ||
|-
| numberOfUnitsInAggressiveTeam() || int / bool || The special 'aggressive to all' team (this is not the same as numberOfUnitsInEnemyTeam) (parameters: withTag, greaterThan, lessThan, withinRange, incompleteBuildings, factoryQueue) ||
|-
| numberOfUnitsInAllTeams() || int / bool || (parameters: withTag, greaterThan, lessThan, withinRange, incompleteBuildings, factoryQueue) (v1.15 returns int with no parameters) ||
|-
| self.hasUnitInTeam() || bool || (parameters: withTag, withinRange, incompleteBuildings, factoryQueue) alias for numberOfUnitsInTeam ||
|-
| self.noUnitInTeam() || bool || (parameters: withTag, withinRange, incompleteBuildings, factoryQueue) alias for numberOfUnitsInTeam ||
|-
| self.isControlledByAI() || bool || ||
|-
| self.readUnitMemory() || any type || (name:string, type:string{boolean,unit,float,string}, [default]) || if parent.readUnitMemory('boostTarget', type='unit') == self
|-
| #==== || #==== || Unit references ||
|-
| thisActionTarget || unit / marker || Current target or location targeted. || "fireTurretXAtGround: mainGun (thisActionTarget==Marker with ground location)
|-
| thisActionIndex || int || Used with alsoTriggerActionRepeat and takeResources_triggerActionForEach ||
|-
| eventSource || unit / marker || Current trigger from an autoTriggerOnEvent, otherwise null || "autoTriggerOnEvent: tookDamage (eventSource==Unit that caused damage)
|-
| attachment || unit || (parameters: [slot], [withTag]) || self.attachment(withTag='x').lastDamagedBy.getAsMarker()
|-
| transporting || unit || (parameters: [slot]) || if self.transporting(slot=0).hasResources(gold=100)
|-
| attacking || unit || Current target this is attacking, might not be the current waypoint target. || if attacking.tags(includes='bug') and attacking.hp < 20
|-
| lastDamagedBy || unit || Last unit that attacked this. ||
|-
| parent || unit || The transporter or attachment parent. (Note: units are suspended state when transported without attachment slot) || Eg autoTrigger: if parent.energy > 100
|-
| activeWaypointTarget || unit || Current active waypoint target. Includes attacking, transporting, repairing, etc. || if distanceBetween(self, activeWaypointTarget) < 100
|-
| customTarget1 || unit || Custom memory, defaults to the unit that created this unit. || if parent.customTarget1 == self
|-
| customTarget2 || unit || Custom memory, defaults to null ||
|-
| nearestUnit || unit || (withinRange=500, withTag='x', relation='any') Search for a unit (not recommended in autoTrigger check for perfomance) ||
|-
| globalSearchForFirstUnit || unit || (withTag=x, relation) - Returns first (and oldest) unit found matching the filter. Slow, avoid using in autoTrigger checks || self.globalSearchForFirstUnit(withTag='gameController', relation='neutral')
|-
| nullUnit || unit || returns a null unit reference, useful for comparisons || if self.parent == nullUnit
|-
| #==== || #==== || Marker functions ||
|-
| getAsMarker || marker || creates a temporary marker at the position a unit is right now. Markers are very fast to create and automatically removed when no longer needed. Is not linked to any unit and still exists when the unit dies, and stays the same when source moves. || lastDamagedBy.getAsMarker()
|-
| getOffsetAbsolute || marker || ([x],[y],[height]) Returns marker with absolute offset (-y is north, +x is east) ||
|-
| getOffsetRelative || marker || ([x],[y],[height],[dirOffset]) Returns marker with relative offset. (y+ is forwards) || self.getOffsetRelative(y=100).nearestUnit(withinRange=70, withTag='mouse') != null
|-
| eventSource || event || Returns the event from autoTriggerOnEvent, null if used outside of a valid autoTriggerOnEvent ||
|-
| #==== || #==== || Global functions ||
|-
| readUnitMemory || any type || Reads memory from the unit reference (e.g. self, parent) || "self.readUnitMemory('ammoType', type='string'), parent.readUnitMemory(''attachmentArray"", type=""unit[ ]"", index=5), attacking.readUnitMemory(""wishlist"", type=""string[ ]"")[12]"
|-
| memory.NAME || any type || Shortcut to read the self with current defineUnitMemory types. Cannot be used on other units, use readUnitMemory for that. Don't call with self. || autoTrigger: if memory.experience > 100
|-
| distance(x1, y1, x2, y2) || float || Returns the difference between two points ||
|-
| distanceSquared(x1, y1, x2, y2) || float || Returns the squared difference between two points. Bit faster than distance. ||
|-
| distanceBetween(unit1, unit2) || float || Returns the distance between two units or markers ||
|-
| distanceBetweenSquared(unit1, unit2) || float || Returns the squared distance between two units. Bit faster than distanceBetween ||
|-
| game.nukesEnabled() || bool || Returns true if nukes are enabled in this game's settings. ||
|-
| int(x) || int || Removes decimal places from a number. || int(4.2) == 4
|-
| select(bool, textA, textB) || || returns textA if bool is true otherwise returns textB ||
|-
| debug(logicBoolean) || string || Returns a text string helping to explain the reason for the current result. Can see into nested logic, comparisons, and operators. ||
|-
| str(x) || string || Convert a number, unit or boolean into a string || str(self.energy)+'x' == '100x'
|-
| substring(text,start,end) || string || Takes a part of the string from the indicated start and end parts || substring('hello',0,2) == 'he'
|-
| length(string) || int || Returns string length as number ||
|-
| squareRoot(num) || float || Requires square root of a number ||
|-
| min(num1, num2) || float || Returns the smallest number || damage = min(self.hp, self.energy)
|-
| max(num1, num2) || float || Returns the biggest number || max(5, 10) == 10
|-
| createMarker(x, y, [height], [teamId], [dir]) || marker || ||
|-
| eventData(name, type, [default]) || any type || Displays the data from a specified message from some unit. Only use in autoTriggerOnEvent:newMessage events ||
|-
| sin(angle) || float || Takes the sine value of a specified number || sin(10) = 0.173
|-
| cos(angle) || float || Takes the cosine value of a specified number || cos(60) = 0.5
|-
| rnd(min, max) || float || Produces a random number between minimum and maximum input. || rnd(666, 888)
|-
| lowercase(string) || string || Sets all letters from a string into lowercase || "lowercase(""Spaghetti Macaroni Lasagna"") -> ""spaghetti macaroni lasagna"""
|-
| uppercase(string) || string || Sets all letters from a string into uppercase || "uppercase(""fish dish wish"") -> ""FISH DISH WISH"""
|-
| direction(x1, y1, x2, y2) || float || Returns the relative angle of x1/y1 and x2/y2 ||
|-
| directionBetween(unit1, unit2) || float || Returns the relative angle of unit/marker A and unit/marker B || directionBetween(self, lastDamagedBy)
|-
| self.isInMap() || bool || Returns true if unit (or marker) is with the game area; Returns false if outside bounds ||
|-
| game.mapWidth() || float || Returns the width of the map ||
|-
| game.mapHeight() || float || Returns the height of the map ||
|-
| self.teamDefeatedTech() || bool || ||
|-
| self.teamWipedOut() || bool || Returns true if team is defeated and wiped out ||
|-
| self.teamVictory() || bool || Returns true if team is victorious ||
|}
</div>
==<nowiki>[placementRule_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| anyRuleInGroup: || string || (Only require 1 of the rules in this group pass, instead of all. Use the same group name on other placement rules to create a group.) ||
|-
| searchTags: || tag list || Search for any unit with at least one of these tags ||
|-
| searchTeam: || relation || Teams to include in search, can be: own|neutral|allyNotOwn|ally|enemy|any ||
|-
| searchOffsetX: || float || defaults to 0 ||
|-
| searchOffsetY: || float || defaults to 0 ||
|-
| searchDistance: || float || Required ||
|-
| excludeIncompleteBuildings: || bool || defaults to false. Might want to set to true depending on the requirement reason ||
|-
| excludeNonBuildings: || bool || defaults to false ||
|-
| minCount: || int || Set min amount of units that need to be found in search. (eg needs to be near something). Defaults to 0 ||
|-
| maxCount: || int || Set max amount of units before match fails (eg cannot be close to something). Defaults to unlimited ||
|-
| blocksPlacement: || bool || Defaults to true. ||
|-
| cannotPlaceMessage: || LocaleString || Highly Recommended. Message shown to player if this rule fails (will be first failing rule if using anyRuleInGroup). ||
|-
| checkEachTile: || bool || defaults to true (set to false to only test unit center, true checks each tile under the unit which shows up on the placement grid. Can be easier to see requirements with true) ||
|-
| Type || || Prices/Resources lines - used by addResources, price, etc ||
|}
</div>
==Price/Resources lines==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Targets || Description || Example
|-
| credits || || Global resource ||
|-
| energy || || ||
|-
| hp || || ||
|-
| shield || || || price: hp=-100, shield=100
|-
| ammo || || Hidden value on each unit for use by mods ||
|-
| setFlag || || use with addResources, resourceUsage or price. 0-31. Flags are stored in each unit || setFlag=1
|-
| unsetFlag || || use with addResources, resourceUsage or price. 0-31 ||
|-
| hasFlag || || use with price or resourceUsage ||
|-
| hasMissingFlag || || use with price or resourceUsage ||
|-
| X || || Any resource defined in [global_resource_x] or [resource_x] sections || gold=5, stone=20
|}
</div>
==<nowiki>[global_resource_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| #==== || #==== || Define a new resource shared with all units in a team, works just like the built-in credits resource. Add to 'all-units.template' (at mod root) for easy use in all of your mods ||
|-
| displayName || LocaleString || Name of this resource in UI ||
|-
| displayNameShort || LocaleString || Resource name on smaller UI elements like action hovertext (Defaults to displayName) ||
|-
| hidden || bool || Hide this resource from the player ||
|-
| priority || || If 2 or mods/units define a resource with the same NAME, the displayName/displayColor with the highest priority is used ||
|-
| displayColor || color || Color, can be hex with optional alpha || #FF0000
|-
| displayRoundedDown || bool || Don't show decimal places to the player ||
|-
| displayTextPrefix || string || Adds a string before the resource value ||
|-
| displayTextPostfix || string || Adds a string after the resource value ||
|-
| displayTextAppendResource || resource || "Appends another resource after this resource. It's recommended to give a ""hidden"" key on the appended resource to hide duplicate." ||
|-
| displayWhenZero || bool || Displays the resource even when empty. Set as false by default ||
|-
| displayPos || int || Sets the position of the globa resource in the screen ||
|-
| iconImage || image || Shows a custom icon for the specific resource in the HUD and in text ||
|-
| iconImageUseInText || bool || Default as true; Shows resource icon in action description ||
|-
| displayNameHideWhenIconShownInText || bool || Default as false ||
|-
| displayNameHideWhenIconShownInHUD || bool || Hides the icon in menus referring to resource when true. Default as false ||
|-
| displayColorUseInText || bool || Shows color in action description ||
|-
| appendResourceInHUD || resource || stacks another resource specified after this resource on the HUD. ||
|-
| appendResourceInHUD_whenThisZero: || bool || Defaults as true. When set as false, allows appended resource to be hidden with the parent resource. ||
|-
| displayPrefixInHUD || string || Displays text to show before resource value - replaces resource name and removes the colon separator ||
|-
| displayPostfixInHUD || string || Similar to the prefix counterpart, but is displayed after the resource value ||
|-
| displayTextAppendResourceWithGap: || bool || Adds a space between this and the appended resource. Defaults as false. ||
|-
| displayDigitGrouping || enum || Sets the symbol for separating place units in: none, comma, space ||
|}
</div>
==<nowiki>[resource_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| #==== || #==== || Define a new resource local to unit. Works like build-in ammo resource ||
|-
| displayName || LocaleString || Name of this resource in UI (eg hovering over unit info) ||
|-
| displayNameShort || LocaleString || ||
|-
| hidden || || Hide this resource from the player ||
|-
| equivalentGlobalResourceForAI || || Used to hint to the AI that a resource node with a local resources could be used to get a different global resource. Eg when a harvester unloads the resource ||
|-
| displayRoundedDown || || ||
|}
</div>
==<nowiki>[template_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| #==== || #==== || Template sections can have any keys and have no effect by themselves. ||
|-
| #==== || #==== || Template can get included from other files with [core]copyFrom. Eg: [core]copyFrom: ROOT:effects/explodeEffects.template (Note that copyFrom can include multiple files. ) ||
|-
| #==== || #==== || --All these below features can be used with any section not just templates-- ||
|-
| @copyFromSection || || Use in any section to include keys from a section or template. (Comma separated for multiple) || @copyFromSection: template_name/action_name/projectile_name
|-
| @copyFrom_skipThisSection || || Use in any section to make [core]copyFrom not copy into it. Eg not copy an action when overriding || @copyFrom_skipThisSection
|-
| @define X || || Define a local variable within a section (best outside of template) || @define targetEffect: boom
|-
| @global X || || Define a global variable used in all sections. Local variables have a higher priority || @global targetEffect: pop
|-
| @memory X || || Define a memory for this unit, its type must be defined as well. || @memory transportCount: float
|-
| || || ${X} can be used to reference variables (can also be done outside of a template). It is calculated when loading and remains static. Has no impact on runtime performance. || spawnEffects: effect_${targetEffect}
|-
| || || ${section.key} can be used to reference another key (can also be done outside of a template) || addResources: credits=${ core.price * 2 + 10 }
|-
| || || %{X} can be used to add dynamic logic into some strings. (CAN NOT be used everywhere). The value will update every frame. || [action]text: Missing hp %{self.maxHp - self.hp}
|-
| || || """"""" text """""" can be used for multiline strings. Newlines with be removed from final result." || "copyFrom:""""""
|}
</div>
==<nowiki>[decal_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| layer || enum || Sets the layer of the decal, values from lowest to highest - shadow, beforeBody, afterBody, onTop, beforeUI, inactive ||
|-
| order || float || Defaults as 0, sets a more discrete layering if 2 or more decals takes same layer type. Otherwise order in INI file will be used. ||
|-
| onlyWhenSelectedByOwnPlayer || bool || Defaults as false, displays the decal if only the owner player clicks on the unit ||
|-
| onlyWhenSelectedByEnemyPlayer || bool || ||
|-
| onlyWhenSelectedByAllyNotOwnPlayer || bool || ||
|-
| onlyWhenSelectedByAnyPlayer || bool || ||
|-
| includeParentsSelection || bool || onlyWhenSelectedBy* will also checks parent's selection when true. Useful with attachments. ||
|-
| onlyPlayersWithUnitControl || bool || Draws the decal if a player that selects it has control (that includes shared units in multiplayer) ||
|-
| onlyTeam || TeamRelation || Draws the decal if value matches the player from the following: own, notOwn, ally, allyNotOwn, enemy, any ||
|-
| onlyWithZoomLevelOrMore || float || Draws the decal only if the zoom level matches or exceeds it, very useful for making 3D units more optimized. ||
|-
| onlyWhileActive || bool || Draws the decal only if the unit is fully built ||
|-
| onlyWhileAlive || bool || Draws the decal only if the unit is alive (If beforeUI layer default true, else default false) ||
|-
| onlyInPreview || || Only show in sidebar, and building placement preview ||
|-
| onlyOnNonPreview || bool || Draws the decal only on the unit itself, not on the preview from building or in sidebar interface ||
|-
| onlyOnBodyFrameOf || int || Only draw decal when body frame is equal to this ||
|-
| isVisible || LogicBoolean || Dynamic Value, draws the decal on a specific condition ||
|-
| imageScale || logicNumber || Dynamic value, scales the decal ||
|-
| imageScaleX || logicNumber || Dynamic value ||
|-
| imageScaleY || logicNumber || Dynamic value ||
|-
| image || image || Takes a single image for the decal - NOT TO BE CONFUSED WITH IMAGE STACK || image: fish.png
|-
| imageStack || images || Takes one or more image with occassional multipliers for stacking. Also useful for using image stack from a MagicaVoxel slice export || Multiple image file stack: imageStack - carFloor.png, carBody.png*3, carRoof.png*2, antenna.png*10
|-
| || || || Stack from a sprite sheet - imageStack: carModel.png*14
|-
| teamColors || bool || When true, automatically reassigns team color to respective teams ||
|-
| stack_hOffset || float || Sets the height of every layer in a stack. 1 layer = 1 pixel. Can take negative values. ||
|-
| stack_frameOffset || int || Useful for making 3D units, frame to offset by in imageStack. Often a value of 1 is useful in a sprite sheet. ||
|-
| stack_drawInReverseOrder || bool || Renders the stack in the opposite way - last frame goes on bottom, first frame goes to top ||
|-
| stack_indexStart || logicNumber || Offset to start drawing images in the image stack ||
|-
| stack_indexCount || logicNumber || Number of images in the image stack to draw. ||
|-
| total_frames || int || Sets the number of frames in an image from an imageStack that uses a spritesheet. ||
|-
| frame_width || int || ||
|-
| frame_height || int || ||
|-
| frame || logicNumber || Dynamic value, useful for animations ||
|-
| addBodyFrameMultipliedBy || int || Add body frame number to this decal when set to 1. ||
|-
| xOffsetRelative || int || Sets horizontal offset relative to the unit ||
|-
| yOffsetRelative || int || Sets vertical offset relative to the unit ||
|-
| xOffsetAbsolute || logicNumber || Dynamic value ||
|-
| yOffsetAbsolute || logicNumber || Dynamic value ||
|-
| hOffset || int || Sets the height of the whole decal ||
|-
| dirOffset || int || Sets the direction of the whole decal. ||
|-
| pivotOffset || int || only affects relative offsets without rotating image ||
|-
| alwaysStartDirAtZero || bool || Keeps the decal on north direction regardless of the unit's direction value, useful for custom in-unit interfaces ||
|-
| image_shadow || image || Sets shadow for the decal ||
|-
| shadowOffsetX || int || ||
|-
| shadowOffsetY || int || ||
|-
| basePosition || marker || "Attaches the decal on the specified maker. use ""self"" if attaching it to the unit itself " || basePosition: self
|-
| || || || basePosition: memory.launchPoint
|-
| basePositionFromLegEnd || leg/arm || Attaches the decal to the specified leg or arm ending. || basePositionFromLeg: leg_3 (this will attach the decal to leg_3)
|-
| basePositionFromTurret || turret || Attaches the decal to the specified turret || basePositionFromTurret: rocketLauncherBase
|-
| drawLineTo || marker ref || Draws a line from the unit to the specified marker, useful for custom waypoints || drawLineTo: attacking.customTarget2
|-
| color || color hex || Sets the color of the drawn line ||
|-
| lineWidth || float || Sets the width of the drawn line ||
|-
| alpha || logicNumber || 0-1, sets transparency of decal (images or line) ||
|}
</div>
==<nowiki>[comment_NAME]</nowiki>==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Code || Value Type || Description || Example
|-
| #==== || #==== || Comment sections can have any keys and have no effect. ||
|-
| List of default game noises (for turret fire sound or other sound references): || || bug_attack, bug_die, building_explode, cannon_firing, click, click_add, click_remove, firing3, firing4, gun_fire, interface_error, large_gun_fire1, large_gun_fire2, laser_deflect, laser_deflect2, lighting_burst, message, missile_fire, missile_hit, move, nuke_explode, nuke_launch, plasma_fire, plasma_fire2, tank_firing, unit_explode, unit_explode_old, warning ||
|}
</div>
==mod-info.txt==
<div style="overflow:auto;">
{| class="wikitable" style="background-color:black;color:yellow;"
| Key || Value type || Description || Example
|-
| title || String || Sets the title of the mod package || title: Sample mod
|-
| description || String || Sets the description of the mod package. Doesn't support line breaks. || description: This is a sample of mod that samples a unit to the game
|-
| tags || String || Sets varied tags depending on what is specified, can be multiple with comma as separator || tags: units, sample, demo
|-
| minVersion || String || Declares the minimum version compatible for the mod. It is important to declare one when using decals and other modding keys starting on version 1.15p9 beta || minVersion: 1.15p9
|-
| thumbnail || image || Sets the mod's thumbnail in Steam Workshop || thumbnail: assets/images/other/thumb.png
|-
| sourceFolder || audio dir || Sets where the custom music will be played for the mod || sourceFolder: assets/audio/music
|-
| whenUsingUnitsFromThisMod_playExclusively || bool || Only plays music from this mod ||
|}
</div>
573

个编辑