RW Modding
RW Modding
name: string Defines the unit raw name, game uses it to identify as a unique
name. (This is not displayed in-game) name: customTank1
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
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
class: string Reserved for future use, must be CustomUnitMetadata by
default. class: CustomUnitMetadata
maxHp: int The max health for the unit. (will spawn with this value). maxHp:
200
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
buildSpeed: float / s Time it takes to build the unit. (may multiply with builder
speed) buildSpeed: 3s
#==== #==== Common Keys
altNames: string(s) Comma separated list of names. Like name but lower
priority, useful for multiple optional mods. altNames: custTank1, customTank1,
cTank1
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
isBio: bool Choose whether the unit is bioligical or not, affects sound and
splat (unless hideScorchMark:true) isBio: true
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
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.
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.
#==== #==== Unit Stats Keys
selfRegenRate: float Passive self repair rate. selfRegenRate: 0.01
maxShield: int The max shield hitpoints of the unit. Can start with 0 hitpoints
if startShieldAtZero:true. maxShield: 500
startShieldAtZero: bool Unit starts with a 0 hitpoints shield on created if
true. startShieldAtZero: true
shieldRegen: float Passive shield regen rate. shieldRegen: 0.15
energyMax: float Defaults to 0. Energy that can be used as ammo for turrets, laser
defense and actions. energyMax: 1
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
energyNeedsToRechargeToFull: float Disables weapons using energy after reaching
zero till fully recharged if true. energyNeedsToRechargeToFull: true
energyRegenWhenRecharging float Regen rate while recharging.
armour: int Damage taken away from each hit. (not currently used in any
vanilla units) armour: 6
armourMinDamageToKeep: int Min damage to keep from received damage. Defaults to
1. armourMinDamageToKeep: 2
borrowResourcesWhileAlive: price Takes these resources when created and returns
them when removed or destroyed. borrowResourcesWhileAlive: gold=10
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
generation_resources: price Income unit creates. (custom resource version)
generation_resources: credits=5, gold=20
generation_active: logicBoolean Disables generation_resources/credits
when false. (logic_boolean) generation_active: if not self.hp(lessThan=100)
generation_credits: int Income unit creates. (credits only)
generation_credits: 2
generation_delay: int How often generation_resources/credits is added. Defaults
to 40. (changing not recommended) generation_delay: 40
#==== #==== UI and Graphics Keys
showInEditor: bool Set to false to hide unit in Sandbox editor. (Defaults to
true) showInEditor: false
displayText: LocaleString The unit name that the game shows to the
player. displayText: Custom Tank
displayText_{LANG}: string LANG = ISO 639-1 Code to show this text instead
when game is in this language. displayText_es: Tanque Personalizado
displayDescription: LocaleString Unit description that the game shows to
the player. displayDescription: -Fast movement\n-Light damage
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
displayLocaleKey: string Translation file key for unit name and description.
displayLocaleKey: units.mechArtillery
displayRadius: int Defaults to radius value. Set to show a larger or smaller
selection circle UI on units. displayRadius: 20
uiTargetRadius int Defaults to displayRadius value. Radius used when
attacking/reclaiming/etc this unit
shieldRenderRadius: int Defaults is a little bigger than radius. Set to show
a larger or smaller shield circle on units. shieldRenderRadius: 12
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
showOnMinimap: bool Defaults to true. Hide units on minimap if false.
showOnMinimap: false
showActionsWithMixedSelectionIfOtherUnitsHaveTag: bool Shows a merged action
list if all units selected includes one of these tags. Useful for converted units.
showActionsWithMixedSelectionIfOtherUnitsHaveTag: true
showOnMinimapToEnemies bool Useful for stealth units
#==== #==== Building Only Keys
isBuilding: bool Defines if the unit is a building. isBuilding: true
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
constructionFootprint: ints Tiles taken up for placement of other buildings.
Defaults to 0,0,0,0 = 1 center tile. constructionFootprint: -1,-1,1,3
displayFootprint: ints Left, up, right, down. Only applies to buildings, just used
for GUI. Defaults to footprint. displayFootprint: 0,0,1,1
buildingSelectionOffset: int Defaults to 0. Adds or removes padding on the
drawn selection rect in UI. buildingSelectionOffset: 4
buildingToFootprintOffsetX: float Defaults to 10. Change the building position in
the footprint on the X-axis. buildingToFootprintOffsetX: 4
buildingToFootprintOffsetY: float Defaults to 10. Change the building position in
the footprint on the Y-axis. buildingToFootprintOffsetY: 6
placeOnlyOnResPool: bool Normally used for extractors, forces building
construction in a resource pool. placeOnlyOnResPool: true
selfBuildRate: float Rate unit builds itself when placed without a builder.
selfBuildRate: 0.0008
ignoreInUnitCapCalculation defaults to true for buildings otherwise false.
Set to true to not count this unit in unit cap.
#==== #==== Misc Keys
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
overrideAndReplace: string(s) Overrides another unit with this unit. Build
links and map positions to target unit will be replaced. overrideAndReplace:
builder, combatEngineer
onNewMapSpawn: string Values: emptyResourcePools_asNeutral,
emptyOrOccupiedResourcePools_asNeutral, mapCenter_asNeutral,
mapCenter_eachActiveTeam, spawnPoint_eachActiveTeam
globalScale: float Defaults to 1. Changing not recommended. globalScale: 2
isLocked: bool Disallow building of this unit. Can be used with
overrideAndReplace to restrict units player can build. isLocked: true
isLockedIfGameModeNoNuke: bool Disallows building of this unit if nukes are
disabled during match setup. isLockedIfGameModeNoNuke: true
experimental: bool Tag unit as experimental. Affects zoomed out icon and end
game stats. experimental: true
stayNeutral: bool Set to false to disable capture when unit is on the neutral
team. stayNeutral: false
createNeutral: bool Set to true to always spawn the unit on the neutral team.
createNeutral: true
createOnAggressiveTeam: bool Set to true to always spawn the unit on aggressive
teams on single player matches. createOnAggressiveTeam: true
tags: string(s) List of comma separated strings. Used to classify units, create
special actions and balances. tags: tank, smallTank, piercingDamage
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
"
fogOfWarSightRange: int Sets number of tiles this unit can see through the
fog of war. Defaults to 15. fogOfWarSightRange: 18
fogOfWarSightRangeWhileNotBuilt int Fog of War range when unit/building is
incomplete. Defaults to fogOfWarSightRange
softCollisionOnAll: int Creates a soft collision effect when touching other
units. softCollisionOnAll: 3
disableAllUnitCollisions: bool Unit cannot collide with others if true.
disableAllUnitCollisions: true
isUnrepairableUnit: bool No unit can repair this unit if true.
isUnrepairableUnit: true
isUnselectable: bool If true unit cannot be selected. (includes AI players)
isUnselectable: true
isUnselectableAsTarget bool Defaults to isUnselectable. Can be used to create
units that cannot be selected but can be targeted for attack, reclaim, etc
isPickableStartingUnit: bool If true, unit is added to dropdowns for starting unit
in game setup menus. isPickableStartingUnit: true
startFallingWhenStartingUnit: bool Unit will appear falling from skies when
starting unit if true. startFallingWhenStartingUnit: true
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
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
canNotBeDirectlyAttacked: bool No unit can directly target this unit. If true
this will also skip this unit in victory/defeat checks.
canNotBeDirectlyAttacked: true
canNotBeDamaged bool Defaults to value of canNotBeDirectlyAttacked (be careful
setting this without canNotBeDirectlyAttacked, as AI will attack forever)
canNotBeGivenOrdersByPlayer: bool If true unit will not take player or AI orders.
canNotBeGivenOrdersByPlayer: true
canOnlyBeAttackedByUnitsWithTags: strings(s) List of tag strings, only units
with these tags can directly target this unit. canOnlyBeAttackedByUnitsWithTags:
piercingTank, powerfulTank
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."
#==== #==== Transport Keys
transportSlotsNeeded: int Defaults to 1. Number of slots this unit uses up in a
transport, experimentals are often set to 5. transportSlotsNeeded: 2
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
transportUnitsRequireMovementType: movementTypes Only allows trasport of units
that have one of these movement types. transportUnitsRequireMovementType: AIR,
WATER
transportUnitsBlockAirAndWaterUnits: bool Defaults to true. This unit can
only transport LAND units if true. transportUnitsBlockAirAndWaterUnits: false
x: float
y: float
copyFrom: turret ref Copy all values from another turret as defaut values for
this turret copyFrom: 1
projectile projectile ref Projectile fired from this turret. eg: projectile:
torpedo
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
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
interceptProjectile_removeTargetLifeOnly bool Defaults to false. When false
projectiles are just removed. Could be true to make hit projectiles explode or
split when hit
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
Section [projectile_NAME] Projectiles are necessary to inflict damage on
an enemy, but can also be used for other purposes
Code Value Type Description Example
#==== #==== Necessary Code
int directDamage: or areaDamage:
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)
#==== #==== 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.
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 laserEffect
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
Section [movement] These are traits the unit has as far as movement
goes, such as rotation and acceleration speed
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
Section [ai] This determines what the AI will use the unit for, does not
effect player
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
Section [leg_#] / [arm_#] Legs can move around when unit moves, Arms need
an animation or convert
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
resetAngle: float Unused
Section [attachment_NAME] Attachments are slots where other units can be
positioned or carried
Code Value Type Description Example
x float
y float
height bool
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
smoothlyBlendPositionWhenExistingUnitAdded bool
keepWaypointsNeedingMovement bool Defaults to false. When false any queued
waypoints needing movement to complete get removed.
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
Section [action_NAME] / [hiddenAction_NAME] Actions that can dynamically
cause changes to units and resources
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.
#==== #==== 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 This 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.
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, queueItemCancelled, teleported,
touchTargetSuccess, newWaypointGivenByPlayer, teamChanged, transportingNewUnit,
transportUnloadedOrRemovedUnit, tookDamage(withTag=""#""),
newMessage(withTag=""#""), enteredTransport, leftTransport"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 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:
""""""
customText=memory.customText+'hello',
nukeActive=true,
nextTarget=self.attacking.nearestUnit(withinRange=300, withTag='x',
relation='enemy')
"""""""
sendMessageTo: unitref 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"
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
#==== #==== 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
Section [animation_NAME] Use this to make intricate animations based on
different circumstances
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}
Type Spawn units line "Spawn lines specifically for units, used with ""unit
ref"" value types"
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(addResource=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
Type Spawn Projectiles line "Spawn lines specifically for projectiles, used
with ""proj ref"" value types"
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
Type LogicBoolean Advanced code to create conditionals and triggers
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 Can check multiple resources (all price parameters)
self.resource() float / bool Checks a single resource (parameters: type,
greaterThan, lessThan) (1.15 returns float with no parameters)
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.shield() float / bool (parameters: greaterThan, lessThan, empty,
full) (1.15 returns float with no parameters)
self.kills() int / bool (parameters: greaterThan, lessThan) (1.15 returns
int with no parameters)
self.queueSize() int / bool (parameters: greaterThan, lessThan) (1.15 returns
float with no parameters)
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
#==== #==== 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.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)
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
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 Retyrns the height of the map
Type [placementRule_NAME] Allows creation of rules for requiring
buildings
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
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
Section [global_resource_NAME]
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 Name of this resource in UI
displayNameShort 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
Section [resource_NAME]
Code Value Type Description Example
#==== #==== Define a new resource local to unit. Works like build-in ammo resource
displayName Name of this resource in UI (eg hovering over unit info)
displayNameShort
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
Section [template_NAME]
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:""""""
ROOT:a.ini,
ROOT:b.ini,
ROOT:c.ini
""""""
"
Section [comment_NAME]
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