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

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

Marks help


🔹 NEXTBOT:Give

Gives weapon to bot.

Arguments: 1

  1. string | Class name of weapon.

Returns: 1

  1. Weapon | Weapon given to bot. Returns NULL if failed to give this weapon.

🔹 NEXTBOT:GetActiveLuaWeapon

Returns current weapon entity. If active weapon is engine weapon, returns lua analog.

Arguments: 0
Returns: 1

  1. Weapon | Active weapon.

🔹 NEXTBOT:SetupWeapon

Makes bot hold this weapon.

Arguments: 1

  1. Weapon | Weapon to hold. Returns: 1
  2. Weapon | Parented weapon. If given weapon is engine weapon, then this will be lua analog. Returns nil if failed to setup.

🔹 NEXTBOT:DropWeapon

Drops current active weapon.

Arguments: 2

  1. ⭕ Vector | Sets velocity of weapon. Max speed is 400.
  2. ⭕ bool | If true, just drop weapon from current hand position. Don't apply velocity and position. Returns: 1
  3. Weapon | Dropped weapon. If active weapon is lua analog of engine weapon, then this will be engine weapon, not lua analog.

⚠️🔹 NEXTBOT:ReloadWeaponData

Reloads weapon data like burst and reload settings.

Arguments: 0
Returns: 0


🔹 NEXTBOT:CanWeaponPrimaryAttack

Returns can bot do primary attack or not.

Arguments: 0
Returns: 1

  1. bool | Can do primary attack

🔹 NEXTBOT:WeaponPrimaryAttack

Does primary attack from bot's active weapon. This also can use burst data from weapon.

Arguments: 0
Returns: 0


🔹 NEXTBOT:CanWeaponSecondaryAttack

Returns can bot do secondary attack or not.

Arguments: 0
Returns: 1

  1. bool | Can do secondary attack

🔹 NEXTBOT:WeaponSecondaryAttack

Does secondary attack from bot's active weapon.

Arguments: 0
Returns: 0


🔹 NEXTBOT:GetAimVector

Returns direction that used for weapon, including spread.

Arguments: 0
Returns: 1

  1. Vector | Aim direction.

🔹 NEXTBOT:DoRangeGesture

Make primary attack range animation.

Arguments: 0
Returns: 1

  1. number | Animation duration.

🔹 NEXTBOT:DoReloadGesture

Make reload animation.

Arguments: 0
Returns: 1

  1. number | Animation duration.

🔹 NEXTBOT:WeaponReload

Reloads active weapon and do reload animation. Does nothing if we reloading already or if weapon clip is full.

Arguments: 0
Returns: 0


🔹 NEXTBOT:SetCurrentWeaponProficiency

Sets how skilled bot with weapons. See WEAPON_PROFICIENCY_ Enums.

Arguments: 1

  1. number | Weapon proficiency

Returns: 0


🔹 NEXTBOT:GetCurrentWeaponProficiency

Returns how skilled bot with weapons. See WEAPON_PROFICIENCY_ Enums.

Arguments: 0
Returns: 1 number | Weapon proficiency


🔹 NEXTBOT:OnWeaponEquip

Called when bot equips weapon.

Arguments: 1

  1. Entity | Equiped weapon. It will be not lua analog.

Returns: 0


🔹 NEXTBOT:OnWeaponDrop

Called when bot drops weapon.

Arguments: 1

  1. Entity | Dropped weapon. It will be not lua analog.

Returns: 0


🔹 NEXTBOT:CanPickupWeapon

Returns can we pickup this weapon.

Arguments: 1

  1. Entity | Entity to test. Not necessary Weapon entity.

Returns: 1

  1. bool | Can pickup or not.

🔹 NEXTBOT:CanDropWeaponOnDie

Decides can bot drop weapon on die. NOTE: Weapon also may not drop even with true if weapon's SWEP:ShouldDropOnDie returns false.

Arguments: 1

  1. Weapon | Current active weapon (this will be lua analog for engine weapon).

Returns: 1

  1. bool | Can drop.

🔹 NEXTBOT:ShouldWeaponAttackUseBurst

Decides should bot shoot with bursts.

Arguments: 1

  1. Weapon | Current active weapon (this will be lua analog for engine weapon).

Returns: 1

  1. bool | Should use bursts.

🔹 NEXTBOT:IsMeleeWeapon

Returns true if weapon marked as for melee attacks (using CAP_* Enums).

Arguments: 1

  1. ⭕ Weapon | Weapon to check (this should be lua analog for engine weapon). Without passing will be used active weapon.

Returns: 1

  1. bool | Weapon is melee weapon.