Different bleeps for 1 character?

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
Zapor
Newbie
Posts: 2
Joined: Mon Mar 09, 2020 10:26 am
Deviantart: Zapor666
Contact:

Different bleeps for 1 character?

#1 Post by Zapor »

Hello anyone!

I am use character bleeps method, simular to undertale etc, but i notised what sounds... not alwayse related character images.

i mean, you can use tags for images like "Girl happy", "Girl mad" etc.
And in game it work perfect.

girl happy " Hello!"
girl mad "Arrgh!"

but, when it come to bleeps sounds, it alwayse a same!

Code: Select all

def Stelbeep(event, **kwargs):
        if event == "show":
            renpy.sound.play("audio/St.wav", loop = True)
        elif event == "slow_done" or event == "end":
            renpy.sound.stop()
It is how it work right now. But i want use character tags for select different bleeps! Like:

Code: Select all

def Stelbeep(event, **kwargs):
        if event == "show":
            if character tag == "happy":
                renpy.sound.play("audio/happy.wav", loop = True)
            elif character tag == "sad":
                renpy.sound.play("audio/sad.wav", loop = True)
        elif event == "slow_done" or event == "end":
            renpy.sound.stop()
But i not know where i can find characters tags and use it! maybe i can use Voice tag for this? or try grab info from image tags?

User avatar
Vladya
Regular
Posts: 34
Joined: Sun Sep 20, 2020 3:16 am
Github: NyashniyVladya
Contact:

Re: Different bleeps for 1 character?

#2 Post by Vladya »

You need _side_image_attributes variable.
This is a tuple of strings (or None), where the first element is the image tag associated with the character, and the subsequent elements are the attributes passed along with the name (exactly what you are looking for).

Example:

Code: Select all

init python:

    def char_callback(event, *args, **kwargs):

        if event == "show":

            _image_tag = char_tag = None
            if _side_image_attributes:
                _image_tag = _side_image_attributes[0]
                char_tag = ' '.join(_side_image_attributes[1:])

            if char_tag == "happy":
                renpy.sound.play("audio/happy.wav", loop=True)
            elif char_tag == "sad":
                renpy.sound.play("audio/sad.wav", loop=True)
            else:
                renpy.sound.play("audio/default.wav", loop=True)

        elif event in ("slow_done", "end"):
            renpy.sound.stop()


Zapor
Newbie
Posts: 2
Joined: Mon Mar 09, 2020 10:26 am
Deviantart: Zapor666
Contact:

Re: Different bleeps for 1 character?

#3 Post by Zapor »

Thank you, it really working!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot]