Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Character''s dialog appearing position

  • #1, by Uraal 14 years ago Zitieren
    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.
  • #2, by Alex 14 years ago Zitieren
    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...
  • #3, by Uraal 14 years ago Zitieren
    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?
  • #4, by Alex 14 years ago Zitieren
    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.
  • #5, by Uraal 14 years ago Zitieren
    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.

  • #6, by Alex 14 years ago Zitieren
    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
    
  • #7, by Uraal 14 years ago Zitieren
    Thank you for your patience and help Alex, highly appreciated.
  • #8, by Lexaur 14 years ago Zitieren
    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

  • #9, by Alex 14 years ago Zitieren
    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.
  • #10, by Lexaur 14 years ago Zitieren
    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!