API Docs for:
Show:

AIScriptChargeEnemies Class

An AI script object. Causes the entity to speed up if an enemy entity is detected in front of it. The speed increase is handled by a spell effect, so the corresponding component needs to be present on the entity, additionally the GroundedMovement component, a Position and a FacingDirection are required. This script doesn't cause the entity to move, it should be paired with the walk script.

Constructor

AIScriptChargeEnemies

(
  • chargeTargetDetectorRange
  • chargingSpeedMultiplier
)

Parameters:

  • chargeTargetDetectorRange Number

    The enemy detection range. The script uses a ray to query for enemies. The ray is constructed automatically by using a ground tangent stored on the GroundedMovement component. Thanks to this, the ray always runs along the ground and the entity can charge enemies up and down hill.

  • chargingSpeedMultiplier Number

    The speed multiplier that will be used to construct the MovementSpeedSpellEffect.

Methods

getChargeTargetDetectorRange

() Number

Returns:

Number:

getChargingSpeedMultiplier

() Number

Returns:

Number:

isCharging

() Boolean

Returns:

Boolean: Returns true if the entity is currently charging.

setChargeTargetDetectorRange

(
  • chargeTargetDetectorRange
)

Parameters:

  • chargeTargetDetectorRange Number

    The enemy detection range. The script uses a ray to query for enemies. The ray is constructed automatically by using a ground tangent stored on the GroundedMovement component. Thanks to this, the ray always runs along the ground and the entity can charge enemies up and down hill.

setChargingSpeedMultiplier

(
  • chargingSpeedMultiplier
)

Parameters:

  • chargingSpeedMultiplier Number

    The speed multiplier that will be used to construct the MovementSpeedSpellEffect.