bad argument #1 to 'HasCondition' (number expected, got nil)

today, all my SNPC are erroring with this:



bad argument #1 to 'HasCondition' (number expected, got nil)


my script excerpt

[lua]
if self.Alerted == true && self:GetEnemy() != NULL && self:GetEnemy() != nil && !self:HasCondition(COND_ENEMY_TOO_FAR) then
self:UpdateEnemyMemory(self:GetEnemy(),self:GetEnemy():GetPos())
self:SetSchedule(SCHED_CHASE_ENEMY)
self.Chasing = true
elseif (self.Alerted == true || math.random(1,8) == 1) then
self:SetSchedule(SCHED_CHASE_ENEMY_FAILED)
self.Alerted = false
else
self:SetSchedule(SCHED_RUN_RANDOM)
end
[/lua]

Google didn’t help at all. anyone?

COND_ENEMY_TOO_FAR isn’t a number, nor assigned to a number. So by googling “COND_ENEMY_TOO_FAR” I ended up in an enumeration list, where COND_ENEMY_TOO_FAR = 27

So just replace COND_ENEMY_TOO_FAR with 27

Thank you! I searched on google but i couldn’t find that enum list, could you send me a link to it?

It’s on the old wiki, http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4389.html

Thanks! Love you <3

Closing thread.