hello! I meet a problam.I'm not sure if my script will work, so I've taken a few screenshots to show you By the way, my English is not very good, so I used machine translation The first screenshot is my script, which has an OnControlValueChange function The second and third screenshots are my input blueprints The fourth screenshot is the control part of my locomotive blueprint
Hello, I don't have much experience with OnControlValueChange-function, other than it doesn't always work. I think it only works if you change a control with key or mouse. In that case it will only work when VirtualThrottleIncrease and VirtualThrottelDecrease is 1, and you will never get that "Holding" state. Just my experience, but I could be wrong. Does the picture show the whole script or do you have more? I recommend moving this to the Update-function. Let me know if you need more help with that.
If you don't find an answer on here maybe ask on RailSim.de - you would have to register https://rail-sim.de/forum/filebase/index.php?filebase/1224-train-simulator/
Hello Oystein.Thank you for your answer, I have defined the specific numerical calculation of the regulator under the update function (I want to emulate the TSK9 controller, which is a "stepless control" controller on a Chinese locomotive) So my current idea is to use VirtualThrottle to detect the player's input, unfortunately if the player drags the regulator hud directly with the mouse, there will be annoying animation problems. Back to the point, what should I do? I can send you the whole script, and I have an idea right now to compare a value with VirtualThrottleIncrease/Decrease, if it's not equal, make a specific judgment, and then finally make the value equal to VirtualThrottle for the next comparison, I'm not sure if this will work. Sorry again for my English question as I'm not very good at English and I used machine translation
I found a way. Enter "ToggleControl" in the name option in the input Blueprint so that the state changes once when the keyboard is pressed and again when lifted, so that it can be detected