Skip to content

AimedTargetStrategyDefinition ​

Inherits: TargetStrategyDefinition < Resource

The target is whatever the user is aiming at (Entity.get_aim: the crosshair or mouse pointer for the player, the target for an NPC). Resolves to an entity when one is aimed at (the locked target, the entity under the aim, or the one closest to the aim line within the assist angle), otherwise to the point the aim hits, so a shot can fly where the player looks. For bows, guns and thrown things; a tab-target game keeps using Enemy.

Properties ​

FilterfilterFilter.ENEMIES
floataim_assist_angle6.0
boolfree_firetrue
boolprefer_locked_targettrue
boolfallback_to_selected_targettrue

Methods ​

Variantresolve( user: Variant )
Dictionaryvalidate_target( strategy_instance: TargetStrategyInstance, _target: Variant, user: Variant )
Variantget_auto_target( _strategy_instance: TargetStrategyInstance, user: Variant )
Variantget_property_value( strategy_instance: TargetStrategyInstance, property_name: String )

Enumerations ​

enum Filter ​

The options of filter: enemies, allies, anyone.

  • ENEMIES = 0 - hostile entities (neutral ones too when the user can attack them)
  • ALLIES = 1 - friendly entities (a healing arrow)
  • ANYONE = 2 - any entity

Property descriptions ​

Aim

Filter filter = Filter.ENEMIES ​

Which entities the aim picks as the target (anything else is just a point on the way)

float aim_assist_angle = 6.0 ​

Aim assist in degrees: an entity this close to the aim line counts as aimed at (0 = exactly under the aim)

bool free_fire = true ​

With no entity aimed at, shoot at the point the aim hits. Off: the shot needs an entity

bool prefer_locked_target = true ​

An entity the user has locked on to is the target whatever the aim says (tab-target and free aim together)

bool fallback_to_selected_target = true ​

With nothing aimed at, the target the user has selected (not locked) is still the target, before a free shot at the aim point (tab-target players keep their target)

Method descriptions ​

Variant resolve( user: Variant ) ​

What the user aims at now: an entity, a point (Vector3), or null (nothing, and no free fire)

Dictionary validate_target( strategy_instance: TargetStrategyInstance, _target: Variant, user: Variant ) ​

The aim decides the target, whatever the controller passed (the basic attack passes the selected target): resolved again for every use

Variant get_auto_target( _strategy_instance: TargetStrategyInstance, user: Variant ) ​

The target the user is aiming at.

Variant get_property_value( strategy_instance: TargetStrategyInstance, property_name: String ) ​

The value of a property of the strategy (a runtime override, else the definition).