Distance of walking

  • #1, von TinTinMittwoch, 30. März 2016, 16:21 Uhr vor 9 Jahren
    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?

    Foren Fan

    196 Posts


  • #2, von afrlmeMittwoch, 30. März 2016, 16:33 Uhr vor 9 Jahren
    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.

    Foren Imperator

    7285 Posts

  • #3, von TinTinMittwoch, 30. März 2016, 16:48 Uhr vor 9 Jahren
    Wow great!!. Thanks so much
    So I have to write :
    if isInRadius(Characters["Tom"], 50) then
     -- deactive cursor???? 
    

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

    Foren Fan

    196 Posts

  • #4, von afrlmeMittwoch, 30. März 2016, 16:57 Uhr vor 9 Jahren
    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
    


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

    Foren Imperator

    7285 Posts

  • #5, von TinTinMittwoch, 30. März 2016, 17:01 Uhr vor 9 Jahren
    Thanks so much for quick reply. That was clear and very useful

    Foren Fan

    196 Posts