v20.1 Alternate cycling music

This thread pertains to v20.1 of Pokémon Essentials.

Miescgar555

Rookie
Member
Joined
Mar 12, 2023
Posts
3
Age
19
I have been planning on how to make my fangame and I had a new idea for a simple mechanic:
Multiple cycling music, you can find a person in the bike shop who will change the music you listen to while cycling. By doing various chores (for example, showing him a certain pokemon), you can unlock a list of "themes" that he'll install in your bike's mp3.
You just have to go see the man every time you want to change the music (Cause it would be a very difficult to make a menu). This mechanic is perfect for the people who cannot choose what cycling music use (first gen, second, third....) like me.
The thing is I am useless when it comes to scripting. So, is there anyone with enough skill to make this using the variables that RPG Maker provides in v20?
 
Solution
After a week of try and failure, i've done it.
This is what to do:

1. First, download the cycling music you want to add (BW, RZ, DPPl....), Remember: IT HAS TO BE IN .OGG FORMAT. Then add it to "BGM" folder and name it "Bicycle_1".

2. Create a rpg maker XP variable and write down the variable ID for later use.

3. In Game_Player, in line 605, you can find this code.
Ruby:
  bike_bgm = GameData::Metadata.get.bicycle_BGM
Select it and replace with this
Ruby:
   if $game_variables[26] == 1
     bike_bgm = "Bicycle_1"
     end
   if $game_variables[26] == 0
     bike_bgm = "Bicycle"
     end
(You must replace the number 26 with the variable ID you created before).

And just like that, you can alternate cycling music using game variables.
If...

Miescgar555

Rookie
Member
Joined
Mar 12, 2023
Posts
3
Age
19
After a week of try and failure, i've done it.
This is what to do:

1. First, download the cycling music you want to add (BW, RZ, DPPl....), Remember: IT HAS TO BE IN .OGG FORMAT. Then add it to "BGM" folder and name it "Bicycle_1".

2. Create a rpg maker XP variable and write down the variable ID for later use.

3. In Game_Player, in line 605, you can find this code.
Ruby:
  bike_bgm = GameData::Metadata.get.bicycle_BGM
Select it and replace with this
Ruby:
   if $game_variables[26] == 1
     bike_bgm = "Bicycle_1"
     end
   if $game_variables[26] == 0
     bike_bgm = "Bicycle"
     end
(You must replace the number 26 with the variable ID you created before).

And just like that, you can alternate cycling music using game variables.
If you want to add more cycling music you can follow the pattern.
Example:
Ruby:
   if $game_variables[26] == 3
     bike_bgm = "Bicycle_3"
     end
   if $game_variables[26] == 2
     bike_bgm = "Bicycle_2"
     end
   if $game_variables[26] == 1
     bike_bgm = "Bicycle_1"
     end
   if $game_variables[26] == 0
     bike_bgm = "Bicycle"
     end

I accept criticism about the code, but remember: I'm useless when it comes to scripting.
 
Solution

KhorneRDM

Rookie
Member
Joined
Nov 6, 2022
Posts
7
Age
22
After a week of try and failure, i've done it.
This is what to do:

1. First, download the cycling music you want to add (BW, RZ, DPPl....), Remember: IT HAS TO BE IN .OGG FORMAT. Then add it to "BGM" folder and name it "Bicycle_1".

2. Create a rpg maker XP variable and write down the variable ID for later use.

3. In Game_Player, in line 605, you can find this code.
Ruby:
  bike_bgm = GameData::Metadata.get.bicycle_BGM
Select it and replace with this
Ruby:
   if $game_variables[26] == 1
     bike_bgm = "Bicycle_1"
     end
   if $game_variables[26] == 0
     bike_bgm = "Bicycle"
     end
(You must replace the number 26 with the variable ID you created before).

And just like that, you can alternate cycling music using game variables.
If you want to add more cycling music you can follow the pattern.
Example:
Ruby:
   if $game_variables[26] == 3
     bike_bgm = "Bicycle_3"
     end
   if $game_variables[26] == 2
     bike_bgm = "Bicycle_2"
     end
   if $game_variables[26] == 1
     bike_bgm = "Bicycle_1"
     end
   if $game_variables[26] == 0
     bike_bgm = "Bicycle"
     end

I accept criticism about the code, but remember: I'm useless when it comes to scripting.
Little advice : if you have many conditions (if) using the same variable (here, $game_variable[26]), you should use a switch instead of ifs ! :)
 
Top