License from €75 Log in
DE EN FR ES IT CZ

I would place the text above character in lua

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

  1. · 9 years ago
    Currently, text when my character is speaking is set with the function setTextPosHook

    code :

    local txtP = getObject("Conditions[invopen]")
    
    function setTextPosHook(text)
    
     if text:getLink(VTextOwner):getId().tableId == eCharacters and text:getLink(VTextOwner):getName() == "Ben" then
    if txtP:getBool(VConditionValue) == true then
         text:setValue(VTextPosition, {x= game:getPoint(VGameWindowResolution).x/2, y= 700})
        else
       text:setValue(VTextPosition, {x= game:getPoint(VGameWindowResolution).x/2, y= 850})
          end
    end
    return true
    end
    registerHookFunction("setTextPosition", "setTextPosHook")



    But I will like this (script for VS5):

    That the text is placed each time above the character who speaks (as in deponia), so follow the movement of my character, and if the character is too far right or too much left, that the text is not truncated

    I am looking for several hours in lua but I can not find the solution.

    Thank you for your help
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 9 years ago
    Just dont use the script. That what you want is default for VS.
    You can also configure in your font the maximum line length. If the length is more than that number a next line will be used.
  4. · 9 years ago
    Um.... the script in the function Daedalic used for Deponia is a lot of lines & if queries. Well over 100 lines with various if queries about x scene & y character & various other factors.

    Setting above the character requires a bit of math. First you need to check the positon of the talking character, then you need to offset on the y-axis based on the current scale percentage of the character, then you would need to offset on the x-axis based on your characters position from the left or right side of the scene. Personally I recommend using the standard display text system or creating a bounding box & displaying all text inside of that. Less hassle overall.
  5. · 9 years ago
    Thank you both. When i delete my script, it work smile

    But I think to use a script as explained by AFRLme, because the function "Max.line with" is ok if I am in 1920x1080, but if I decreases the resolution, the line break is strange

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?