Change Waysystem

  • #1, by rauleTuesday, 03. December 2013, 15:39 11 years ago
    Hello,

    i change the waysystem in my scene via action areas. i have to do it for scaling the character right.
    it already works fine. the only thing is, that the character stops when the Waysystem changes.

    is there a possiblity that the character wont stop`?

    thx for any answer!

    raul

    Newbie

    53 Posts


  • #2, by AlexTuesday, 03. December 2013, 16:04 11 years ago
    I don't think so. The character is stopped because the way points of the waysystem are needed for the path finding algorithm.

    Great Poster

    378 Posts

  • #3, by rauleTuesday, 03. December 2013, 16:47 11 years ago
    yeah i thought so.
    is there a better way to solve my problem?

    i have different sizes of the character on same y-choords

    thx and thx

    Newbie

    53 Posts

  • #4, by afrlmeTuesday, 03. December 2013, 17:10 11 years ago
    it's better to only set up 2 scale sizes than multiple ones...

    did you see what Mowren posted in another thread about adding the actual scaling points on the outside of your way borders? he wrote a few other tips too & explained how the scaling system works.

    http://www.visionaire-studio.net/forum/thread/way-point-scal...

    near bottom of the thread.

    Imperator

    7278 Posts

  • #5, by rauleTuesday, 03. December 2013, 17:43 11 years ago
    yeah usually i do it like this but in this case i have different sizes of the character on same y-choords.

    If this is my scene the character is bigger on position 1 than on position 2
    Position 1 is still foreground (balcony), position 2 is background.

    Newbie

    53 Posts

  • #6, by afrlmeTuesday, 03. December 2013, 19:07 11 years ago
    hmm I was musing over the idea of using lua to save the character destination into a variable with just before you change the way system & then using said variable with the VCharacterDestination to set the character walking to that destination again.

    I don't know if it would work but...

    first you need to create a definition script which we can use to add 2 simple functions one for setting the current destination & the other for setting it going again.

    local char_dest -- create a blank variable that we can use for both of the functions
    
    -- let's create the function that stores the character destination
    function saveDest()
     char_dest = game:getLink(VGameCurrentCharacter):getPoint(VCharacterDestination)
    end
    
    -- let's create the function that resets character destination
    function getDest()
     game:getLink(VGameCurrentCharacter):setValue(VCharacterDestination, {x = char_dest.x, y = char_dest.y})
    end
    


    to use this:
    1. just before you add the change way system action part, create an execute a script action part & add...
    saveDest()
    

    2. then after the way system as been changed add another execute a script action part & add...
    getDest()
    


    I haven't tested this code, but it should probably work & it says that CharacterDestination is scriptable, so I assume it should set the character walking again but hmm I'm not sure it will execute whatever action you told it to do on x object or character... I think we would need to add some additional code to check if destination is an object or character etc & whether you told it to execute an action on it but the code should resume the character walking.

    We also have a choice of using these scriptable commands too:
    CharacterDestination -- general x,y destination
    CharacterDestinationObject -- if character destination is an object or character
    GameDestinationCommand -- the command you used on the object, character
    GameDestinationEvent -- a normal mouse event such as left/right click or hold etc
    GameDestinationItem -- if you used an item on the object or character
    GameDestinationItemPicked -- same as above but is for if you have used a dragged item
    

    Imperator

    7278 Posts

  • #7, by rauleWednesday, 04. December 2013, 10:10 11 years ago
    looks pretty good right now!

    i will test it with some other actions then just "goto" and give some feedback if its working as well for other situations.

    thank you very much!!

    Newbie

    53 Posts

  • #8, by rauleTuesday, 10. December 2013, 15:10 11 years ago
    hi there,

    yes its like u said.
    its working with just "walking" to an object. but if i execute an specific command like "take" it doesn't work.
    so i have to add the function (CharacterDestinationObject , aso.) into the lua script?

    greetings

    Newbie

    53 Posts

  • #9, by afrlmeTuesday, 10. December 2013, 15:24 11 years ago
    yeah but I think the best method would be to use an if query to determine if the character should be walking to an object/character & then save the destination object & the command to be used & if not then default back to destination only method.

    hmm I think you could probably query "VGameDestinationEvent" & "VGameDestinationCommand" to check what is supposed to happen when the user reaches the destination & then use that to determine what you need to save to the saveDest function & what should be returned in the getDest function.

    I'll have a wee think on it & get back to you later on the day or the week sometime.

    Imperator

    7278 Posts

  • #10, by rauleTuesday, 10. December 2013, 15:51 11 years ago
    thank you very much!

    Newbie

    53 Posts