Functions (Enemies) - ShadowBonnieRUS/GMOD-SB_Advanced_Nextbots_Base GitHub Wiki

Here are descriptions for functions used in base in enemy.lua file.

Marks help


🔹 NEXTBOT:SetEnemy

Sets active enemy of bot.

Arguments: 1

  1. Entity | Enemy to set.

Returns: 0


🔹 NEXTBOT:GetEnemy

Returns active enemy of bot.

Arguments: 0
Returns: 1

  1. Entity | Enemy.

🔹 NEXTBOT:SetClassRelationship

Sets how bot feels towards entities with that class.

Arguments: 3

  1. string | Entities classname.
  2. number | Disposition. See D_* Enums.
  3. ⭕ number | How strong relationship is.

Returns: 0


🔹 NEXTBOT:SetEntityRelationship

Sets how bot feels towards entity.

Arguments: 3

  1. Entity | Entity to apply relationship
  2. number | Disposition. See D_* Enums
  3. ⭕ number | How strong relationship is.

Returns: 0


🔹 NEXTBOT:GetRelationship

Returns how bot feels about this entity.

Arguments: 1

  1. Entity | Entity to get disposition from.

Returns: 2

  1. number | Priority disposition. See D_* Enums.
  2. number | Priority of disposition.

🔹 NEXTBOT:EntShootPos

Returns where bot should aim while shooting at this entity. Also used in line of sight tests.

Arguments: 2

  1. Entity | Entity to get shoot pos.
  2. ⭕ bool | Should choose random hitbox to get position.

Returns: 1

  1. number | Vector | Position where we should aim.

🔹 NEXTBOT:CanSeePosition

Line of sight test. Returns should we see that position.

Arguments: 1

  1. Vector | Position to test. Can be also Entity, in this case will be used NEXTBOT:EntShootPos position.

Returns: 1

  1. bool | Bot see position or not.

🔹 NEXTBOT:UpdateEnemyMemory

Updates bot's memory of this enemy.

Arguments: 2

  1. Entity | Enemy to update.
  2. Vector | Position where bot see enemy.

Returns: 0


🔹 NEXTBOT:ClearEnemyMemory

Clears bot memory of this enemy.

Arguments: 1

  1. ⭕ Entity | enemy | Enemy to clear memory of. If unset, will be used NEXTBOT:GetEnemy

Returns: 0


🔹 NEXTBOT:FindEnemies

Finds all enemies that can be seen from bot position and updates memory.

Arguments: 0
Returns: 0


🔹 NEXTBOT:GetKnownEnemies

Returns all entities that in bot's enemy memory.

Arguments: 0
Returns: 1

  1. table | Enemies table

🔹 NEXTBOT:GetLastEnemyPosition

Returns last updated position of enemy.

Arguments: 1

  1. Entity | Enemy to get position.

Returns: 1

  1. Vector | Last known position. Returns nil if enemy is not in bot memory.

🔹 NEXTBOT:HaveEnemy

Returns if bot have enemy.

Arguments: 0
Returns: 1

  1. bool | Bot have enemy or not.

⚠️🔹 NEXTBOT:ForgetOldEnemies

Clears bot memory from enemies that not valid, not updating very long time or not should be enemy.

Arguments: 0
Returns: 0


🔹 NEXTBOT:ShouldBeEnemy

Returns should bot mark this entity as enemy.

Arguments: 1

  1. Entity | Entity to check.

Returns: 1

  1. bool | Should be enemy or not.

🔹 NEXTBOT:FindPriorityEnemy

Returns highest priority enemy.

Arguments: 0
Returns: 1

  1. Entity | Highest priority enemy or NULL.