Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

[SOLVED] Change position of text

  • #1, by raule 13 years ago Zitieren
    hi,

    is ist possible to change the character display text position (similar to action part "display speaker text")?
    right now it always appears at the top of the characters graphic.

    thanks for any answer!

    best

    raul
  • #2, by BigStans 13 years ago Zitieren
    Hi Raul,

    yes. wink
    Try something with the setTextPosition hook:
    http://wiki.visionaire-tracker.net/wiki/RegisterHookFunction

    Alex has made an example here:
    http://www.visionaire-studio.net/forum/thread/character3939s...

    David
  • #3, by raule 13 years ago Zitieren
    Awesome!!
    thx dude!
  • #4, by raule 13 years ago Zitieren
    ok, there is a another little thing.
    its working fine for one character if i use the "Hero" script mentioned in the thread by alex.
    is it also possible to do it for another character (in the same script)?

    i never scripted before, sorry for the stupid question wink

    thx for any answer!
  • #5, by raule 13 years ago Zitieren
    okay got it !

    thank you!
  • #6, by afrlme 13 years ago Zitieren
    cheers for the second link David wink

    I never got around to providing an example for the registerHookFunction in the new wiki for the exclusive VS player commands.

    now I've got an example I can base it on.
  • #7, by raule 13 years ago Zitieren
    is there a possibility to change the align as well?
    i've looked in the lua docu but couldn't find anything.
    thx
  • #8, by afrlme 13 years ago Zitieren
    GameSpeakerTextAlignment - t_int:

    Defines alignment of speaker text:
    '0' (eAlignLeft): Align left.
    '1' (eAlignRight): Align right.
    '2' (eAlignCentered): Centered.
    '3' (eAlignLeftWithCenterPos): Align left (use center position).
    '4' (eAlignRightWithCenterPos): Align right (use center position).
    '5' (eAlignCenteredWithLeftPos): Centered (use left position).
    game:setValue(VGameSpeakerTextAlignment, integer value)
    


    GameTextAlignment - t_int:

    Defines alignment of spoken text:
    '0' (eAlignLeft): Align left.
    '1' (eAlignRight): Align right.
    '2' (eAlignCentered): Centered.
    '3' (eAlignLeftWithCenterPos): Align left (use center position).
    '4' (eAlignRightWithCenterPos): Align right (use center position).
    '5' (eAlignCenteredWithLeftPos): Centered (use left position).
    game:setValue(VGameTextAlignment, integer value)
    


    you can change these values in the game options setup tab also!
  • #9, by raule 13 years ago Zitieren
    hi
    thank you. havent seen because i looked under "text".

    the option VGameTextAlignment does something with my text but not what i want whatever value im choosing.

    this is my code
    registerHookFunction('setTextPosition', 'setTextPosHook')
    
    function setTextPosHook(text, game)
      local owner = text:getLink(VTextOwner)
      if owner:getId().tableId == eCharacters and owner:getName() == 'Charakter1' then
        local pos1 = {x=50, y=80}
        text:setValue(VTextPosition, pos1)
    return true
    end
      if owner:getId().tableId == eCharacters and owner:getName() == 'Charakter2' then
        local pos2 = {x=500, y=80}
        text:setValue(VTextPosition, pos2)
    return true
    end
      if owner:getId().tableId == eCharacters and owner:getName() == 'Charakter3' then
        local pos3 = {x=400, y=600}
        text:setValue(VTextPosition, pos3)
       [b]game:setValue(VGameTextAlignment, 1)[/b]
    return true
     
    end
    end
    


    maybe you could help.

    im new with lua, sorry

    thanks for your help!
  • #10, by afrlme 13 years ago Zitieren
    what's up with the bbcode tags on line 18?

    you could simplify this script a lot more than this...

    is the text being displayed above the characters heads or is it being placed somewhere else on screen?
    what is happening when you use "VGameTextAlignment"?
    & why have you added "game" to the function variable after text?

    before I write up a script, can you please give me some details on exactly what you are wanting to do...
    are you planning on using this script for every character in the game?
    do you want the text to be displayed above the characters head or manually positioned somewhere on the screen; in a box/image of some kind?

    this could determine if you could use a more global script to achieve what you want to do or if it would be better to use tables or create multiple if elseif queries etc.
  • #11, by bobby23 13 years ago Zitieren
    There is a much MUCH easier way. Just create an "empty" character. Create an object and set it where you want the text to appear (empty object). Set that newly created character to have the starting point of the new object you just created.

    Then just have the empty character talk when ever you want the text to be in another location.
    Thats how I do it 100's of times