Author Message

amilmand

00
Posts: 259

Location: ---
Occupation:
Age:
V$:
#138281   2018-03-04 11:15          
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.