Hi everyone, I've recently been looking for a way to control the RPM of a diesel locomotive. I'm making a locomotive whose RPM fluctuates freely in the idle state. I tried using SetControlValue in the script's Update function to control the RPM, but it failed. Does anyone have a good way to control the RPM?
You have to replace the in-game RPM with a virtual rpm that you fully script yourself. "VirtualRPM" is the name for the control value.
If I want to control BrakePipePressure or other pressure-related controls, should I add "Virtual" to the control value?
You can use "Virtual" for any TSC control value name, except for Reverser, which uses "UserVirtualReverser". So Virtual<ControlValueName>. The ThrottleAndBrake is already a virtual control, used to allow a combined control on the HUD.
Thank you, but I tested it. For those pressure Control Value Names, the UI still changes according to the original Control Value Name, but when I hover the mouse over the UI, the value displayed is the Virtual value. Is this a bug?
Like this, the brake pipe pressure (the blue bar on the right) Virtual value is 0, the original value is 5, and the UI is showing 5. I checked my spelling, and there's nothing wrong with it.
Make sure the names are correct, VirtualBrakePipePressureBAR, VirtualLocoBrakeCylinderPressureBAR (or PSI)
Initially I didn't add any suffix to the pressure Control Value Name. Now I've added the BAR suffix, and the value shown in the UI has also changed to the original control's value. This is my game screenshot. Both of my Virtual values are 0, and the original values are all normal
BrakePipePressureBAR TrainBrakeCylinderPressureBAR VirtualBrakePipePressureBAR VirtualTrainBrakeCylinderPressureBAR I copied all these strings from the Blueprint Editor. I think my spelling is fine.
After my testing, VirtualTrainBrakeCylinderPressure (without any suffix) can fully control the UI. Regardless of what the original value is, the UI will display the value of VirtualTrainBrakeCylinderPressure. But for VirtualBrakePipePressure, the UI displays the larger of the virtual value and the original value as the UI's input.
Note that you must not add any suffix to any pressure-related control values; otherwise, the Virtual control will completely fail.
Good to know. I guess it replaces the default control value without caring about if it is PSI or BAR. So it makes sense that you don't need that suffix.