[RunString:9] attempt to call method 'StartSchedule' (a nil value)

Title says it, I’m using the example from the wiki and running it and I get this:

[RunString:9] attempt to call method ‘StartSchedule’ (a nil value)

it’s really aggravating considering it’s the example from the wiki. ( with some editing )


for k, v in pairs( ents.FindByClass("npc_*") ) do

local schdRunner= ai_schedule.New( "AI Random Run" )
schdRunner:EngTask("TASK_GET_PATH_TO_RANDOM_NODE", 128)
schdRunner:EngTask("TASK_RUN_PATH", 0)
schdRunner:EngTask("TASK_RELOAD", 0)
v:StartSchedule(schdRunner)

end

I don’t know much about AI programming but I found that this is somewhat related to the Schedule that you’re using.

http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index6826.html

Replace your code with this instead, if this doesn’t work sorry I can’t help you.

Thank you, I will test that code whenever I am able too. It seems that nobody knows anything about AI programming.