A way to disable player movement?

  • #1, by fabian-schurgersFriday, 26. April, 09:45 A week ago
    Hi there,

    I was wondering if there is an easy way to disable player movement during cut-scenes and other important stuff.

    Now, I use a different way system, which locks the player in place, but this is a bit work-intensive.
    Anyone know of a better way?

    Thanks!

    Best regards,

    Fabian

    Forum Fan

    132 Posts


  • #2, by esmeraldaFriday, 26. April, 13:15 A week ago
    you don't mean cutscenes you start/end with the action part "begin/end cutscene", right? Because if you use that (or the "show/hide cursor" action part) this will automatically hide the cursor and disable any interaction.

    So interaction should still be possible, but the player isn't allowed to move?
    I can think of two solutions:
    1. changing the waysystem, like you already did
    2. change the Leftclick behaviour you have set in the game properties with a line of Lua in an execute script action part. (and change it back later)
    game.LeftClickBehaviour = 0

    0 (or eMouseActionBehaviourDoNotSendCharacter): The character will not be send to the current position.
    1 (eMouseActionBehaviourSendCharacterToCursor): Character will be send to current position.
    2 (eMouseActionBehaviourSendCharacterToObjects): Character will be send to current position if it is a scene object.
    The same for rightclick
    game.RightClickBehaviour = 0


    Be careful when using this: the state of the behaviour will not be saved into the savegame data. That means if you load another savegame while the behaviour was changed, it will not change back. So the player will stay stuck in other scenes. So best practice is either check on game load what the behaviour should be or block saving or exiting the game while the behaviour is changed.

    Edit: 
    oh, you could also change the speed of the character to 0 and then back to 100, but that will cause the character to walk on the spot if you click anywhere...

    Key Killer

    514 Posts

  • #3, by fabian-schurgersFriday, 26. April, 15:19 A week ago
    Thanks for the help and the information!

    I'm going to try that!


    Forum Fan

    132 Posts

  • #4, by fabian-schurgersFriday, 26. April, 15:30 A week ago
    The 'game.LeftClickBehaviour = 0' works nicely.

    Thanks again for your help!

    Forum Fan

    132 Posts

Write post