Does any one know any way of getting setAiMode(nameOfCar, 'manual') to work I have all waypoints set up but it never attempts to follow the route. however if I set the mode to flee that works just fine! please help here is my code local M = {} local running = true local scenario = nil local speed = 0 local helper = require('scenario/scenariohelper') local function reset() running = false end local function fail(reason) scenarios.finish({failed = reason}) reset() end local function success(speed) local result = {msg = 'Well done, your speed: '..string.format("%0.2f", speed * 3.6)..'km/h'} scenarios.finish(result) reset() end local function onRaceStart() reset() helper.init() helper.setAiMode('aiCar1', 'manual') helper.setAiRoute('aiCar1', {"ai_wp_1", "ai_wp_2", "ai_wp_3", "ai_wp_4", "ai_wp_5", "ai_wp_6", "ai_wp_7", "ai_wp_8", "ai_wp_9"}) helper.trackVehicle('aiCar1', 'aiCar') helper.trackVehicle('scenario_player0', 'playerCar') running = true end local function onRaceTick(raceTickTime) if not running then return end helper.update(raceTickTime) local aiCarData = map.objects.aiCar local playerCarData = map.objects.playerCar if not aiCarData or not playerCarData then return end if aiCarData.damage > 0 and speed == 0 then speed = playerCarData.vel:length() end if aiCarData.damage >= 5000 then success(speed) end if scenario.timer > 18 then fail("You lost!") end end local function onScenarioChange(sc) scenario = sc end M.onRaceStart = onRaceStart M.onRaceTick = onRaceTick M.onScenarioChange = onScenarioChange return M
Thanks for the reply. Yea, the names all match up. I've tried so many things to get this going. But it never wants to follow the waypoints. Ill post my prefab code up here later so it can be compared. I can't do it now as not at home. Thanks in advance and to Nadeox1 for the reply
Is the AI car placed near the first waypoint? (better if very close). The waypoints also must form an actual route, else the AI will not know how to reach the nodes (it doesn't drive straight to them)
Yea, I've poured a fair few hours into this en-devour now and no luck. any chance you (or any one else who wants to) could take look for me? I've attached the scenario to this and it needs extracting and putting into my rally ridge level "documents/beamng/mods/levels/rallyridge" If I get this sorted I'll have a massive scenario update for my map. so I'm keen to work it out. Thanks in advance
Ok, I got it working just using the path nodes I already had laid down for my mesh roads. Still not sure why I couldn't get the AI to follow my custom set of markers.