Skip to content

← Previous | Next →


distanceEntityClose

Description

Checks if the NPC is within a specified distance from a given entity.

Basic information

Name Type Possibilities
distanceEntityClose both 2

Parameters

# Name Type Mandatory Description Multiple
1 distance number Yes The maximum distance within which the NPC should be to return a positive result. No
2 entity Entity Yes The entity to check the distance against. No

Outputs

# Description
1 The NPC is within the specified distance from the entity.
2 The NPC is not within the specified distance from the entity.

Example


  NPC 

  name Guard 
  model s_m_y_cop_01 
  position -1020.72 4839.78 258.30 0.0 

  interaction 
    nothing 

  behaviour 
    getClosestPlayer player 10 
      distanceEntityClose 5.0 player 
        tell "The NPC is close to the player." 
        tell "The NPC is not close enough to the player."