Help in character talk

  • #1, z LupaShivaSaturday, 21. January 2017, 23:57 hodinky 8 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

    Fanoušek fóra

    134 Posts


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

    Zabiják klíčů

    810 Posts

  • #3, z LupaShivaSunday, 22. January 2017, 00:14 hodinky 8 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

    Fanoušek fóra

    134 Posts

  • #4, z afrlmeSunday, 22. January 2017, 01:04 hodinky 8 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


    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.

    Imperátor

    7285 Posts

  • #5, z ke4Sunday, 22. January 2017, 11:19 hodinky 8 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.

    Zabiják klíčů

    810 Posts

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

    Fanoušek fóra

    134 Posts

  • #7, z afrlmeSunday, 22. January 2017, 18:56 hodinky 8 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.

    Imperátor

    7285 Posts

  • #8, z LupaShivaTuesday, 24. January 2017, 23:03 hodinky 8 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

    Fanoušek fóra

    134 Posts

  • #9, z afrlmeTuesday, 24. January 2017, 23:21 hodinky 8 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.

    Imperátor

    7285 Posts

  • #10, z LupaShivaTuesday, 24. January 2017, 23:49 hodinky 8 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:

    Fanoušek fóra

    134 Posts