How To Control Rpm Of The Diesel

Discussion in 'General Discussion' started by wenxdx, Sep 12, 2026.

  1. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    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?
     
  2. Oystein

    Oystein Well-Known Member

    Joined:
    May 24, 2018
    Messages:
    421
    Likes Received:
    347
    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.
     
    • Like Like x 1
  3. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    Thank you very very much
     
  4. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    If I want to control BrakePipePressure or other pressure-related controls, should I add "Virtual" to the control value?
     
  5. Oystein

    Oystein Well-Known Member

    Joined:
    May 24, 2018
    Messages:
    421
    Likes Received:
    347
    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.
     
    • Like Like x 1
  6. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    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?
     
  7. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    6e792f57-0f37-4440-b12c-af1c23ff60a8.png e6511cde-b853-4f90-b463-2427f55b9586.png 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.
     
  8. Oystein

    Oystein Well-Known Member

    Joined:
    May 24, 2018
    Messages:
    421
    Likes Received:
    347
    Make sure the names are correct, VirtualBrakePipePressureBAR, VirtualLocoBrakeCylinderPressureBAR (or PSI)
     
  9. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    upload_2026-9-14_18-49-47.png 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
     
  10. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    BrakePipePressureBAR
    TrainBrakeCylinderPressureBAR

    VirtualBrakePipePressureBAR
    VirtualTrainBrakeCylinderPressureBAR

    I copied all these strings from the Blueprint Editor. I think my spelling is fine.
     
  11. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    TrainBrakeCylinderPressure
    Fix: VirtualTrainBrakeCylinderPressure Can control UI
     
  12. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    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.
     
  13. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    Note that you must not add any suffix to any pressure-related control values; otherwise, the Virtual control will completely fail.
     
  14. Oystein

    Oystein Well-Known Member

    Joined:
    May 24, 2018
    Messages:
    421
    Likes Received:
    347
    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.
     
    • Helpful Helpful x 1
  15. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    But the problem is, how can I fully control the brake pipe pressure displayed on the UI? My idea is to set the original control's maximum value to 0. That shouldn't affect the game's physics engine?
     
  16. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    In short, thank you, Oystein
     
  17. Oystein

    Oystein Well-Known Member

    Joined:
    May 24, 2018
    Messages:
    421
    Likes Received:
    347
    Could you try to replace the BrakePipePressureBAR with VirtualBrakePipePressureBAR?
     
  18. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    It won't work. The UI will just display the original control's value, same for TrainBrakeCylinderPressure
     
    Last edited: Sep 15, 2026
  19. Oystein

    Oystein Well-Known Member

    Joined:
    May 24, 2018
    Messages:
    421
    Likes Received:
    347
    Yes, but if you remove it and just use the virtual one?
     
  20. wenxdx

    wenxdx Member

    Joined:
    Sep 1, 2025
    Messages:
    49
    Likes Received:
    1
    It doesn't work. When I hover over the UI, it doesn't even show a number
     

Share This Page