Increase Walking Speed with lua

  • #1, by rusty-peteFriday, 07. April 2023, 13:03 A year ago
    Hi, I want a character's movement speed to change when a key is pressed and I don't know how to access the speed with lua. 

    thanks.

    Newbie

    2 Posts


  • #2, by afrlmeFriday, 07. April 2023, 13:48 A year ago
    Hmm, it would depend on which walking system option you are using.

    If you are using the default sliding walk system, then you can adjust the walk speed beloning to the character - there's actually an action part (change character speed) for that in the action parts belonging to the character category, so there's no need to use script.

    However, if you do want to script it, you can use this line of code...

    game.CurrentCharacter.CurrentOutfit.CharacterSpeed = 100

    Now the other walk system, which updates the characters movement on frame change instead of sliding the character x amount of distance between frame changes, requires you to either create a new outfit that has a smaller duration between each walk frame, or to use code to change the default duration belonging to the animation frames or to adjust the duration of each frame if you are using custom duration values for each frame to simulate kinetic motion.

    I'm going to guess that you are probably using the default slide walk system, so the first part I wrote is probably all you actually needed to know.

    Imperator

    7278 Posts

  • #3, by rusty-peteFriday, 07. April 2023, 14:24 A year ago
    This helps. Thank you

    Newbie

    2 Posts