Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Extended Music Room for Ren'Py

Fully featured music room with improved usability and setup for Ren'Py. · By Feniks

Specific unlocking condition for music + notification

A topic by Cloonesk created 43 days ago Views: 52 Replies: 3
Viewing posts 1 to 2

Hello there,

Your music room code is doing wonders, thanks a lot for that ! However, I would like to implement 2 additional things, and I'm not sure what I should modify:

- the first thing would be to have a specific unlocking condition for some of the music: basically, the song would be unlocked the following chapter it was heard for the first time. So I would have a dict storing the locked status of these songs but I'm not sure where in the code I should query this dict.

- the second thing would be to display a notification pop-up when the next song starts playing. I suppose I should be using the current_track variable somehow ?


Thanks a lot for your help!

Developer

Glad to hear you like it! For the unlocking condition, that's built in - there's an example in the code and the README also. It's the argument unlock_condition. You can set that to a string like unlock_condition="persistent.seen_chapter1" for example, and then set $ persistent.seen_chapter1 = True in your script when the song should be unlocked. A dictionary would work too, or a set; whatever you like! The condition just has to be in quotes and should be persistent (most likely) so players can see it on the main menu.

As for the second thing, you can add that to the add method in the music room backend. There's a line that looks like this:

super(ExtendedMusicRoom, self).add(track.path,

    always_unlocked=track.unlock_condition=="True",

    action=SetScreenVariable('current_track', track))

You can change it to:

super(ExtendedMusicRoom, self).add(track.path,

    always_unlocked=track.unlock_condition=="True",

    action=[SetScreenVariable('current_track', track),

        Notify("Now playing: {0}".format(track.name))])

You can update that Notify message however you like. That way it'll still update the current_track but will also have a notification show up!

Thanks a lot ! Just a quick question about the first thing, when you write unlock_condition="persistent.seen_chapter1", does it mean that unlock_condition will always be equal to the current value of persistent.seen_chapter1 ? So it will be automatically updated when seen_chapter1 is updated ?

Developer

Yes, it's evaluated when the tracklist is checked (which basically means it'll be updated whenever the variable is). It's the same concept as the built-in gallery unlock conditions or how you write ConditionSwitch conditions.