I've created a small UI app for BeamNG streamers to use to show the current car name while driving in BeamNG but have run into some issues with the transition from the end of a time-trial to the start of free-roam. I'm using Hooks ("VehicleChange", "VehicleconfigChange") to grab the car name in free-roam and the start of a time trial to use in the UI element. This is working fine at the moment. When the time-trial finishes and the user clicks "Free Roam" the UI changes from the time-trial preset to the free-roam preset. Seemingly I cannot find any hooks that fire on the transition to get the car name out for the free-roam UI's version of my car name element? The "ScenarioChange" hook fires, but seems to be missing the .vehicle parameter for some reason. This means when you transition to the free-roam UI the UI element has no idea what the current car name is. Is there a Stream I can get the name from, or a hook I'm missing that fires on that transition that contains the name? If not, can the free-roam and time-trial UI elements communicate to store what the current car name is? Thanks!
To force Lua to send you this data again use this. Code: bngApi.activeObjectLua('partmgmt.reset()'); You will receive a `VehicleconfigChange` event
Nice thanks, that works for the config event. Is there an object to call reset on to re-call the VehicleChange event? The VehicleconfigChange hook actually doesn't appear to have the car name in it, unless it's deep in the arguments & I missed it.
If you want the data to persist across multiple states I would recommend you use an Angular Service. Attached you can find an example mod of how this could work. Hope this helps!
That works almost perfect! All I had to do is replace Automation car-name underscores and it was good to go. Thanks a bunch.