rcar $car = get scriptowner car
// inc throttle below idle target
// dec throttle above idle target
// off throttle above off target
float $incthrottle = 0.22
float $decthrottle = 0.16
float $offthrottle = 0.02
float $idletarget = 1600
float $offtarget = 1800
// time in milliseconds
int $checktime = 250
int $curtime = 0
// and some variables that will get read each step
float $throttle = 0.0
int $time = 0
float $rpm = 0
while 1
{
$time = simtime
if $curtime < $time
{
$curtime = $time + $checktime
$throttle = get $car throttle
$rpm = get $car rpm
}
// update throttle every step anyway
if $rpm > $offtarget
{
if $throttle < $offthrottle
{
set $car throttle $offthrottle
}
}
else if $rpm > $idletarget
{
if $throttle < $decthrottle
{
set $car throttle $decthrottle
}
}
else
{
if $throttle < $incthrottle
{
set $car throttle $incthrottle
}
}
interrupt
}
Yeah, I didn't look too closely at what was going on but it seemed like the AI was pushing the pedal to the floor and just failing to slow down. The Racer AI's not really that competitive anyway, the 100% guys were accelerating to a top speed about 30km/h below mine, doing laps ~79 vs. 95 seconds.ABS should work ok with AI, but sometimes it gets confused it seems as I've had AI not wanting to break for corners... but then reset it all and it's working ok. Weird.
where do you go in the files to put this code?rcar $car = get scriptowner car // inc throttle below idle target // dec throttle above idle target // off throttle above off target float $incthrottle = 0.22 float $decthrottle = 0.16 float $offthrottle = 0.02 float $idletarget = 1600 float $offtarget = 1800 // time in milliseconds int $checktime = 250 int $curtime = 0 // and some variables that will get read each step float $throttle = 0.0 int $time = 0 float $rpm = 0 while 1 { $time = simtime if $curtime < $time { $curtime = $time + $checktime $throttle = get $car throttle $rpm = get $car rpm } // update throttle every step anyway if $rpm > $offtarget { if $throttle < $offthrottle { set $car throttle $offthrottle } } else if $rpm > $idletarget { if $throttle < $decthrottle { set $car throttle $decthrottle } } else { if $throttle < $incthrottle { set $car throttle $incthrottle } } interrupt }
from inside the specific car's folder, \scripts\physics\ and create a text file roughidle.rsx then put it in that.where do you go in the files to put this code?