Dynamically placed dialog box

  • #10, von afrlmeDienstag, 22. März 2016, 23:48 Uhr vor 9 Jahren
    Just checked. Doesn't look like it. You could create some duplicated copies of your main character which contain only the idle animations & talk animations. Change active character to whichever you need before calling a dialog & then change back to your default character when done. I'm sure there's probably other methods you could use too...

    Foren Imperator

    7285 Posts


  • #11, von htw8849Mittwoch, 23. März 2016, 00:50 Uhr vor 9 Jahren
    Ah ok - I understand.

    Yes I already thought about something like that - but found it rather inconvinient solution thinking there must be a better way wink


    Result so far:

    local lpos = game.CurrentCharacter.CharacterDialogSprite:getPosition()
    print ("Sprite Pos: ", lpos.x,",",lpos.y)
    
    local lsize = game.CurrentCharacter.CharacterDialogSprite:getSize()
    print ("Sprite Size: ", lsize.x,",",lsize.y)
    
    local lpath = game.CurrentCharacter.CharacterDialogSprite:getPath()
    print ("Sprite Path:",lpath)
    
    print ("Sprite Obj B: ", game.CurrentCharacter.CharacterDialogSprite )
    
    lpos.x = 0
    lpos.y = 100
    
    game.CurrentCharacter.CharacterDialogSprite = { path = lpath , width = 0 , height = 0 , pos = lpos }
    
    print ("Sprite Obj A: ", game.CurrentCharacter.CharacterDialogSprite )
    


    Seem to run fine, unfortunatly doesn't move the CharackterDialogSprite to position 0,100 as intended :


    00:47:41: Sprite Pos: 0,0
    00:47:41: Sprite Size: -1,-1
    00:47:41: Sprite Path:interface/talkbox_16to9/talkbox.p ng
    00:47:41: Sprite Obj B: Sprite: path interface/talkbox_16to9/talkbox.p ng, width 0, height 0, pos (0,0)
    00:47:41: Sprite Obj A: Sprite: path interface/talkbox_16to9/talkbox.p ng, width 0, height 0, pos (0,0)


    So it really looks like you cannot overwrite the Sprite values via LUA roll

    Neuling

    41 Posts

  • #12, von htw8849Donnerstag, 24. März 2016, 11:37 Uhr vor 9 Jahren
    Small little update:

    It's possible to overwrite the path -> so the background image gets changed.

    This also applies for the pictures for the arrows. The only thing not possible to overwrite successfully is still the position roll

    But maybe I do it wrong ?!?

    Neuling

    41 Posts

  • #13, von afrlmeDonnerstag, 24. März 2016, 12:32 Uhr vor 9 Jahren
    You've got something wrong with your queries there as it shouldn't be returning -1 size or 0 for width & height. You might have to add another .Sprite after the actual object...
    print( game.CurrentCharacter.DialogSprite.Sprite:getSize() )
    

    It's been a while since I messed with sprite stuff, so I could be wrong. There's some examples on the "Scripting" page in the wiki.

    Yeah you should be able to change the image belong to the sprite, but I don't think there is a method for updating the position via the sprite field.

    P.S: I believe I asked Simon (or David - forget who I asked now) to add read only fields of size & position because I needed them for something. I think it was something to do with Zak 2 or maybe it was Oak Island (again I forget which).

    Foren Imperator

    7285 Posts