--Prevent standalone execution: if not TRAINSPORTED then print("To prevent players from harm, this file may only be executed by the trAInsported game.") return end --AI by 0b21a: function ai.init( map, money ) print("start") startx = math.random(1,10) starty = math.random(1,10) buyTrain(startx,starty) print("X:" .. startx .. "Y:" .. starty) w = 0 end function ai.foundDestination(train,dirrctions) dropPassenger(train) w = 0 end function ai.enoughMoney() buyTrain(startx,starty) end function ai.foundPassengers(train,passengers) return passengers[1] end function ai.chooseDirection(train,dirrctions) randomD = math.random(0,3) if train.passenger ~= nil and w <= 20 then if train.passenger.destX < train.x then return "W" else return "E" end if train.passenger.destY < train.Y then return "S" else return "N" end else if randomD == 0 then return "N" elseif randomD == 1 then return "E" elseif randomD == 2 then return "S" elseif randomD == 3 then return "W" end end end