bad argument #1 to 'HasCondition' (number expected, got nil)
4 replies, posted
today, all my SNPC are erroring with this:
[code]
bad argument #1 to 'HasCondition' (number expected, got nil)
[/code]
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
[QUOTE=Persious;42252270]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[/QUOTE]
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, [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4389.html[/url]
[QUOTE=Persious;42252363]It's on the old wiki, [url]http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4389.html[/url][/QUOTE]
Thanks! Love you <3
Closing thread.
Sorry, you need to Log In to post a reply to this thread.