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.
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
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
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!