##################################################################
# Dark Grass like in BW/B2W2 (can be extended to Flabebe/Oricorio grass #
# by Juliorain and (big shout out to Vendily!) #
##################################################################
V 19.1. For v17.2 scroll down; its in the spoiler below
Remember to have your 1) secondary BGM at the ready, 2) secondary grass in your tileset, 3) you know to assign the terrain value to the tile via the debug editor
In v19 making new terrain types is actually a lot easier because now we can assign properties directly into the terrain tag itself, rather than creating like 5 different methods that checks for the the terrain and gives it their associated properties. But it can be a little trickier when you're working with EncTypes. Audio is roughly the same, apart from a terrain tag call name change.
Step 1:
in
add a new attr reader; it can be any name, but to save yourself from headaches I recommend you name it
in def intialize
add a hash that ideally matches your new variable, declare it as a bool and set its default value to false
find your Tall Grass
remove the :must_walk and replace :land_wild_encounters => true with your new :dgrass_wild_encounters => true
Step 2)
Go to EncounterType
and make a new encounter type by copypasting Land
place it after LandNight for ease of placement in your Encounter data and replace :id with DarkGrass and :type with :darkgrass.
NOTE: :darkgrass is the id of the Encounter type and :DarkGrass is the name of the encounter type the game reads from your encounter.txt file
I am currently facing issues with PokeRadar compatibility so hang tight!
tuck your :dark grass in def has_land_encounters? . This method determines that your encounter will be triggered by walking over specified tiles.
then in def encounter_possible_here does what the method says and is a bool check on whether it is possible to generate encounters
after the OR evaluation you need to repeat the first check since it has to take :darkgrass from the array and checks your encounter data if it exists. You'll need to repeat the check here for every single new type of encounter grass you add.
finally this is the code that generates the encounter. notis the all caps after the ret = :DarkGrass is because it is now looking for the name of the encounter in your encounters.txt file. If you want to make each encounter time based, then add in the line ret = find_valid_encounter_type_for_time(:DarkGrass, time) if !ret, but you'd need to make a new enc type for each type of time encounter. HOWEVER, you do not need to do the last step every time if you assign the :darkgrass id to each of the timed encounters.
3) Same as in v17.2 but actually a lot easier. go to Utilities_BattleAudio
and insert this chunk of code:
# Dark Grass like in BW/B2W2 (can be extended to Flabebe/Oricorio grass #
# by Juliorain and (big shout out to Vendily!) #
##################################################################
V 19.1. For v17.2 scroll down; its in the spoiler below
Remember to have your 1) secondary BGM at the ready, 2) secondary grass in your tileset, 3) you know to assign the terrain value to the tile via the debug editor
In v19 making new terrain types is actually a lot easier because now we can assign properties directly into the terrain tag itself, rather than creating like 5 different methods that checks for the the terrain and gives it their associated properties. But it can be a little trickier when you're working with EncTypes. Audio is roughly the same, apart from a terrain tag call name change.
Step 1:
in
add a new attr reader; it can be any name, but to save yourself from headaches I recommend you name it
in def intialize
add a hash that ideally matches your new variable, declare it as a bool and set its default value to false
find your Tall Grass
copy/paste it. update its id number to something that is unused (best practice is to set it to lowest unused, which is 17 in vanilla essentials)
remove the :must_walk and replace :land_wild_encounters => true with your new :dgrass_wild_encounters => true
Step 2)
Go to EncounterType
and make a new encounter type by copypasting Land
place it after LandNight for ease of placement in your Encounter data and replace :id with DarkGrass and :type with :darkgrass.
NOTE: :darkgrass is the id of the Encounter type and :DarkGrass is the name of the encounter type the game reads from your encounter.txt file
I am currently facing issues with PokeRadar compatibility so hang tight!
tuck your :dark grass in def has_land_encounters? . This method determines that your encounter will be triggered by walking over specified tiles.
then in def encounter_possible_here does what the method says and is a bool check on whether it is possible to generate encounters
after the OR evaluation you need to repeat the first check since it has to take :darkgrass from the array and checks your encounter data if it exists. You'll need to repeat the check here for every single new type of encounter grass you add.
finally this is the code that generates the encounter. notis the all caps after the ret = :DarkGrass is because it is now looking for the name of the encounter in your encounters.txt file. If you want to make each encounter time based, then add in the line ret = find_valid_encounter_type_for_time(:DarkGrass, time) if !ret, but you'd need to make a new enc type for each type of time encounter. HOWEVER, you do not need to do the last step every time if you assign the :darkgrass id to each of the timed encounters.
3) Same as in v17.2 but actually a lot easier. go to Utilities_BattleAudio
and insert this chunk of code:
on line 9
Because fangames vary across possible encounters this assumes you have several things:
This has three sections:
1) Terrain Tag
2) Encounter
3) Music Code
1) This is perhaps the most straightforward code:
Add:
in the module in PBTerrain. If you have other terrains installed, use the lowest unused number.
after that find the methods PBTerrain.isGrass? and PBTerrain.isJustGrass?
replace with:
Part 2: In PBEncounters
add
into Module EncounterTypes
followed by:
within the module. Remember to watch for your commas!
In the string EncounterTypes add (while paying attention to formatting!):
or whichever encounter percentages you wish for each new encounter!
Finally in EnctypeDensities
add four 25's and 1's to each respective string. Your game will crash if you skip this step. If you have a differing number of new encounters, enter the information for however many new encounters you have.
then under method def isGrass?
add the following method:
Then under the method def pbEncounterType directly under:
paste:
here is where it gets tricky.
replace the method def isEncounterPossibleHere? with:
Since your encounter is dependent on terrain tag, pokemon essentials seems to only want to draw your in-game location once. If you have multiple calls for your terrain tag, the game will take only the first one. However, including the checks on the same line means that they are getting all your data at once. With this in mind you can actually extend it an infinite number of grass tiles so long as you do the above for each new type of terrain-dependent encounter (and your game can handle it!)
If you have custom encounters, check to see if you can add your code to that method. For instance if you have sludge water, a special type of water encounters, then you might want to add that code back into the above method.
and there you have it! you have dark grass encounters for all times of the day.
Part 3: The music
This took a little time but when I figured it out it was three lines of code.
In PSystem_File Utilities
ctrl+f for def pbGetWildBattleBGM(species) and under:
add the three lines of code:
And voila! remember to specify the file name! It doesn't need the path to the BGM folder as it has been preloaded in another Utilities script. Just make sure it is in the BGM subfolder of your Audio folder, and spelled correctly.
- 2 Grass Sprites in your tileset and you have your alt wild battle theme
- Assuming you just have the default encounters and/or terrain tags, if you have multiple custom ones, it is good to know that they are compatible. Just the module numbers might vary.
- This guide is for v17.2 as the scripts needed are most likely not available in earlier versions...the code is there, but it is up to you dig for that
This has three sections:
1) Terrain Tag
2) Encounter
3) Music Code
1) This is perhaps the most straightforward code:
Add:
Code:
DarkGrass = 16
in the module in PBTerrain. If you have other terrains installed, use the lowest unused number.
after that find the methods PBTerrain.isGrass? and PBTerrain.isJustGrass?
replace with:
Code:
def PBTerrain.isGrass?(tag)
return tag==PBTerrain::Grass ||
tag==PBTerrain::TallGrass ||
tag==PBTerrain::UnderwaterGrass ||
tag==PBTerrain::SootGrass ||
tag==PBTerrain::DarkGrass
end
def PBTerrain.isDarkGrass?(tag)
return tag==PBTerrain::DarkGrass
end
def PBTerrain.isJustGrass?(tag) # The Poké Radar only works in these tiles
return tag==PBTerrain::Grass ||
tag==PBTerrain::SootGrass ||
tag==PBTerrain::DarkGrass
end
def PBTerrain.isJustDarkGrass?(tag)
return tag==PBTerrain::DarkGrass
end
Part 2: In PBEncounters
add
Code:
DarkGrass = 13
DarkGrassMorn = 14
DarkGrassDay = 15
DarkGrassNite = 16
into Module EncounterTypes
followed by:
Code:
"DarkGrass",
"DarkGrassMorn",
"DarkGrassDay",
"DarkGrassNite"
within the module. Remember to watch for your commas!
In the string EncounterTypes add (while paying attention to formatting!):
Code:
[20,20,10,10,10,10,5,5,4,4,1,1],
or whichever encounter percentages you wish for each new encounter!
Finally in EnctypeDensities
add four 25's and 1's to each respective string. Your game will crash if you skip this step. If you have a differing number of new encounters, enter the information for however many new encounters you have.
then under method def isGrass?
add the following method:
Code:
def isDarkGrass?
return false if @density==nil
return (@enctypes[EncounterTypes::DarkGrass] ||
@enctypes[EncounterTypes::DarkGrassMorn] ||
@enctypes[EncounterTypes::DarkGrassDay] ||
@enctypes[EncounterTypes::DarkGrassNite]) ? true : false
end
Then under the method def pbEncounterType directly under:
Code:
elsif self.isCave?
return EncounterTypes::Cave
paste:
Code:
elsif self.isDarkGrass? && PBTerrain.isDarkGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
time = pbGetTimeNow
enctype = EncounterTypes::DarkGrass
enctype = EncounterTypes::DarkGrassNite if self.hasEncounter?(EncounterTypes::DarkGrassNite) && PBDayNight.isNight?(time)
enctype = EncounterTypes::DarkGrassDay if self.hasEncounter?(EncounterTypes::DarkGrassDay) && PBDayNight.isDay?(time)
enctype = EncounterTypes::DarkGrassMorn if self.hasEncounter?(EncounterTypes::DarkGrassMorn) && PBDayNight.isMorning?(time)
return enctype
here is where it gets tricky.
replace the method def isEncounterPossibleHere? with:
Code:
def isEncounterPossibleHere?
if $PokemonGlobal && $PokemonGlobal.surfing
return true
elsif PBTerrain.isIce?(pbGetTerrainTag($game_player))
return false
elsif self.isCave?
return true
elsif self.isGrass? || self.isDarkGrass?
return PBTerrain.isGrass?($game_map.terrain_tag($game_player.x,$game_player.y)) || PBTerrain.isDarkGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
end
return false
end
Since your encounter is dependent on terrain tag, pokemon essentials seems to only want to draw your in-game location once. If you have multiple calls for your terrain tag, the game will take only the first one. However, including the checks on the same line means that they are getting all your data at once. With this in mind you can actually extend it an infinite number of grass tiles so long as you do the above for each new type of terrain-dependent encounter (and your game can handle it!)
If you have custom encounters, check to see if you can add your code to that method. For instance if you have sludge water, a special type of water encounters, then you might want to add that code back into the above method.
and there you have it! you have dark grass encounters for all times of the day.
Part 3: The music
This took a little time but when I figured it out it was three lines of code.
In PSystem_File Utilities
ctrl+f for def pbGetWildBattleBGM(species) and under:
Code:
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
ret=nil
add the three lines of code:
Code:
if !ret && $game_map && PBTerrain.isDarkGrass?($game_map.terrain_tag($game_player.x,$game_player.y))
ret = pbStringToAudioFile("30 Wild Battle 02")
end
And voila! remember to specify the file name! It doesn't need the path to the BGM folder as it has been preloaded in another Utilities script. Just make sure it is in the BGM subfolder of your Audio folder, and spelled correctly.
- Credits
- Juliorain + Vendily