Waypoint scaling system

  • #1, by cristianba223lerTuesday, 12. September 2017, 11:07 7 years ago
    Hello everyone,

    maybe you can help me with a little problem.
    I've learned all the important stuff about visionaire studio ( also a bit of LUA)
    But i crashed into the problem, that in my scene the character has to be scaled smaller, the more he walks to the right side of the screen.
    Am i doing something wrong or cant this be archieved by simply using the scaling factor of the waypoints ?
    Apperantly the scale changes only from bottom to top but not from left to right.

    Newbie

    6 Posts


  • #2, by afrlmeTuesday, 12. September 2017, 12:25 7 years ago
    Ideally you should really only be scaling on the y-axis. The best way to create scaling is to add another path outside of your way border & add the scale values to them instead of the way points inside of the way border as it will scale a lot smoother.

    x-axis scaling should work - well it used to work,  but scales less smoothly than y-axis scaling. It could be that you are adding too many scaling values & are confusing the engine.

    Would you be willing to share a screenshot of the scene/waysystem & maybe highlight the waypoints that you've applied scaling values to please?

    Imperator

    7285 Posts

  • #3, by cristianba223lerTuesday, 12. September 2017, 12:40 7 years ago
    Thank you for your fast reply.
    in the pickture, the arrow marked waypoint and the 85% waypoint causes the character to scale to this value in the middle of the way to 150%.
    I dont know if this error still occurs when the scaling waypoint is outside of the boundaries.

    Newbie

    6 Posts

  • #4, by afrlmeTuesday, 12. September 2017, 13:26 7 years ago
    Are all of those points joined together? Or is that multiple paths laid over the top of one another. It seems like it's having trouble deciding whether to use the scale values on the y-axis or the x-axis, which is why you really should choose one single axis to scale on per scene. What you could do is create multiple way-systems & create some action areas in the way system to tell the engine when to switch between them. You will need to make sure the initial scale point where the character enters the new way system is the same, or you could remove the scaling from the way system & try to use Lua script with a bunch of if queries to check current position of character & character direction to determine scale of the character - it's complicated, but so is the scaling in your scene because you've decided to use multi-direction scaling.

    This is what I was talking about with adding scaling outside of the way border. It is something that Daedalic Entertainment do themselves unless they actually have to create scaling inside due to unusual perspective view like in your screenshot.
    https://i.gyazo.com/abd9ace41ce77b64fe123c648f98d381.png

    Imperator

    7285 Posts

  • #5, by cristianba223lerTuesday, 12. September 2017, 13:43 7 years ago
    All the Waypoints are in one row. But i think the solution with  the action areas should work. Thank you for your help wink

    Newbie

    6 Posts

  • #6, by caligarimarteTuesday, 12. September 2017, 14:57 7 years ago
    I have another Option for you, and I personally think it would be an elegant one:
    local Player = getObject("Characters[PLAYER_NAME]")
    local ProjectResolutionX = 1920
    
    local DefaultSize = 100
    
    local ShrinkFactor = 0.67
    
    
    
    function ScalePlayerOnX()
    
      Player.ScaleFactor = DefaultSize-(Player.Position.x/ProjectResolutionX*DefaultSize)*ShrinkFactor
    
    end
    
    
    
    registerEventHandler("mainLoop", "ScalePlayerOnX")

    Just try a "ShrinkFactor" that suits your Scene, and the Player Character will automatically shrink the further he or she is moving right. Activate the Script at the Start of the Scene, stop it when the Scene ends.

    EDIT: Oh, and of Course you have to set your Project's X Resolution -- if there is a Lua-Command for that, the API is super obscure about it. Also, "DefaultSize" might be a Value slightly above 100 in your Scene, I am not sure about it.

    Forum Fan

    145 Posts

  • #7, by afrlmeTuesday, 12. September 2017, 15:36 7 years ago
    Yes, there's a way of getting the scene width & height with Lua script. It's shown on the scripting page of the wiki I think.

    We're talking about complex scaling placements here. The problem is that the way paths are more of a guideline, the character isn't forced to walk along those unless you adjust the way borders in a way that makes it so that there is no way that the character can walk anywhere else except along the paths you specify, but that often looks horrible & the player will probably notice that you are forcing them along some predefined path when they should technically be allowed to move elsewhere.

    I highly recommend designing your scenes so that only y-axis scaling is required. One thing you could do is create 2 way systems. One for the left side of the scene & the bottom half, & another for the path going to the bridge bit, then you switch to x-axis scaling once the player enters the bridge path bit. It's not elegant, but it's something that should work just fine.

    Imperator

    7285 Posts

  • #8, by cristianba223lerTuesday, 12. September 2017, 15:49 7 years ago
    I've tried the solution with the action areas and it works just fine. 
    But the character stops when the way system is changed.
    Is there a way that he keeps the position he should go to in memory ?

    Newbie

    6 Posts

  • #9, by afrlmeTuesday, 12. September 2017, 16:01 7 years ago
    I've tried the solution with the action areas and it works just fine. 
    But the character stops when the way system is changed.
    Is there a way that he keeps the position he should go to in memory ?
    With Lua script you could do that, but maybe Simon could implement an option into the engine that you can tick in the change way system action part to retain current destination/destination object/destination actions. I'll ask him about it later on on our Discord server; which you are free to join by the way. Link can be found inside of the news article at the top of the forum board or via the pinned tweet of the official twitter account.

    Imperator

    7285 Posts

  • #10, by cristianba223lerThursday, 14. September 2017, 12:26 7 years ago
    With Lua script you could do that, but maybe Simon could implement an option into the engine that you can tick in the change way system action part to retain current destination/destination object/destination actions.

    So could you tell me what command i need in Lua ?
    Also i noticed that all actions of an clicked object are executed in the area where the waypoint system is changed.
    I hope that can be fixed with Lua too.

    Newbie

    6 Posts

  • #11, by afrlmeThursday, 14. September 2017, 13:19 7 years ago
    execute a script >
    dest =
    {
     game.CurrentCharacter.Destination,
     game.CurrentCharacter.DestinationObject,
     game.DestinationCommand,
     game.DestinationEvent,
     game.DestinationItem,
     game.DestinationItemPicked
    }

    change way system to "x"

    As you can see, there's quite a lot of different tables when it comes to the destination. In my example I've stored them all inside of a table, so you could do that before executing the change way system action part & then afterwards you could insert those values back into the data structure fields like so...

    execute a script >
    if dest[1] ~= nil then game.CurrentCharacter.Destination = dest[1] end
    if dest[2] ~= nil then game.CurrentCharacter.DestinationObject = dest[2] end
    if dest[3] ~= nil then game.DestinationCommand = dest[3] end
    if dest[4] ~= nil then game.DestinationEvent = dest[4] end
    if dest[5] ~= nil then game.DestinationItem = dest[5]; game.DestinationItemPicked = dest[6] end


    We're checking which table entries are empty/nil so that we only update the ones we need. I don't know if it will work as I've not tested it, but you can try it & cross your fingers &/or toes.

    Imperator

    7285 Posts