• Register

The near future: Trains are no longer controlled by humans. Instead, artificial intelligence is used to handle traffic. Program the best AI, beat challenges on various maps and watch it fight other AIs in live, online matches!

Forum Thread
  Posts  
How to get the number of available passengers? (Games : TrAInsported : Forum : General AI questions : How to get the number of available passengers?) Locked
Thread Options
Oct 29 2015 Anchor

HI!

How can I find the list of passengers such of the Tutorial 4. ai.foundPassenger part

    pass = nil 
    i = 1
    while i <= #passengers do
      -- some code to find the nearest passenger and save it to pass variable
     end
     return pass
end

But when I tried it on ai.chooseDirection it returns a error somthing like "cannot get the length of a global passengers (a nil value)"

any suggestions is highly appreciated.

Thanks!

Reply to thread
click to sign in and post

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.