I am making a Nextbot NPC and for the movement AI I am trying to get it to move to a random point in a radius but make sure it can be pathed to. I have tried just using a random point in a radius and that didn’t work well. In the ENT.RunBehaviour method I have the following:
local navareas = navmesh.Find(self:GetPos(),math.random(50,500),50,25) local navarea,_ = table.Random(navareas) local areapos = navarea:GetCorner(0)
However I got an error saying that the method GetCorner was nil. After doing some more digging I found that almost every (haven’t quite checked them all) CNavArea method is nil except GetID so I tried to use the navmesh.GetNavAreaByID function with this code:
local navareas = navmesh.Find(self:GetPos(),math.random(50,500),50,25) local navid,_ = table.Random(navareas) local navarea = navmesh.GetNavAreaByID(navid:GetID()) local areapos = navarea:GetCorner(0)
Apparently that function is also nil. So I am wondering if anyone knows why this is happening or if the version of Gmod with these functions/methods is not out yet.
Edit: Saw the thread about the next update and found them in the change log.