A Engine Script Problam

Discussion in 'General Discussion' started by wenxdx, Sep 1, 2025.

  1. wenxdx

    wenxdx New Member

    Joined:
    Sep 1, 2025
    Messages:
    8
    Likes Received:
    0
    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
     

    Attached Files:

    Last edited: Sep 1, 2025
  2. wenxdx

    wenxdx New Member

    Joined:
    Sep 1, 2025
    Messages:
    8
    Likes Received:
    0
    If I made a mistake, please let me know, thank you!
     
  3. Oystein

    Oystein Well-Known Member

    Joined:
    May 24, 2018
    Messages:
    321
    Likes Received:
    325
    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.
     
  4. 749006

    749006 Well-Known Member

    Joined:
    Dec 10, 2016
    Messages:
    10,399
    Likes Received:
    3,230
  5. wenxdx

    wenxdx New Member

    Joined:
    Sep 1, 2025
    Messages:
    8
    Likes Received:
    0
    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
     
  6. wenxdx

    wenxdx New Member

    Joined:
    Sep 1, 2025
    Messages:
    8
    Likes Received:
    0
    Here is my whole Script of my locomotive
     

    Attached Files:

  7. wenxdx

    wenxdx New Member

    Joined:
    Sep 1, 2025
    Messages:
    8
    Likes Received:
    0
    I haven't finished writing the smoke part yet (
     
  8. wenxdx

    wenxdx New Member

    Joined:
    Sep 1, 2025
    Messages:
    8
    Likes Received:
    0
  9. wenxdx

    wenxdx New Member

    Joined:
    Sep 1, 2025
    Messages:
    8
    Likes Received:
    0
    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
     

Share This Page