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

Moving comment set text position away from character?

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

  1. · 12 years ago
    Hey, just a quick question I guess. In our game the MC never speaks and the exposition is always displayed as narration text rather than characther text. Comment sets however always place the text above the character. Is there any way to change the position of the comment set text? (perhaps with Lua?)

    Thanks
  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. · 12 years ago
    I'm not really sure you can just force comment set text away from a character. You can reposition all text spoken by the character &/or narration text though...

    Just use the registerHookFunction with the textPosition hook.

    local offset = 34 -- offset from bottom (in pixels)
    local x = (game.WindowResolution.x / 2) -- calculate center value of resolution width
    local y = (game.WindowResolution.y - offset) -- calculate offset of text from bottom
    
    function txtPos(text)
      text:setValue(VTextPosition, {x = game.ScrollPosition.x + x, y = game.ScrollPosition.y + y})
      return true
    end
    
    registerHookFunction("setTextPosition", "txtPos")
    

    ...this script will automatically set the text to the bottom-center of the screen. Adjust offset to adjust distance from the bottom.
  4. · 12 years ago
    Thank you very much. I'll try it.
  5. · 12 years ago
    Well, it works but now all text, including NPC:s text is moved to the narration position. Is there anyway to tell the script only to position the text of the main character in this manner?
  6. · 12 years ago
    Indeed. You can query the textOwner.

    local offset = 34 -- offset from bottom (in pixels)
    local x = (game.WindowResolution.x / 2) -- calculate center value of resolution width
    local y = (game.WindowResolution.y - offset) -- calculate offset of text from bottom
    
    function txtPos(text)
     if text:getLink(VTextOwner):getName() == game.CurrentCharacter:getName() then
      text:setValue(VTextPosition, {x = game.ScrollPosition.x + x, y = game.ScrollPosition.y + y})
      return true
     end
    end
    
    registerHookFunction("setTextPosition", "txtPos")
    
  7. · 12 years ago
    Nice. I guess I have to enter the character name into the getName() part? or is the part "game.CurrentCharacter:getName ()" already assigning it to the main character?
  8. · 12 years ago
    game.CurrentCharacter:getName() is automatically returning the string name of the current character. So if the string name of the text owner is the string name of current character it will reposition the text, otherwise it will ignore the text.

    P.S: I messed up the script a little previously. I've updated the block with the correct code.
  9. · 12 years ago
    Alright, thanks again. What the world do without AFRLme? grin
  10. · 12 years ago
    No idea? In the case of the online world regarding VS... probably curl up into a little ball & cry. In the case of the real world... carry on as per usual, most likely. grin

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?