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

  • #1, by stothewThursday, 29. March 2018, 13:18 6 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

    127 Posts


  • #2, by esmeraldaThursday, 29. March 2018, 13:52 6 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...


    Key Killer

    513 Posts

  • #3, by sebastianThursday, 29. March 2018, 14:16 6 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

    2346 Posts

  • #4, by stothewThursday, 29. March 2018, 14:29 6 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

    127 Posts

  • #5, by afrlmeThursday, 29. March 2018, 14:41 6 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

    7278 Posts

  • #6, by sebastianThursday, 29. March 2018, 14:48 6 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

    2346 Posts

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

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

    Forum Fan

    127 Posts

  • #8, by trepnThursday, 29. March 2018, 15:17 6 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

    Newbie

    60 Posts

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

    Forum Fan

    127 Posts