DE EN FR ES IT CZ

Change values on character moves

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 9 years ago
    Hi all,
    I wold like to update some value according to my character moves or position, how can I achieve this?

    10X! 
  2. New to Visionaire Studio?

    Create point and click adventures without coding. The free version covers up to 25 scenes per project. For more scenes or to earn money with your game, you need a license.

    See the Indie Bundle Try it for free
  3. · 9 years ago
    Not sure what you are trying to achieve here.

    You can add actions directly to character animation frames or there's the option called "start action after animation is finished" and you can link some actions there.

    There's no event handler for walking as far as i know tho you can get the information via this line of code
    game.CurrentCharacter.State

    Where 2 is standing & 3 is walking. So you can create your own with the main loop.
    function functionName()
        --your code here
    end
    
    registerEventHandler("mainLoop", "functionName")

  4. · 9 years ago
    Thank you @K4e.
    In general the link you provided is very useful.

    I am trying to achieve a fixed text that show the player "depth water level". 
    That level is changes according to the character position.

    Any way, I try your suggestion .
    Thanks again.
  5. · 9 years ago
    Please try to include more details when asking for help mate. Your initial post didn't really provide much information on what you wanted other than something to do with values & movement.

    Are you talking about a percentage value between 2 points or values determined by range values? i.e: if character is > 100 and <= 200 then character is x distance down? Or do you just want to display the actual y position of the character? If it's the latter then you could use the Lua mainLoop function to update & store the y position of the character inside of a value. You can use the same method as the playtime thing for displaying the value.
  6. · 9 years ago
    Yes you are right, I was try to relieve the reader from too much info, next time I explain my self butter.

    As a solution I was using this Lua code combined with main loop:

    char = game:getLink(VGameCurrentCharacter)
    pos = char:getPoint(VCharacterPosition)
    level = -1*(255 + (pos.x / 1000))
    level = round(level,2)
    Values["water_level"].String =tostring(level)



  7. · 9 years ago
    I don't understand what your calculations are doing, then again, math has never been something I've been very good with.

    So the character swims horizontally in this scene as opposed to vertically down?

    x = horizontal
    y = vertical

    Anyway... quick note: you could shorten the script by a few lines if you wanted. There's really no need to declare variables for everything & there's no need to use the old getObject method either.
    level = -1 * (255 + (game.CurrentCharacter.Position.x / 1000) )
    level = round(level, 2)
    Values["water_level"].String = tostring(level)

  8. · 9 years ago
    Good note, I will make the replace in my code.
    You are the best...!
  9. · 9 years ago
    You can also use action areas I think.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?