- 325

- France
@sab001 and @ninezeroniner
here's an example script to force the wastegate/turboboost at optimal value for a Porsche 935 AI. It looks like this , so you can edit it for different cars.
if car.index == 0 then return end -- car#0 being the player's one, let's avoid it to let the player decides
ac.setTurboWastegate(0, 0.85, false) -- 0 being the turbo index (first one), 0.85 being the wastegate value, same as in engine.ini, and "false" being the adjustable activation.
ac.setTurboWastegate(1, 0.85, false) -- same idea, for the second turbo.
ac.debug("turbo_script", "ACTIVE car#" .. car.index) -- a debug that would appear in luadebug to check the script is active
ac.debug("turbo_boost", car.turboBoost) -- the debug to show the turbo boost value.
ac.debug("engine_life", car.engineLifeLeft) --a debug to make sure the Ai isn't destroying the engine
Now, i got those values from the engine.ini file :
Having the wastegate @0.85 and 2 turbos, IF understand this correctly, we end up with a turboboost of 1.7. The engine would take damage @ a turboboost of 1.75, so with these values in the script the AI should be safe.
You could experiment and see if the AI can handle some engine damage thru the race and adapt the ac.setTurboWastegate depending on your needs, see if it goes faster with higher values.
Using this technique you can also copy the script to different cars and adapt it depending on their respective engine and turbo values.
To activate it and see if it works : select the Porsche 935, unpack its data using Content Manager, copy the script into the data folder, and pack the data again. I read somewhere you could delete the acd and edit real time but i haven't tried yet. (EDIT : tested, it works, so you can edit the wastegate value real time if you unpack the data and delete the acd).
Ingame, opening the luadebug, each car should have the script running, showing the amount of turbo boost real time, the engine life left and if the script is active :
I don't know if adding a script in the car data would create an error online, so either use AC Car Tuner to create a car copy first or remember to delete the script if it creates online rejections.
I'll dig into this at some point and see if you could create specific setups for the AI using the same technique.
Edit : cached the read values so it doesn't leak memory. I added all the damages so it's easy to see in the debug to spot pace issues.
here's an example script to force the wastegate/turboboost at optimal value for a Porsche 935 AI. It looks like this , so you can edit it for different cars.
if car.index == 0 then return end -- car#0 being the player's one, let's avoid it to let the player decides
ac.setTurboWastegate(0, 0.85, false) -- 0 being the turbo index (first one), 0.85 being the wastegate value, same as in engine.ini, and "false" being the adjustable activation.
ac.setTurboWastegate(1, 0.85, false) -- same idea, for the second turbo.
ac.debug("turbo_script", "ACTIVE car#" .. car.index) -- a debug that would appear in luadebug to check the script is active
ac.debug("turbo_boost", car.turboBoost) -- the debug to show the turbo boost value.
ac.debug("engine_life", car.engineLifeLeft) --a debug to make sure the Ai isn't destroying the engine
Now, i got those values from the engine.ini file :
Having the wastegate @0.85 and 2 turbos, IF understand this correctly, we end up with a turboboost of 1.7. The engine would take damage @ a turboboost of 1.75, so with these values in the script the AI should be safe.
You could experiment and see if the AI can handle some engine damage thru the race and adapt the ac.setTurboWastegate depending on your needs, see if it goes faster with higher values.
Using this technique you can also copy the script to different cars and adapt it depending on their respective engine and turbo values.
To activate it and see if it works : select the Porsche 935, unpack its data using Content Manager, copy the script into the data folder, and pack the data again. I read somewhere you could delete the acd and edit real time but i haven't tried yet. (EDIT : tested, it works, so you can edit the wastegate value real time if you unpack the data and delete the acd).
Ingame, opening the luadebug, each car should have the script running, showing the amount of turbo boost real time, the engine life left and if the script is active :
I don't know if adding a script in the car data would create an error online, so either use AC Car Tuner to create a car copy first or remember to delete the script if it creates online rejections.
I'll dig into this at some point and see if you could create specific setups for the AI using the same technique.
Edit : cached the read values so it doesn't leak memory. I added all the damages so it's easy to see in the debug to spot pace issues.
Attachments
Last edited: