voice_tag and SetCharacterVolume problem[SOLVED!]

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Yuuji
Regular
Posts: 96
Joined: Tue Jan 20, 2015 3:08 am
Location: Russia, Perm
Contact:

voice_tag and SetCharacterVolume problem[SOLVED!]

#1 Post by Yuuji » Mon Apr 13, 2015 6:50 am

Hello! I have several characters in my game and I want to implement personal volume to each of them. I use voice_tag.
Some of my code:

Code: Select all

    def mobVolumeUpdate(value):
        persistent.mob_volume = value
        SetCharacterVolume(voice_tag = 'mob', volume = persistent.mob_volume)

    mobVolumeAdjust = ui.adjustment(range=1.0, value=persistent.mob_volume, adjustable=True, changed=mobVolumeUpdate)
This is the code from sound settings screen.
Now scenario code:

Code: Select all

    $playVoice2('mob', 'op_002')
    policeman "«Так ты из Яманаси прибыл, значит?»"
    yuuji "«Да.»"
    $playVoice2('mob', 'op_003')
    policeman "«По какому делу прибыл в этот город? Тащишь такой большой рюкзак... Куда-то переезжаешь?»"
And at last playVoice2 function code:

Code: Select all

    def playVoice2(character, file):
        store.current_voice = file
        store.current_character = character
        voice("voice/" + character + '/' + file + ".ogg", tag = character)
It should work but it doesn't so I suppose I've done something wrong. Maybe you have any ideas where I've mistaken? I'd appreciate any help.
Last edited by Yuuji on Mon Apr 13, 2015 7:47 am, edited 1 time in total.
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.

User avatar
Yuuji
Regular
Posts: 96
Joined: Tue Jan 20, 2015 3:08 am
Location: Russia, Perm
Contact:

Re: voice_tag and SetCharacterVolume problem

#2 Post by Yuuji » Mon Apr 13, 2015 7:47 am

Well... I got solution for my problem myself.

Code: Select all

    def mobVolumeUpdate(value):
        persistent._character_volume['mob'] = value

    mobVolumeAdjust = ui.adjustment(range=1.0, value=persistent._character_volume['mob'], adjustable=True, changed=mobVolumeUpdate)
SetCharacterVolume doesn't set 'mob' key in persistent._character_volume dictionary. So when I added and set this key myself it began to work.
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.

Post Reply

Who is online

Users browsing this forum: No registered users