Data\Weapon


Weapons are used to create auto-attacks for units. Similar to abilities, weapons create effect trees that determine their functionality.
Common Weapon Patterns

Template

FieldType: Template

Parent

FieldType: Parent

Family

Used for enabling/disabling families of weapons via behaviors.

Effect

The Effect created by the weapon on the target unit.


See: Data/Effect

Critical Chance

The chance that the weapon attack is considered a critical. The value is a fraction, so 0 is 0% chance and 1 is 100% chance of critical hit.

Critical Effect

The effect that is executed instead of the Effect when the ability is a critical. If this is not set, the default Effect will be used on critical instead.


See: Data/Effect

Independent Target Acquisition

If this is set, this weapon can acquire its own target and search for a target.


When checked, the weapon can acquire its own target, rather than being limited to the current target of the unit. This is useful for making secondary weapons.

Independent Pre And Back Swing

If this is checked, this weapon can fire when other weapons are in pre or back swing stage.


When checked, the weapon can be fired while other weapons on the unit are in preswing/backswing state. Otherwise only weapon can be fired at a time.

Can Fire While Moving

If this is checked, using this weapon will not stop movement.


When checked, allows the weapon to be used while the unit is moving.

Channeled

If this is checked, this weapon will be a channelling weapon along with a channeling persistent effect


When checked, the weapon will function as a channeled weapon if the effect is a persistent effect.
Channeled weapons will continuously fire after the Pre Swing, using data from the persistent effect:

Force Cast Followthrough

If target dies, this flag will keep the weapon firing to the last valid target position


When checked, the weapon will continue firing and execute its effect if the target dies or becomes invalid during the Pre Swing, rather than canceling the attack (and attack animation).
This tends to make ranged weapon attack animations look better when facing many targets as it prevents the unit from continuously canceling animations.

No Turn Outside Of Arc

If the flag is set and target is out of arc, this weapon cannot be used to attack


When checked, the unit won't turn to face targets that are outside of the primary weapon arc. This is useful for units that are not meant to turn (such as in shoot-em-up type games).

Validators

Weapon does not execute if any validator fails (does not trigger cost or cooldown)


Each validator must succeed in order for the weapon to be able to be fire.

Stats

Pre Swing

The delay between the weapon starting to fire and the effect being executed.


Used with Back Swing for the purposes of animating the unit.

Random Preswing Delay Min

The minimum random delay added to the weapon's Pre Swing stats. Supports negative numbers.


Useful for preventing groups of units that share the same weapon from firing in sync.

Random Preswing Delay Max

The maximum random delay added to the weapon's Pre Swing stats. Supports negative numbers.

Back Swing

The delay between the effect being executed and the weapon firing state ending.


Used with Pre Swing for the purposes of animating the unit. The sum of Pre Swing plus Back Swing is the minimum cooldown of the weapon.

Period

The cooldown of the weapon or how long the unit must wait to use it again.


The duration of the cooldown is effectively extended by the Pre Swing, as the period doesn't begin counting down until after the damage point.

Use Initial Cooldown

If checked, this weapon will start on cooldown.

Use Cooldown On Enable

If checked, this weapon will enter cooldown when it is disabled then enabled.

Minimal Range

The minimum distance the weapon can fire at.

Range

The maximum distance the weapon can fire at.

Scan Range

The range that the unit will use to search for targets to acquire when using this weapon.


Typically set to the same value as Range.

Arc

The angle in front of the caster that targets must be in. If the target is outside this arc, the caster will attempt to turn to face the target before casting.


Example: Arc 360 means the ability can be cast in any direction, 90 is a cone in front, and 0 is directly facing the target.

Buffer Range

Determines the distance targets must move beyond of the weapon range that will cause the weapon to cancel during pre swing. The default value of 0 causes the buffer range to be infinite.


Determines the distance targets must move beyond of the weapon range that will cause the weapon to cancel during pre swing. The default value of 0 causes the buffer range to be infinite.

Distance Check Mode

EnumType: DistanceCheckModes

Distance Extend Mode

EnumType: DistanceExtendModes

Target Filter

Used to determine the valid target types for the weapon.

Primary Sort Keys

Potential targets are sorted based on these parameters.

Key

EnumType: SearchFilter.FilterSortMethod

The method used to sort potential targets.

Order

EnumType: SearchFilter.FilterSortOrder

The order in which potential targets are sorted for priority.

Secondary Sort Keys

If a pair of targets have the same priority value due to Primary Sort Keys, this sort key is then used to determine which unit to target.

Key

EnumType: SearchFilter.FilterSortMethod

The method used to sort potential targets.

Order

EnumType: SearchFilter.FilterSortOrder

The order in which potential targets are sorted for priority.

Player

EnumType: SearchFilter.Flag

Targets owned by the player that created the search will match the filter.

Ally

EnumType: SearchFilter.Flag

Targets owned by an ally of the player that created the search will match the filter.

Enemy

EnumType: SearchFilter.Flag

Targets owned by an enemy of the player that created the search will match the filter.

Neutral

EnumType: SearchFilter.Flag

Targets that are neutral to the player that created the search will match the filter.

Unit

EnumType: SearchFilter.Flag

Targets that use the "Unit" category will match the filter.

Missile

EnumType: SearchFilter.Flag

Targets that use the "Missile" category will match the filter.

Structure

EnumType: SearchFilter.Flag

Targets that use the "Structure" category will match the filter.

Air

EnumType: SearchFilter.Flag

Targets that use air unit collision will match the filter.

Ground

EnumType: SearchFilter.Flag

Targets that use ground unit collision will match the filter.

Stealth

EnumType: SearchFilter.Flag

Targets with a behavior that uses the stealth flag will match the filter.

Invulerable

EnumType: SearchFilter.Flag

Targets with the invulnerable flag will match the filter.

Alive

EnumType: SearchFilter.Flag

Targets that are currently alive will match the filter.

Disabled

When checked, the weapon is disabled by default. Requires behaviors or other means to be enabled.

Weapon Attack Interval

Weapon attack intervals are defined by the sum of preswing, backswing, and cooldown values, and can be expressed as attack interval = pre swing + max(back swing, period).
Weapon attack interval