Distance of walking

  • #1, by TinTinWednesday, 30. March 2016, 16:21 4 years ago
    Hi
    In Black Mirror game if you click very near to character for walking it doesn't move.It start to walking when you click at the special distance of character at least for one step walk.Is it possible in VS?

    Forum Fan

    193 Posts


  • #2, by afrlmeWednesday, 30. March 2016, 16:33 4 years ago
    Yes, you need to create a radius around your character. I wrote a small function for it ages ago which you can find here. Anyway... you would query inside of the left mouse button actions inside of the mouse properties tab under game whether the cursor is inside of this radius & if so then add a "character stop". action part. I also suggest wrapping the execute a script action part inside of this if query "if current character is on current scene". This will prevent this action from being called whenever the active character is not on the currently displayed scene / menu.

    P.S: you could technically modify the script so that the radius is adjusted automatically based on the current size of the character.

    Imperator

    6816 Posts

  • #3, by TinTinWednesday, 30. March 2016, 16:48 4 years ago
    Wow great!!. Thanks so much
    So I have to write :
    if isInRadius(Characters["Tom"], 50) then
    -- deactive cursor????
    1
    2
    3

    If it's right. How can I deactivate cursor?
    sorry for my poor lua script

    Forum Fan

    193 Posts

  • #4, by afrlmeWednesday, 30. March 2016, 16:57 4 years ago
    Check what I wrote again. I updated my reply.

    You can't deactivate the cursor. You can check if cursor is in character radius & then you can tell the character to stop which will kill the new destination & should prevent the player from walking.

    So it should be something along the lines of this...
    if isInRadius(game.CurrentCharacter, 50) then
    game.CurrentCharacter.State = 2 -- stop character
    end
    1
    2
    3
    4


    You need to include the workflow function I linked earlier inside of a script in the script section of your project.

    Imperator

    6816 Posts

  • #5, by TinTinWednesday, 30. March 2016, 17:01 4 years ago
    Thanks so much for quick reply. That was clear and very useful

    Forum Fan

    193 Posts

Write post