SNPC's broken

My custom NPC spams this error to console:



[ERROR] lua/includes/modules/ai_task.lua:117: bad argument #1 to 'RunEngineTask' (number expected, got nil)
  1. RunEngineTask - [C]:-1
   2. Run - lua/includes/modules/ai_task.lua:117
    3. RunTask - gamemodes/base/entities/entities/base_ai/schedules.lua:148
     4. DoSchedule - gamemodes/base/entities/entities/base_ai/schedules.lua:71
      5. unknown - gamemodes/base/entities/entities/base_ai/schedules.lua:22



How to fix it?

Code?

[lua]
local schdShoot = ai_schedule.New( “Shoot Enemy” )
schdShoot:EngTask( “TASK_WAIT_FACE_ENEMY”, 0.1 )
schdShoot:EngTask( “TASK_ANNOUNCE_ATTACK”, 0 )
schdShoot:EngTask( “TASK_RANGE_ATTACK1”, 0 )
[/lua]
and error comes from:
[lua]
self:StartSchedule( schdShoot )
[/lua]

SNPCs are broken. Deal with it. Use NextBot NPCs.

NextBot NPCs are broken as well:

  • Can’t fire weapons.
  • Can’t move in any other map than gm_construct.
  • Other NPCs can’t attack them. AddRelationShip gives an error.
  1. Must implement yourself. ( For now I believe ) I don’t remember SNPCs able to use the weapons as well, although I might be wrong.
  2. False.
  3. Might be true.

My SNPC did use weapon, but because of StartSchedule error, it no longer can.

How to make NextBot fire weapons?
Tried:
[lua]
self.Weapon = ents.Create(“weapon_smg1”)
self.Weapon:PrimaryFire()
[/lua]
output:



attempt to call method 'PrimaryFire' (a nil value)


That’s because weapon_smg1 is not a Lua weapon. There are not way to force it to fire. Try using a SWEP or something. Also remember that you need to bonemerge the weapon to NextBox so it actually appears in its hand.