Logo

[SM5] UNLOCK SYSTEM TUTORIAL

Register Log In Back To Forums

Post #1 · Posted at 2019-04-05 11:47:21am 2.7 months ago

Offline leadbman
leadbman Avatar Member
210 Posts
Australia
Reg. 2016-02-01
Log in to send this user a private message
"Working On: 5thMix BGA bgchanges"
Hi all,

After many, many years of trying to get the unlock system to work like it used to in 3.9, I've worked out how to implement it simply into all our themes.

It involves 2 easy steps:

Step 1) Locking
In your metrics.ini file you need to tell the theme what songs are unlocks. Under [UnlockManager] add the following:

[UnlockManager]
AutoLockChallengeSteps=false
UnlockNames="1,2"
Unlock1Command=song,"DDR 4thMIX/.59";require,"UnlockRequirement_StagesCleared",0
Unlock2Command=song,"DDR 2ndMIX/MAKE IT BETTER (So-REAL Mix)";require,"UnlockRequirement_StagesCleared",0

Explaination)
Now, with mine above, I'm locking .59 from 4thMIX and MAKE IT BETTER (So-REAL Mix) from 2ndMIX as an example.

The way these lines work is you need to identify them with the UnlockNames line. Whatever goes between the words Unlock and Command is what you put where I have "1,2". I find using the numbers helps so when you're setting what songs to unlock later, you can know which one you're unlocking.

Then the next lines lock the specific songs. To select a song to lock you need to give the folder name then / then the songs folder name. Like this: song,"GROUP FOLDER/SONG FOLDER";

It doesn't matter what the requirement is because SM5 doesn't automatically unlock songs based on the "require" part of these lines from what I've found. But you still do need it there to lock the song so I've set mine to be require,"UnlockRequirement_StagesCleared",0

So now if you close SM5 and reopen it, you'll notice that the songs you've listed are now hidden/locked on your music select screen.

IMPORTANT NOTE: If you edit the [UnlockManager] lines in the metrics.ini you need to restart SM rather than just pressing F2 for the metrics to reload. Just thought I'd mention this as the songs get locked while the songs are being cached before the game fully boots up. So they won't lock if you don't restart the game (if it's already open that is).

Step 2) Unlocking
In your themes folder under BGAnimations\ScreenSelectMusic in (you could do this elsewhere but this is where I've done mine). Add the following in the default.lua:

if (PROFILEMAN:GetProfile(PLAYER_1):GetNumTotalSongsPlayed() >= 10) or (PROFILEMAN:GetProfile(PLAYER_2):GetNumTotalSongsPlayed() >= 10) then
UNLOCKMAN:UnlockEntryID('1');
else
UNLOCKMAN:LockEntryID('1');
end;

if (PROFILEMAN:GetProfile(PLAYER_1):GetNumTotalSongsPlayed() >= 20) or (PROFILEMAN:GetProfile(PLAYER_2):GetNumTotalSongsPlayed() >= 20) then
UNLOCKMAN:UnlockEntryID('2');
else
UNLOCKMAN:LockEntryID('2');
end;

Explaination)
In my example these lines of code now unlock the songs based off number of songs played on the currently loaded profiles and locks the songs if they number of songs haven't been met. I know this is a long way to code it but I've just worked this out by tinkering with the code this way, I'll eventually tidy it up.

The break down for the code is as follows:
if (PROFILEMAN:GetProfile(PLAYER_1):GetNumTotalSongsPlayed() >= ##) or (PROFILEMAN:GetProfile(PLAYER_2):GetNumTotalSongsPlayed() >= ##) then

This line checks if Player 1's profile OR Player 2's profile have played greater than or equal to the number of songs you want to set as the songs unlock requirement.

In terms of the way these unlock, you're free check for whatever here - you could check for number of calories burnt, number of songs played, total jumps made by the player etc. Pretty much anything you can pull from the PROFILE MANAGER (PROFILEMAN) or elsewhere. This opens up a world of possibilities for an unlocking system and doesn't hold us back with just the few unlock options listed in the lua doc in the github.

In fact, I just realised if you placed this code on for example, the Evaluation screen, you could even show what song was unlocked by the player! So the options and features you could tie to this are plentiful.

------------

UNLOCKMAN:UnlockEntryID('#');

This line unlocks the unlock ID that we set back in the metrics.ini. This makes the song available if Player 1 or Player 2 have hit the milestone.

------------

UNLOCKMAN:LockEntryID('#');

This line locks or keeps locked the song if the requirements are not met. This is an important line as if you set the song as "unlocked", it will remain unlocked until you lock it again, so if Player 1 for example unlocks it and you don't have the "lock" command here it will remain unlocked for any player, even if they haven't passed the milestone. So to keep it locked for each profile till they unlock it themselves, I set this.

------------

And that folks, is it. The whole unlock system is literally a couple of lines and we don't need to use an unlock code or unlock screen etc like many forum posts have suggested over the years.

I hope this helps someone! If you've got any questions at all, feel free to ask and I'll see if I can help.
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #2 · Posted at 2019-04-05 12:31:31pm 2.7 months ago

Offline Peterrw9000
Peterrw9000 Avatar Member
29 Posts
United States
Reg. 2018-07-20
Log in to send this user a private messageDiscord: Peter#2279
Steam: https://steamcommunity.com/profiles/76561198224016436/
would it be possible to set the unlock requirement to passing a certain song like how sound voltex does?

Post #3 · Posted at 2019-04-05 12:51:22pm 2.7 months ago

Offline leadbman
leadbman Avatar Member
210 Posts
Australia
Reg. 2016-02-01
Log in to send this user a private message
"Working On: 5thMix BGA bgchanges"
I don't see why not - I'd have to look through the lua stuff to work out how to do it but you'd just need to check if the song has been passed.

I just found this:
HasPassedAnyStepsInSong

It's listed under the Profile section of the lua doc in the github. I'll have a play around with it when I get a chance and see if I can get it to work.

But yes, it's definitely a possibility. I'll get back to you when I can.
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #4 · Posted at 2019-04-05 08:04:55pm 2.7 months ago

Offline ZTS
ZTS Avatar Member
82 Posts
Not Set
Reg. 2015-01-13
Log in to send this user a private messageYouTube
Can I paste this into the SM wiki? Right now it only has information on what the unlocks are and not how to use them.

https://github.com/stepmania/stepmania/wiki/Unlock-System
Maker of PIU Delta NEX Rebirth and MBAACC for StepMania 5, Rave It Out dev, and more
StepMania theme dev discord: https://discord.gg/KyTnjY4
Check out SM-RIO featuring mods for pump incl. linux PacDrive, Windows PIUIO, and more: https://github.com/RhythmLunatic/stepmania

Post #5 · Posted at 2019-04-08 02:40:30am 2.6 months ago

Offline dbk2
dbk2 Avatar Member
316 Posts
United States
Reg. 2012-04-30
Log in to send this user a private message
"I pass d with a q though."
Thank you for taking the time to investigate this. Thank you especially for taking the time to write this guide. I admire your perseverance, enthusiasm, and desire to help.

Post #6 · Posted at 2019-04-08 02:48:59am 2.6 months ago

Offline leadbman
leadbman Avatar Member
210 Posts
Australia
Reg. 2016-02-01
Log in to send this user a private message
"Working On: 5thMix BGA bgchanges"
Quote: ZTS
Can I paste this into the SM wiki? Right now it only has information on what the unlocks are and not how to use them.

https://github.com/stepmania/stepmania/wiki/Unlock-System

I'm happy for this to be added to it. But if you do add it, append it to the existing information and don't remove the current stuff (for legacy stuff/so if we can fix the normal way it can be revised). Also, would I be able to edit it if I sign up for github? Just asking in case I can streamline this more.

Quote: dbk2
Thank you for taking the time to investigate this. Thank you especially for taking the time to write this guide. I admire your perseverance, enthusiasm, and desire to help.

Mate, I could not have done many things I've achieved within StepMania 5 without your great resources and assistance over the years. In fact, while I was working this out I looked through your Simply Love unlock screen Lua's and that helped me work out bits of how to best implement it and how things work.

I hope you've been well Dan, it's been a while since I've seen you around the place. Really good to see you posting again.
https://zenius-i-vanisher.com/ddrsig/18213.png?t=1510895050
Really need to add my scores to the tracker soon.
Always learning, always trying to push the boundaries of SM.

Post #7 · Posted at 2019-04-10 01:55:10pm 2.5 months ago

Offline yor42
yor42 Avatar Member
1 Post
South Korea
Reg. 2016-08-26
Log in to send this user a private messageTwitter: @yoonch918Twitch
Steam: yoondg72
Quote: leadbman
I just found this:
HasPassedAnyStepsInSong

It's listed under the Profile section of the lua doc in the github. I'll have a play around with it when I get a chance and see if I can get it to work.

I tried it, and it works. try this.

if (PROFILEMAN:GetProfile(PLAYER_1):HasPassedAnyStepsInSong(SONGMAN:FindSong("Insert required song location here"))) or (PROFILEMAN:GetProfile(PLAYER_2):HasPassedAnyStepsInSong(SONGMAN:FindSong(("Insert required song location here"))) then
UNLOCKMAN:UnlockEntryID('ID of locked Song');
else
UNLOCKMAN:LockEntryID('ID of locked Song');
end;


P.S. This is my first post. I don't know how to put codes in frame. :/ and English is not my first language. there might be few grammar errors. please understand.

Post #8 · Posted at 2019-04-10 07:06:46pm 2.5 months ago

Offline ZTS
ZTS Avatar Member
82 Posts
Not Set
Reg. 2015-01-13
Log in to send this user a private messageYouTube
Quote: leadbman
Quote: ZTS
Can I paste this into the SM wiki? Right now it only has information on what the unlocks are and not how to use them.

https://github.com/stepmania/stepmania/wiki/Unlock-System

I'm happy for this to be added to it. But if you do add it, append it to the existing information and don't remove the current stuff (for legacy stuff/so if we can fix the normal way it can be revised). Also, would I be able to edit it if I sign up for github? Just asking in case I can streamline this more.
Yes, the wiki is open to any github user.
Maker of PIU Delta NEX Rebirth and MBAACC for StepMania 5, Rave It Out dev, and more
StepMania theme dev discord: https://discord.gg/KyTnjY4
Check out SM-RIO featuring mods for pump incl. linux PacDrive, Windows PIUIO, and more: https://github.com/RhythmLunatic/stepmania

Post #9 · Posted at 2019-05-20 05:24:22am 1.2 months ago

Offline NekoNekoMata
NekoNekoMata Avatar Member
47 Posts
Not Set
Reg. 2017-02-12
Log in to send this user a private messageSkype: pk_fire_1997TumblrYouTube

Last updated: 2019-05-20 05:24am
Please help, the songs aren't appearing when I reach the unlock goal... :/

Quote: NekoNekoMata
Please help, the songs aren't appearing when I reach the unlock goal... :/


Nvm I figured It out! Big Grin
http://i.imgur.com/eYGl2fY.png
Credit: Aegis
Register Log In Back To Forums

0 User(s) Viewing This Thread (Past 15 Minutes)

©2006-2019 Zenius -I- vanisher.com -5th style- IIPrivacy Policy
Web Server: 1% · Database: 8% · Server Time: 2019-06-26 11:58:00
This page took 0.009 seconds to execute.
Theme: starlight · Language: englishuk
Reset Theme & Language