Author Message

gorgoil

pt
Posts: 271

Location: Portugal , "Oh Cristiano Ronaldo" Island
Occupation: Valo City Drag Racer/Organizer
Age: 27
V$: 0
#138301   2018-03-04 18:39          
# amilmand : I found a way to set the speed limit for the cruise mode luckily it is set in the AI part of a vehicle which is relatively easy to access here are some lines that can be used to engage the cruise mode and set the speed limit for a given car:
public static final int IndexedData_Flags = 0x70; //these should go in the chassis.java 
public static final int IndexedData_SpeedLimit = 0x2104;
...
int flags = RawEdit.getI(player.car.chassis.getIndexedAddr(Chassis.IndexedData_Flags));//these should go where you want to set the limit
flags |= 0x1000;//this sets the cruise mode on to set it to off this line should be flags &= 0xFFFFEFFF
RawEdit.setI(player.car.chassis.getIndexedAddr(Chassis.IndexedData_Flags),flags);
RawEdit.setF(player.car.chassis.getIndexedAddr(Chassis.IndexedData_SpeedLimit),1.0);
this 1.0 will be the speed limit mind you this is not in kph or anything related its in some arbitrary unit, 13.33 is the fall back value so this 13 should be some theoretical maximum you would need to play with the values to find an optimum. (1.0 is around 5-10 kph)

Added 1 minute later:

I mean this will work on tracks that do not define their trc file I did not test it in Valocity but I would presume the original values in the trc file will overwrite direct manipulation with the RawEdit class.

this is really useful :D
I've figured 1 is around 3.3km/h, and 20 sets the speed limit at 62km/h, this will help me with an idea I had a year ago :D I didn't made that idea because I needed to have a way to set speed limit :D