- 115
- Posts
- 10
- Years
- Seen Nov 17, 2023
As we all know, default essentials only allows us to define one surf theme for our entire game. But if you plan on having more than one region with different surf themes, or maybe just feel like having a different surf theme for a certain map, there is no way to accomplish this.
I was able to play around with a few of the scripts and figured out how to define the surf theme in each map's metadata. Please bear with me as there are multiple steps to this process.
1. In MiscData around line 114, add the highlighted line of code to this section:
2. In Editor around line 3509, add the highlighted lines of code to this section:
This will add a new field in the map's metadata for the map's surf theme.
3. PSystem_Utilities around line 1478-1481 insert the highlighted code underneath the def pbGetWildBattleBGM block:
4. In PField_HiddenMoves around line 500, comment out surfbgm=pbGetMetadata(0,MetadataSurfBGM) and add the line surfbgm=pbGetSurfTheme underneath it:
5. In PField_Field around line 1990 comment out the line surfbgm=pbGetMetadata($game_map.map_id,MetadataSurfTheme) and insert the line surfbgm=pbGetSurfTheme underneath it for BOTH pbAutoplayOnTransition AND FOR pbAutoplayOnSave YOU MUST DO THIS FOR BOTH OR ELSE THE SURF THEME WILL NOT PLAY CORRECTLY.
That should be all you need to change. Now when you go into the editor and edit each map's metadata, there should be an extra field at the bottom of the list for the surf theme of that map.
WARNING: If you decide to go with this method, you will have to define a surf theme for every map that contains a surfable body of water. Otherwise it may not play anything when you surf.
I was able to play around with a few of the scripts and figured out how to define the surf theme in each map's metadata. Please bear with me as there are multiple steps to this process.
1. In MiscData around line 114, add the highlighted line of code to this section:
Spoiler:
Code:
NonGlobalTypes={
"Outdoor"=>[MetadataOutdoor,"b"],
"ShowArea"=>[MetadataShowArea,"b"],
"Bicycle"=>[MetadataBicycle,"b"],
"BicycleAlways"=>[MetadataBicycleAlways,"b"],
"HealingSpot"=>[MetadataHealingSpot,"uuu"],
"Weather"=>[MetadataWeather,"eu",:PBFieldWeather],
"MapPosition"=>[MetadataMapPosition,"uuu"],
"DiveMap"=>[MetadataDiveMap,"u"],
"DarkMap"=>[MetadataDarkMap,"b"],
"SafariMap"=>[MetadataSafariMap,"b"],
"SnapEdges"=>[MetadataSnapEdges,"b"],
"Dungeon"=>[MetadataDungeon,"b"],
"BattleBack"=>[MetadataBattleBack,"s"],
"WildBattleBGM"=>[MetadataMapWildBattleBGM,"s"],
"TrainerBattleBGM"=>[MetadataMapTrainerBattleBGM,"s"],
"WildVictoryME"=>[MetadataMapWildVictoryME,"s"],
"TrainerVictoryME"=>[MetadataMapTrainerVictoryME,"s"],
"MapSize"=>[MetadataMapSize,"us"],
[S-HIGHLIGHT]"SurfTheme"=>[MetadataSurfTheme,"s"],[/S-HIGHLIGHT]
}
2. In Editor around line 3509, add the highlighted lines of code to this section:
Spoiler:
Code:
LOCALMAPS=[
["Outdoor",BooleanProperty,
_INTL("If true, this map is an outdoor map and will be tinted according to time of day.")],
["ShowArea",BooleanProperty,
_INTL("If true, the game will display the map's name upon entry.")],
["Bicycle",BooleanProperty,
_INTL("If true, the bicycle can be used on this map.")],
["BicycleAlways",BooleanProperty,
_INTL("If true, the bicycle will be mounted automatically on this map and cannot be dismounted.")],
["HealingSpot",MapCoordsProperty,
_INTL("Map ID of this Pokemon Center's town, and X and Y coordinates of its entrance within that town.")],
["Weather",WeatherEffectProperty,
_INTL("Weather conditions in effect for this map.")],
["MapPosition",RegionMapCoordsProperty,
_INTL("Identifies the point on the regional map for this map.")],
["DiveMap",MapProperty,
_INTL("Specifies the underwater layer of this map. Use only if this map has deep water.")],
["DarkMap",BooleanProperty,
_INTL("If true, this map is dark and a circle of light appears around the player. Flash can be used to expand the circle.")],
["SafariMap",BooleanProperty,
_INTL("If true, this map is part of the Safari Zone (both indoor and outdoor). Not to be used in the reception desk.")],
["SnapEdges",BooleanProperty,
_INTL("If true, when the player goes near this map's edge, the game doesn't center the player as usual.")],
["Dungeon",BooleanProperty,
_INTL("If true, this map has a randomly generated layout. See the wiki for more information.")],
["BattleBack",StringProperty,
_INTL("PNG files named 'battlebgXXX', 'enemybaseXXX', 'playerbaseXXX' in Battlebacks folder, where XXX is this property's value.")],
["WildBattleBGM",BGMProperty,
_INTL("Default BGM for wild Pokémon battles on this map.")],
["TrainerBattleBGM",BGMProperty,
_INTL("Default BGM for trainer battles on this map.")],
["WildVictoryME",MEProperty,
_INTL("Default ME played after winning a wild Pokémon battle on this map.")],
["TrainerVictoryME",MEProperty,
_INTL("Default ME played after winning a Trainer battle on this map.")],
["MapSize",MapSizeProperty,
_INTL("The width of the map in Town Map squares, and a string indicating which squares are part of this map.")],
[S-HIGHLIGHT] ["SurfTheme",BGMProperty,
_INTL("Default Surf theme on this map.")],[/S-HIGHLIGHT]
]
3. PSystem_Utilities around line 1478-1481 insert the highlighted code underneath the def pbGetWildBattleBGM block:
Spoiler:
Code:
def pbGetWildBattleBGM(species)
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
ret=nil
if !ret && $game_map
# Check map-specific metadata
music=pbGetMetadata($game_map.map_id,MetadataMapWildBattleBGM)
if music && music!=""
ret=pbStringToAudioFile(music)
end
end
if !ret
# Check global metadata
music=pbGetMetadata(0,MetadataWildBattleBGM)
if music && music!=""
ret=pbStringToAudioFile(music)
end
end
ret=pbStringToAudioFile("002-Battle02") if !ret
return ret
end
[S-HIGHLIGHT]def pbGetSurfTheme
ret=nil
if !ret && $game_map
# Check map-specific metadata
music=pbGetMetadata($game_map.map_id,MetadataSurfTheme)
if music && music!=""
ret=pbStringToAudioFile(music)
end
end
if !ret
# Check global metadata
music=pbGetMetadata(0,MetadataSurfBGM)
if music && music!=""
ret=pbStringToAudioFile(music)
end
end
ret=pbStringToAudioFile("002-Battle02") if !ret
return ret
end[/S-HIGHLIGHT]
def pbGetWildVictoryME
4. In PField_HiddenMoves around line 500, comment out surfbgm=pbGetMetadata(0,MetadataSurfBGM) and add the line surfbgm=pbGetSurfTheme underneath it:
Spoiler:
Code:
def Kernel.pbSurf
if $game_player.pbHasDependentEvents?
return false
end
if $DEBUG ||
(HIDDENMOVESCOUNTBADGES ? $Trainer.numbadges>=BADGEFORSURF : $Trainer.badges[BADGEFORSURF])
movefinder=Kernel.pbCheckMove(:SURF)
if $DEBUG || movefinder
if Kernel.pbConfirmMessage(_INTL("The water is a deep blue...\nWould you like to surf on it?"))
speciesname=!movefinder ? $Trainer.name : movefinder.name
Kernel.pbMessage(_INTL("{1} used Surf!",speciesname))
pbHiddenMoveAnimation(movefinder)
[S-HIGHLIGHT]#surfbgm=pbGetMetadata(0,MetadataSurfBGM)
surfbgm=pbGetSurfTheme[/S-HIGHLIGHT]
pbCueBGM(surfbgm,0.5) if surfbgm
pbStartSurfing()
return true
end
end
end
return false
end
5. In PField_Field around line 1990 comment out the line surfbgm=pbGetMetadata($game_map.map_id,MetadataSurfTheme) and insert the line surfbgm=pbGetSurfTheme underneath it for BOTH pbAutoplayOnTransition AND FOR pbAutoplayOnSave YOU MUST DO THIS FOR BOTH OR ELSE THE SURF THEME WILL NOT PLAY CORRECTLY.
Spoiler:
Code:
def pbAutoplayOnTransition
[S-HIGHLIGHT]#surfbgm=pbGetMetadata($game_map.map_id,MetadataSurfTheme)
surfbgm=pbGetSurfTheme[/S-HIGHLIGHT]
if $PokemonGlobal.surfing && surfbgm
pbBGMPlay(surfbgm)
else
$game_map.autoplayAsCue
end
end
def pbAutoplayOnSave
[S-HIGHLIGHT]#surfbgm=pbGetMetadata($game_map.map_id,MetadataSurfTheme)
surfbgm=pbGetSurfTheme[/S-HIGHLIGHT]
if $PokemonGlobal.surfing && surfbgm
pbBGMPlay(surfbgm)
else
$game_map.autoplay
end
end
That should be all you need to change. Now when you go into the editor and edit each map's metadata, there should be an extra field at the bottom of the list for the surf theme of that map.
![[PokeCommunity.com] Multiple Surf Themes [PokeCommunity.com] Multiple Surf Themes](https://i.imgur.com/b05m4We.png)
WARNING: If you decide to go with this method, you will have to define a surf theme for every map that contains a surfable body of water. Otherwise it may not play anything when you surf.