How would I change levels using lua triggers? I tried to ask ChatGPT for a lua snippet and got this function startGridMapLevel() return 'beamng.sendGameEngine(\'startLevel("levels/GridMap/GridMap.mis");\')' end which turned out to be invalid enough to crash the game. Any help?
Lmao that's brilliant, I wonder what causes the crash, I'm intrigued. And to start a level, you do this: Code: core_levels.startLevel("/levels/west_coast_usa/main.level.json") -- replace west_coast_usa with the map name To find things like this, open the lua directory in the game's installation folder. Within that folder are hundreds of files, you can open the folder in an editor and browse through. So just think of what something would be called and then search for it (startLevel for example)
Yeah, not the best idea to ask ChatGPT about programming, especially for games. It's not the best lol
COMPLICATION TIME: I need it for a map I'm making in an 8 year old version of beam (0.3.7.4) (I'm doing it for fun and your answer will help when I port the map to latest)
Update: I figured out how to load levels via the console (the function is loadLevel( "level path" )) but it still crashes the game when I try to use that same thing on a trigger
Please note that this is all in BeamNG.drive version 0.3.7.4. I was trying to use the Trigger instead of the BeamNG Trigger. I think the default T3D trigger is just glitchy, like the lightning entity that also crashes the game. It's all in the map editor, though. --- Post updated --- I can't seem to get the beamng trigger to work, but I did find a lua function called clientStartMission('levels/level/thelevel') --- Post updated --- is this code any good? local function startTheLevel(thelevel) gameEngine:loadLevel( thelevel ) end startTheLevel('levels/GridMap/GridMap.mis') end
You could try to queue the command to itself, maybe that fixes the crash, so the level loading does not happen in the trigger: Code: be:queueLuaCommand('print("hello world")')
I don't think that did much (maybe it's because of how old this version of the game is) --- Post updated --- it's actually so old that the torque triggers still exist
because of the technical difficulties encountered when trying to add level change triggers, they will not be added in the 0.3-compatible version of the map. they will be present in the version of the map built for the latest version of the game, however. this means the latest version of the map will functionally be significantly larger than the 0.3-compatible version