Commands/Lua

Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Lua Command Lua Commands

Category: all (86)

Lua Command ai_iattack

Categories

Parameters

  • id

Info

Bot with given ID performs an intelligent attack.
This includes some additional logic:
  • If the current weapon has limited ammo, is empty and has spare ammo, a reload will be triggered and attacking will continue after reloading

  • If the current weapon is entirely empty (no spare ammo), switch to the next best weapon which can be used for attacking (in most cases pistol or melee)


Note: If you just want to trigger a primary or secondary attack without additional logic you can use ai_attack instead.