License from €75 Log in
DE EN FR ES IT CZ

defining the volume of one (or at least all) character(s) independently of the "setvolume" script control

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 11 years ago
    Hi everyone.

    So yeah. We are like hours away to call our "demo/proof of concept" ready to roll, and we realized that one of the character is overall a bit too loud for our taste compared to the other.
    So I was wondering if there was a way to lower the overall output of a specific character in Visionaire the same way you can do with individual sounds.

    Cheers

    Cesar
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 11 years ago
    speech is associated with speech volume, so you could simply listen out for when a display text by a specific character starts & adjust the speech volume accordingly then restore it back to whatever percentage it was at before.

    I'll not go into the exact how as there are plenty of threads on here showing you how to use the registerHookFunction() for setTextPosition or the registerEventHandler with the textStarted, textStopped event handlers. There are examples available on the wiki (look under scripting & player commands - if I remember correctly). Then all you need to do is store current volume level inside of a variable & then adjust current speech volume level - x % if x character is currently speaking, then restore back to value you stored in the variable when character stops speaking.
  4. · 11 years ago
    Thank you for answering.
    I was afraid you say something like this... :p
    I was hopping fort a simpler way to deal with it. (i'm the noobest of all the scripters in the neighborhood)
    Thank you very much, I'll check to see if I can cook up something before the release.

    Cheers
  5. · 11 years ago
    Something along the lines of this...
    local tmp_vol = nil
    
    function adaptedTextPosition(text)
     local owner = text.TextOwner
     if owner:getId().tableId == eCharacters and owner:getName() == 'Hero' then
      tmp_vol = getVolume(eSpeechVolume) -- store current volume
      setVolume( eSpeechVolume, (95 / 100) * getVolume(eSpeechVolume) ) -- 95% of current volume value
     end
     return false
    end
     
    registerHookFunction("setTextPosition", "adaptedTextPosition")
    
    
    function txtEnd(text)
     if tmp_vol ~= nil then
      setVolume(eSpeechVolume, tmp_vol)
     end 
    end
    
    registerEventHandler("textStopped", "txtEnd")
    

    ... can't guarantee it will work though as I've not tested it.
  6. · 11 years ago
    Damn ... I was not expecting you to cook something up !
    Thanks a lot mate !
    I'm gonna try it right away !

    Edit :

    Btw, Your name is on our demo credits :p
    (it was before you brought that new script mind you.)
  7. · 11 years ago
    haha, cheers & no worries. wink

    It might need a bit of tweaking as I quickly copy/pasted & edited the code in Sublime Text. It was early hours of the morning as you can see from the timestamp, so I couldn't really be bothered trying to implement & test it in a VS project.

    Quick note: you could probably swap out the registerHookFunction with a registerEventHandler with the textStarted event flag. They give me grief sometimes though, so I prefer using the hookfunction as it also listens out for text started & you don't have to reposition text as you can just return false to prevent it from forcing the text position.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?