Help in character talk

  • #1, by LupaShivaSaturday, 21. January 2017, 23:57 4 years ago
    Hello =)

    Just a little question, when a character talks, the text appear on top of the character head, is there a way to change that text position, like the option "display narrationt text" but making a character talk at the same time? i know i can do it creating a random animation with the talk sprites, starting the animation, displaying text, and then stopping the animation, but i would like to know if there is a simple way, because i need to to this a LOT of times really a lot of times.

    Thank you
    LupaShiva

    Forum Fan

    122 Posts


  • #2, by ke4Sunday, 22. January 2017, 00:08 4 years ago
    You can set the text position by the Hook fucntion. Check out the first example.

    Key Killer

    810 Posts

  • #3, by LupaShivaSunday, 22. January 2017, 00:14 4 years ago
    Uf!! Its LUA right? Been working with visionaire about 4 years ago and never tried LUA, is there any tutorial for starting with LUA, how to do it and how to start, im really Zero in LUA, never tried.

    Thank you

    Forum Fan

    122 Posts

  • #4, by afrlmeSunday, 22. January 2017, 01:04 4 years ago
    Uf!! Its LUA right? Been working with visionaire about 4 years ago and never tried LUA, is there any tutorial for starting with LUA, how to do it and how to start, im really Zero in LUA, never tried.

    Thank you
    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 which updates the text position of displayed texts (character &; narration) * --
    function txtPos(text)
     text:setValue(VTextPosition, {x = game.ScrollPosition.x + x, y = game.ScrollPosition.y + y}) -- define the new text position
     return true
    end

    registerHookFunction("setTextPosition", "txtPos") -- define the hook function for handling text position
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11


    Don't need to know Lua script. Just copy/paste this example into the script section of the editor & adjust the offset value in the first line of the script. This script will display the text center of the screen (width) & x pixels offset from the bottom depending on what you change the offset value to.

    If you only want to offset the texts for characters, narration texts, only on certain scenes & not for background texts then let me know as this script currently affects display texts, narration texts & background texts.

    Imperator

    6862 Posts

  • #5, by ke4Sunday, 22. January 2017, 11:19 4 years ago
    However Lua is not hard to learn language. So don't be afraid if you would like to try learn it. You just need to understand some basics to start such as variables, loops, functions, operators.
    There's some nice beginner tutorial https://coronalabs.com/learn-lua/

    But as AFRLme said just paste the code in Visionaire and you're good.

    Key Killer

    810 Posts

  • #6, by LupaShivaSunday, 22. January 2017, 16:43 4 years ago
    Ill be honest, i even dont know where is the code placed, but i will check right now the tutorial thanks.

    Forum Fan

    122 Posts

  • #7, by afrlmeSunday, 22. January 2017, 18:56 4 years ago
    Ill be honest, i even dont know where is the code placed, but i will check right now the tutorial thanks.
    The script section of Visionaire Studio? grin

    Just create a new script & copy/paste what I shared with you into it. Any scripts you create are set as definition scripts by default which means the script will run on game launch automatically without you having to manually call it.

    Imperator

    6862 Posts

  • #8, by LupaShivaTuesday, 24. January 2017, 23:03 4 years ago
    I have one more question, i already tested a little with scripts, looks really awesome =) but the script affects all the display text, is there anyway to only affect the character i want? how do i set that in a script? and also is there any way in script to change text alignment?

    Thanks

    Forum Fan

    122 Posts

  • #9, by afrlmeTuesday, 24. January 2017, 23:21 4 years ago
    I have one more question, i already tested a little with scripts, looks really awesome =) but the script affects all the display text, is there anyway to only affect the character i want? how do i set that in a script? and also is there any way in script to change text alignment?

    Thanks
    This is why I asked question of what you wanted to affect with it. It's possible to only affect text for characters, narration text, background text, object text or specific characters.

    Alignment you can adjust in game tab (cog/gear icon) or you can adjust in-game with Lua script too if I remember correctly.

    Imperator

    6862 Posts

  • #10, by LupaShivaTuesday, 24. January 2017, 23:49 4 years ago
    I wanted to affect only specific characters, and the text alignment too.

    Tried to search in net and only found this, but does not cover what i need:

    Forum Fan

    122 Posts

Write post