Dialog interface mit Abbild der Personen / add Character Images to Dialogs

  • #1, by stothewThursday, 29. March 2018, 13:18 2 years ago
    Hallo,

    ich hätte gerne die Bilder der Personen mit denen man redet im interface zu sehen. Leider Gibt mir das UI keine Möglichkeit Grafiken variabel anzuzeigen. Wie kann ich das lösen?

    Danke!

    -----------

    hi!

    i want to create images of the Characters you talk to and put it in the dialog interface. But in the UI you cant set any actions to react to different images. How can i do this?

    thanks!

    Forum Fan

    122 Posts


  • #2, by esmeraldaThursday, 29. March 2018, 13:52 2 years ago
    What is it exactly you want to do?
    You can show different animations or change the image of the person by changing a condition (now even by value). You can have actions by clicking or mouseover...


    Great Poster

    368 Posts

  • #3, by sebastianThursday, 29. March 2018, 14:16 2 years ago
    character portraits?
    You have two possible solution here:
    1. setting a condition (or since the newewt Update a value)  and based on that show a different interface button which displays the characters face. 

    2. use some lua magic to hook into the text display action part and draw a sprite directly to the screen depending on tze owner of the text... 

    Thread Captain

    2331 Posts

  • #4, by stothewThursday, 29. March 2018, 14:29 2 years ago
    I talk about the Dialog Interface in Charackter settings.
    How i´m able to create buttons there? how i´m able to react on conditions there?
    My only options are setting a background, aktive/inaktive scroll images and a Text area.
    But i want to display the characters, too.

    Here is a quick Image to show what i mean.

    Forum Fan

    122 Posts

  • #5, by afrlmeThursday, 29. March 2018, 14:41 2 years ago
    I recommend creating the dialog background image as a regular interface. Set that interface to visible just before you start the dialog. Hide it after closing the dialog.

    As Sebastian said, you can add the images to interface buttons & use conditions or values to determine which should be shown.

    The more complicated but flexible solution - if you only wanted to show the image for the person currently speaking - would be to use Lua script & the event handlers for listening out for text started & text stopped as you can query which character the text belongs to which means if you used conditions with the same names as the character names that you could have it automatically show/hide the relevant avatar images when a character speaks/stops talking.

    Imperator

    6779 Posts

  • #6, by sebastianThursday, 29. March 2018, 14:48 2 years ago
    before you misunderstand things :

    the dialog system in VS has no builtin possibility to display extra stuff like portraits. So the idea is to display an interface before starting the dialog. the dialog options then get displayed in front of the interface. 

    Thread Captain

    2331 Posts

  • #7, by stothewThursday, 29. March 2018, 14:52 2 years ago
    Yeh. thanks.
    i´m fine with this soulution.

    As alywas thanks a lot for the quick and good help!

    Forum Fan

    122 Posts

  • #8, by trepnThursday, 29. March 2018, 15:17 2 years ago
    I've done this using 'textStarted' and 'textStopped' in Lua. In this example I am using an interface with a right oriented textbaloon (baloon_right) and a left oriented textbaloon (baloon_left). I've also setup interfaces for all the characters to be displayed next to the baloon (head_left_[character name] and head_right_[character name]). The correct heads and baloons are shown when the corresponding character talks. 

    PS: These interfaces are outside the dialog interface.
    registerEventHandler("textStarted", "onTextStarted")
    registerEventHandler("textStopped", "onTextStopped")

    function onTextStarted(text)
      local currentCharacter = game.CurrentCharacter
      local owner = text:getLink(VTextOwner)
      if owner:getId().tableId == eCharacters then
        local isLeft = owner:getName() == currentCharacter:getName()
        showTextBalloon(isLeft)
        showHead(isLeft, owner:getName())
      end
    end

    function onTextStopped(text)
      local currentCharacter = game.CurrentCharacter
      local owner = text:getLink(VTextOwner)
      if owner:getId().tableId == eCharacters then
        local isLeft = owner:getName() == currentCharacter:getName()
        hideTextBalloon(isLeft)
        hideHead(isLeft, owner:getName())
      end
    end

    function getBaloon(isLeft)
      if isLeft then
        return getObject("Interfaces[baloon_left]")
      end
      return getObject("Interfaces[baloon_right]")
    end

    function getHead(isLeft, character)
      if isLeft then
        return getObject("Interfaces[head_left_"..string.lower(character).."]")
      end
      return getObject("Interfaces[head_right_"..string.lower(character).."]")
    end

    function showTextBalloon(isLeft)
      local baloon = getBaloon(isLeft)
      baloon.InterfaceVisible = true
      baloon.InterfaceVisibility = 100
    end

    function hideTextBalloon(isLeft)
      local baloon = getBaloon(isLeft)
      baloon.InterfaceVisible = false
      baloon.InterfaceVisibility = 0
    end

    function showHead(isLeft, character)
      local head = getHead(isLeft, character)
      head.InterfaceVisible = true
      head.InterfaceVisibility = 100
    end

    function hideHead(isLeft, character)
      local head = getHead(isLeft, character)
      head.InterfaceVisible = false
      head.InterfaceVisibility = 0
    end
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60

    Newbie

    60 Posts

  • #9, by stothewThursday, 29. March 2018, 20:30 2 years ago
    Thanks a lot this is great!

    Forum Fan

    122 Posts

Write post