Character''s dialog appearing position

  • #1, by UraalWednesday, 11. July 2012, 00:23 12 years ago
    I have a character who's head is near his feet, however all dialog and text appears on top of this character instead of right above head as supposed. I've tried to find solution but don't seem to find one. I would appreciate help with the matter.

    Newbie

    93 Posts


  • #2, by AlexWednesday, 11. July 2012, 20:56 12 years ago
    By default the engine always displays the text above the character (if possible). You probably need to register for the 'setTextPosition' hook to have full control about the position, see http://wiki.visionaire2d.net/index.php?title=RegisterHookFun...

    Great Poster

    378 Posts

  • #3, by UraalThursday, 12. July 2012, 21:07 12 years ago
    Thank you for returning my question. I haven't used any scripts before this point with my adventure game, however I am willing to learn more about these "lua" things. Where would be the best place to start?

    Newbie

    93 Posts

  • #4, by AlexThursday, 12. July 2012, 22:08 12 years ago
    this is the official documentation: http://wiki.visionaire2d.net/index.php?title=Scripting You should read the whole Lua documentation and understand the language since scripting in Visionaire is basically Lua with some extensions to access the Visionaire objects. At least some programming experience is probably needed for some serious scripting. There should also be some code snippets here in the forum which could get you started.

    Great Poster

    378 Posts

  • #5, by UraalThursday, 12. July 2012, 23:24 12 years ago
    To be honest I try to stay away from coding/scripting stuff as it's not my area of strengths. So far I've been able to do everything I wanted with this genius engine/editor and since I'm fairly far in development pipeline I'm wondering if I have to learn whole scripting thing from beginning just to be able to change text position of single character in my game?

    I know I could work around this problem by dividing my character into static part (which is the body) and animated character part (only head) so text would appear directly on top of his/her head, but then I would lose the awesome random animations I've made for the character.

    Newbie

    93 Posts

  • #6, by AlexFriday, 13. July 2012, 00:09 12 years ago
    Of course you don't have to learn the whole scripting stuff, but if you really want to do some serious work you'll need good scripting knowledge. Otherwise you'll struggle to even accomplish small things. Visionaire is especially designed for non-programmers and easy handling but sometimes you need more than the default behavior (that's where scripting comes in). In your case I'd recommend that you find somebody to help you out with the scripting tasks. to give you a starting point, here is a script (script type: definition script) which shows the character text below the Hero character in the demogame:
    
    registerHookFunction('setTextPosition', 'setTextPosHook')
    
    function setTextPosHook(text)
      local owner = text:getLink(VTextOwner)
      if owner:getId().tableId == eCharacters and owner:getName() == 'Hero' then
        local pos = owner:getPoint(VCharacterPosition)
        text:setValue(VTextPosition, pos)
        return true
      end
      return false
    end
    

    Great Poster

    378 Posts

  • #7, by UraalFriday, 13. July 2012, 09:45 12 years ago
    Thank you for your patience and help Alex, highly appreciated.

    Newbie

    93 Posts

  • #8, by LexaurWednesday, 26. September 2012, 17:55 12 years ago
    Hey

    I have tried to set up the text position and with that a background for the text itself. I cannot get the script quite working, has anyone any ideas on how to fix this? The text positions itself on where I want it to be but the background is not reacting. There is a object called OBJ_bubble that has a image set up inside the editor.

    
    registerHookFunction('setTextPosition', 'setTextPosHook')

    function setTextPosHook(text) local owner = text:getLink(VTextOwner) local bubble = getObject("Scenes[Crime Scene].SceneObjects[OBJ_bubble]" ) if owner:getId().tableId == eCharacters and owner:getName() == 'Detective Dick' then text:setValue(VTextPosition, {x=230,y=900}) bubble:setValue(VObjectPosition, {x=230,y=900}) return true else text:setValue(VTextPosition, {x=1630,y=900}) bubble:setValue(VObjectPosition,{x =1630,y=900})

    return true end return false end

    Newbie

    0 Posts

  • #9, by AlexWednesday, 26. September 2012, 23:49 12 years ago
    are there any errors in the log? if you are not sure what is wrong in the script always add as many print statements as possible to see where it goes wrong.

    Great Poster

    378 Posts

  • #10, by LexaurTuesday, 09. October 2012, 09:01 12 years ago
    are there any errors in the log? if you are not sure what is wrong in the script always add as many print statements as possible to see where it goes wrong.

    There were no errors, but I found out that you cannot use scripts to move the actual object afaik? Instead I used the visibility of the object to trick the on/off function, by changing the visibility from 0 to 100 and reverse. http://wiki.visionaire2d.net/index.php?title=Data_Structure_3.x That really helped!

    Newbie

    0 Posts