Dynamically placed dialog box

  • #10, by afrlmeTuesday, 22. March 2016, 23:48 8 years ago
    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...

    Imperator

    7278 Posts


  • #11, by htw8849Wednesday, 23. March 2016, 00:50 8 years ago
    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

    Newbie

    41 Posts

  • #12, by htw8849Thursday, 24. March 2016, 11:37 8 years ago
    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 ?!?

    Newbie

    41 Posts

  • #13, by afrlmeThursday, 24. March 2016, 12:32 8 years ago
    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).

    Imperator

    7278 Posts