Semi-automatically generated modding documentation for Barotrauma

Attack

Attack

Attacks are used to deal damage to characters, structures and items. They can be defined in the weapon components of the items or the limb definitions of the characters. The limb attacks can also be used by the player, when they control a monster or have some appendage, like a husk stinger.

Attributes

Attribute Type Default value Description
StructureSoundType string “StructureBlunt” Name of the sound effect the attack makes when it hits a structure.
Context AttackContext Any The attack will be used only in this context.
TargetType AttackTarget Any Does the attack target only specific targets?
TargetLimbType LimbType None To which limb is the attack aimed at? If not defined or set to none, the closest limb is used (default).
HitDetectionType HitDetection Distance Collision detection is more accurate, but it only affects targets that are in contact with the limb.
AfterAttack AIBehaviorAfterAttack FallBack The preferred AI behavior after the attack.
AfterAttackDelay float 0 A delay before reacting after performing an attack.
Reverse bool false Should the AI try to turn around when aiming with this attack?
SnapRopeOnNewAttack bool true Should the rope attached to this limb snap upon choosing a new attack?
Retreat bool false Should the AI try to steer away from the target when aiming with this attack? Best combined with PassiveAggressive behavior.
Range float 0 The min distance from the attack limb to the target before the AI tries to attack.
DamageRange float 0 The min distance from the attack limb to the target to do damage. In distance-based hit detection, the hit will be registered as soon as the target is within the damage range, unless the attack duration has expired.
MinRange float 0 Used by enemy AI to determine the minimum range required for the attack to hit.
Duration float 0.25 An approximation of the attack duration. Effectively defines the time window in which the hit can be registered. If set to too low value, it’s possible that the attack won’t hit the target in time.
CoolDown float 5 How long the AI waits between the attacks.
SecondaryCoolDown float 0 Used as the attack cooldown between different kind of attacks. Does not have effect, if set to 0.
CoolDownRandomFactor float 0 A random factor applied to all cooldowns. Example: 0.1 -> adds a random value between -10% and 10% of the cooldown. Min 0 (default), Max 1 (could disable or double the cooldown in extreme cases).
FullSpeedAfterAttack bool false When set to true, causes the enemy AI to use the fast movement animations when the attack is on cooldown.
StructureDamage float 0 How much damage the attack does to submarine walls.
EmitStructureDamageParticles bool true Whether or not damaging structures with the attack causes damage particles to emit.
ItemDamage float 0 How much damage the attack does to items.
Penetration float 0 Percentage of damage mitigation ignored when hitting armored body parts (deflecting limbs).
LevelWallDamage float 0 How much damage the attack does to level walls.
Ranged bool false Sets whether or not the attack is ranged or not.
AvoidFriendlyFire bool false When enabled the attack will not be launched when there’s a friendly character in the way. Only affects ranged attacks.
RequiredAngle float 20 Used by enemy AI to determine how accurately the attack needs to be aimed for the attack to trigger. Only affects ranged attacks.
RequiredAngleToShoot float 0 By default uses the same value as RequiredAngle. Use if you want to allow selecting the attack but not shooting until the angle is smaller. Only affects ranged attacks.
AimRotationTorque float 0 How much the attack limb is rotated towards the target. Default 0 = no rotation. Only affects ranged attacks.
RotationLimbIndex int -1 Reference to the limb we apply the aim rotation to. By default same as the attack limb. Only affects ranged attacks.
SwayAmount float 0 How much the held weapon is swayed back and forth while aiming. Only affects monsters using ranged weapons (items). Default 0 means the weapon is not swayed at all.
SwayFrequency float 5 How fast the held weapon is swayed back and forth while aiming. Only affects monsters using ranged weapons (items).
Stun float 0 Legacy support. Use Afflictions.
OnlyHumans bool false Can damage only Humans.
ApplyForceOnLimbs string ”” List of limb indices to apply the force into.
Force float 0 Applied to the attacking limb (or limbs defined using ApplyForceOnLimbs). The direction of the force is towards the target that’s being attacked.
RootForceWorldStart Vector2 “0.0, 0.0” Applied to the main limb. In world space coordinates(i.e. 0, 1 pushes the character upwards a bit). The attacker’s facing direction is taken into account.
RootForceWorldMiddle Vector2 “0.0, 0.0” Applied to the main limb. In world space coordinates(i.e. 0, 1 pushes the character upwards a bit). The attacker’s facing direction is taken into account.
RootForceWorldEnd Vector2 “0.0, 0.0” Applied to the main limb. In world space coordinates(i.e. 0, 1 pushes the character upwards a bit). The attacker’s facing direction is taken into account.
RootTransitionEasing TransitionMode Linear Applied to the main limb. The transition smoothing of the applied force.
Torque float 0 Applied to the attacking limb (or limbs defined using ApplyForceOnLimbs)
ApplyForcesOnlyOnce bool false Only apply the force once during the attacks lifetime.
TargetImpulse float 0 Applied to the target the attack hits. The direction of the impulse is from this limb towards the target (use negative values to pull the target closer).
TargetImpulseWorld Vector2 “0.0, 0.0” Applied to the target, in world space coordinates(i.e. 0, -1 pushes the target downwards). The attacker’s facing direction is taken into account.
TargetForce float 0 Applied to the target the attack hits. The direction of the force is from this limb towards the target (use negative values to pull the target closer).
TargetForceWorld Vector2 “0.0, 0.0” Applied to the target, in world space coordinates(i.e. 0, -1 pushes the target downwards). The attacker’s facing direction is taken into account.
SubmarineImpactMultiplier float 1 Affects the strength of the impact effects the limb causes when it hits a submarine.
SeverLimbsProbability float 0 How likely the attack causes target limbs to be severed.
Priority float 0 Used by enemy AI to determine the priority when selecting attacks. When random attacks are disabled on the character it is multiplied with distance to determine the which attack to use. Only attacks that are currently valid are taken into consideration when making the decision.
Blink bool false Triggers the ‘blink’ animation on the attacking limbs when the attack executes. Used e.g. by abyss monsters to make their jaws close when attacking.

Elements

Element Type Description
particleemitter ParticleEmitter Particle emitter to use when the attack deals damage.
sound RoundSound Sound to play when the attack deals damage.
statuseffect StatusEffect StatusEffects to apply when the attack triggers.
StatusEffect types of ‘OnUse’ are executed always, ‘OnFailure’ only when the attack doesn’t deal damage and ‘OnSuccess’ executes when some damage is dealt.