- 2,048
- Posts
- 17
- Years
- Seen Sep 7, 2023
As I promised, here are a couple of add-ons I made for poccil's Pokémon Essentials.
Poccil, if you want, add them to Essentials, but let me know when, and what ones, you add, so I can edit this to say which ones are included in the newest version.
Hopefully, these should come in useful in your games, but please give credit if used!
Day/Night Music Change - Included in Essentials
Map Details on Region Map - Included in Essentials
Sunlight Weather Effect - Partly Included in Essentials
Random Name Generator (by Poccil and Myself)
Change Map View Type in an Event (by Poccil)
This script lets you change the map view type with a Script event command. It was made by Poccil, but isn't in Essentials yet. To use it, use
where X is the map view (0=normal, 1=custom, 2=perspective).
Again, copy this into PokemonUtilities.
That's all the scripts for now. If you get a problem with one of these, tell me and I'll try to fix it. I'm also open to ideas for new add-ons - the night BGM one was a request.
BTW, think of these as teasers for the game I'm making :P.
Poccil, if you want, add them to Essentials, but let me know when, and what ones, you add, so I can edit this to say which ones are included in the newest version.
Hopefully, these should come in useful in your games, but please give credit if used!
Day/Night Music Change - Included in Essentials
Spoiler:
To use this, replace these lines in Game_Map* (lines 134-144):
with these:
Basically, to have a map play different music at night, name the BGM file for night the same as the BGM for day, but with an "n" on the end. For example, if the day BGM was 018-Field01.mid, the night BGM would be named 018-Field01n.mid. It will play automatically at night if it finds it.
Code:
#--------------------------------------------------------------------------
# ● BGM / BGS 自動切り替え
#--------------------------------------------------------------------------
def autoplay
if @map.autoplay_bgm
$game_system.bgm_play(@map.bgm)
end
if @map.autoplay_bgs
$game_system.bgs_play(@map.bgs)
end
end
Code:
#--------------------------------------------------------------------------
# ● BGM / BGS 自動切り替え
#--------------------------------------------------------------------------
def autoplay
if @map.autoplay_bgm # Checks whether the map has an autoplay BGM
if (Time.now.hour<6||Time.now.hour>=20) && # Checks if it's night time - the values are editable
FileTest.audio_exist?("Audio/BGM/"+ @map.bgm.name+ "n") # Checks whether a BGM file with the filename [normal BGM]n exists
$game_system.bgm_play(@map.bgm.name+"n") # Plays it
else
$game_system.bgm_play(@map.bgm) # Plays the normal BGM
end
end
if @map.autoplay_bgs
$game_system.bgs_play(@map.bgs)
end
end
Map Details on Region Map - Included in Essentials
Spoiler:
I was slightly annoyed that the map details didn't show up on the region map on the PokéGear, so I found out how from poccil. If you felt the same,I've attached a modified version of PokemonRegionMap. To use it, just replace PokemonRegionMap in the scripts with the text in my file. Here's a preview screenshot:
![[PokeCommunity.com] Pokémon Essentials Add-ons [PokeCommunity.com] Pokémon Essentials Add-ons](https://img187.imageshack.us/img187/2900/capture000iw0.png)
Sunlight Weather Effect - Partly Included in Essentials
Spoiler:
I also thought it would be good to have a harsh sunlight weather effect, like in Pokémon Ruby when you awaken Groudon. So I made one. To use, replace PokemonWeather with the attached file.
Then replace these lines (203 to 212) of PokemonField:
with:
Finally, replace this line in Compiler (about line 481):
with:
This will let you use the word "Sun" in the Metadata.txt file, under Weather, i.e. Weather=Sun,100.
Preview:
EDIT:The next script doesn't work properly at the moment, and is therefore not included in Essentials!
Alternatively, if you want the weather to go back to normal during the night, replace lines 126-149 in the NEW script:
with these lines:
Finally, you can make it alternate between Storm and Sunlight (like in Emerald) by adding these lines:
here:
and put this line:
below where it says @sun=0 near the beginning.
Basically, replace the ## with the ID of a switch. While that switch is on, the weather has a 1/2 chance to change every 160 frames, but only if the weather is Storm or Sun.
Then replace these lines (203 to 212) of PokemonField:
Code:
if $game_screen.weather_type==1 || $game_screen.weather_type==2
battle.weather=PBWeather::RAINDANCE
battle.weatherduration=-1
elsif $game_screen.weather_type==3
battle.weather=PBWeather::HAIL
battle.weatherduration=-1
elsif $game_screen.weather_type==4
battle.weather=PBWeather::SANDSTORM
battle.weatherduration=-1
end
Code:
if $game_screen.weather_type==1 || $game_screen.weather_type==2
battle.weather=PBWeather::RAINDANCE
battle.weatherduration=-1
elsif $game_screen.weather_type==3
battle.weather=PBWeather::HAIL
battle.weatherduration=-1
elsif $game_screen.weather_type==4
battle.weather=PBWeather::SANDSTORM
battle.weatherduration=-1
elsif $game_screen.weather_type==5
battle.weather=PBWeather::SUNNYDAY
battle.weatherduration=-1
end
Code:
"Weather"=>[7,"eu",["","Rain","Storm","Snow","Sandstorm"]],
Code:
"Weather"=>[7,"eu",["","Rain","Storm","Snow","Sandstorm","Sun"]],
Preview:
![[PokeCommunity.com] Pokémon Essentials Add-ons [PokeCommunity.com] Pokémon Essentials Add-ons](https://img444.imageshack.us/img444/4821/capture001ys3.png)
EDIT:The next script doesn't work properly at the moment, and is therefore not included in Essentials!
Alternatively, if you want the weather to go back to normal during the night, replace lines 126-149 in the NEW script:
Code:
def update
case @type
when 0
@viewport.tone.set(0,0,0,0)
when 1
@viewport.tone.set(-@max*3/4,-@max*3/4,-@max*3/4,10)
when 2
@viewport.tone.set(-@max*6/4,-@max*6/4,-@max*6/4,20)
when 3
@viewport.tone.set(@max*3/4,@max*3/4,@max*3/4,0)
when 4
@viewport.tone.set(@max*2/4,0,-@max*2/4,0)
when 5
unless @sun==@max || @sun==-@max
@sun=@max
end
if @sunvalue>@max
@sun=-@sun
end
if @sunvalue<0
@sun=-@sun
end
@sunvalue=@sunvalue+@sun/32
@viewport.tone.set(@sunvalue+63,@sunvalue+63,@sunvalue/2+31,0)
end
Code:
case @type
when 0
@viewport.tone.set(0,0,0,0)
if @sun!=0 && (Time.now.hour>=6||Time.now.hour<20)
$game_screen.weather(5,8,0)
end
when 1
@viewport.tone.set(-@max*3/4,-@max*3/4,-@max*3/4,10)
when 2
@viewport.tone.set(-@max*6/4,-@max*6/4,-@max*6/4,20)
when 3
@viewport.tone.set(@max*3/4,@max*3/4,@max*3/4,0)
when 4
@viewport.tone.set(@max*2/4,0,-@max*2/4,0)
when 5
unless @sun==@max || @sun==-@max
@sun=@max
end
if Time.now.hour<6||Time.now.hour>=20
$game_screen.weather(0,0,0)
else
if @sunvalue>@max
@sun=-@sun
end
if @sunvalue<0
@sun=-@sun
end
@sunvalue=@sunvalue+@sun/20
@viewport.tone.set(@sunvalue+63,@sunvalue+63,@sunvalue/2+31,0)
end
end
Code:
@timer+=1
if @timer==160
if @type==2 && rand(2)==0 && $game_switches[##]==true # where ## is the ID of a switch with which it is turned on
$game_screen.weather(5,8,0)
end
if @type==5 && rand(2)==0 && $game_switches[##]==true # same here
$game_screen.weather(2,8,0)
end
@timer=0
end
Code:
if rnd<4 && @type==2
@viewport.flash(Color.new(255,255,255,230),rnd*20)
end
[COLOR="Red"]@timer+=1
if @timer==160
if @type==2 && rand(2)==0 && $game_switches[##]==true
$game_screen.weather(5,8,0)
end
if @type==5 && rand(2)==0 && $game_switches[##]==true
$game_screen.weather(2,8,0)
end
@timer=0
end[/COLOR]
@viewport.update
return if @type == 0 || @type == 5
nomwidth=480
nomheight=320
Code:
@timer=0
Basically, replace the ## with the ID of a switch. While that switch is on, the weather has a 1/2 chance to change every 160 frames, but only if the weather is Storm or Sun.
Random Name Generator (by Poccil and Myself)
Spoiler:
Basically, it generates a random name when called, and stores it in a variable. To use it, call
as a script command, where W is either 0 for male, 1 for female, or 2 for poccil's original script (can be male or female), X is the ID of a variable to store the name in, and X is 0 for fully upper case, 1 for first letter upper case, and anything else for lower case. The parameter Z is optional - it describes the order of the letters in the name. Look at the script for the possible values. The name can be displayed by using Show Text, then typing \v*Y* where *Y* is the ID of the variable.
This is not designed for use in-game; rather, it is for creating random names for trainers, like on Colosseum and XD. However, it can be used in-game, for example with the Name Rater to change the name of a Pokémon. For this, you'd have to make conditional branches to check whether the Pokémon is male or female: use
, where *gender* is either 0,1 or 2 (0=male,1=female,2=genderless).
To make the name fully upper case, use
Replace the section beginning "def getRandomName" in PokemonUtilities with this script - it should be at about line 380 if you haven't got the Map View script, and about line 400 if you do.
Code:
getRandomName(W,X,Y,Z)
This is not designed for use in-game; rather, it is for creating random names for trainers, like on Colosseum and XD. However, it can be used in-game, for example with the Name Rater to change the name of a Pokémon. For this, you'd have to make conditional branches to check whether the Pokémon is male or female: use
Code:
Conditional Branch: Script: $Trainer.party[$game_variables[1]].gender == *gender*
To make the name fully upper case, use
Code:
Script: $game_variables[*ID of variable with name stored*].upcase
Replace the section beginning "def getRandomName" in PokemonUtilities with this script - it should be at about line 380 if you haven't got the Map View script, and about line 400 if you do.
Code:
def getRandomName(type,variable,upper,*formats)
if formats.length==0
case type
when 0
formats=%w( 1423 2341 23441 14235 1415 14141 142314 41423 4141 42341 )
when 1
formats=%w( 1416 14416 141416 23416 41416 423416 414236 14236 1414236 14146 )
when 2
formats=%w( cvcvvc cvvcvc cvcvcv vcvvc cvcv cvvc cvcv cvve bvc bve cve bvvc bvcv bvcvc)
end
end
format=formats[rand(formats.length)]
name=""
format.scan(/./) {|c|
case c
when "c"
set=%w( b c d f g h j k l l m n n p r r s s t t v w x z )
name+=set[rand(set.length)]
when "v"
set=%w( a a a e e e i i i o o o u u u y )
name+=set[rand(set.length)]
when "b" # two-letter "blends"
set=%w( br bl ch cl cr dr fr fl gh gl gr ph pl pr sc sh sk sl
sm sn sp st sw th tr tw wh wr )
name+=set[rand(set.length)]
when "e" # two-letter "blends" at end
set=%w( ck ch dd ff bb gg gh ld ll mm nd nt ng ph pt ps sk sh sp ss st rd
rn rp rm rk ns bs ft )
name+=set[rand(set.length)]
when "1"
set=%w( b c d f g h j k l m n p q r s t v w x z )
name+=set[rand(set.length)]
when "2"
set=%w( c f g k l p r s t )
name+=set[rand(set.length)]
when "3"
set=%w( h k l s t )
name+=set[rand(set.length)]
when "4"
set=%w( a e i o u )
name+=set[rand(set.length)]
when "5"
set=%w( e o u )
name+=set[rand(set.length)]
when "6"
set=%w( a e i )
name+=set[rand(set.length)]
end
}
case upper
when 0
name=name.upcase
when 1
name[0,1]=name[0,1].upcase
end
$game_variables[variable]=name
return name
end
Change Map View Type in an Event (by Poccil)
Spoiler:
This script lets you change the map view type with a Script event command. It was made by Poccil, but isn't in Essentials yet. To use it, use
Code:
Script: setMapView(X)
Again, copy this into PokemonUtilities.
Code:
def setMapView(mapView)
$PokemonSystem.tilemap=mapView
ObjectSpace.each_object(TilemapLoader){|o|
next if o.disposed?
case mapView
when 0 # Default
o.setClass($ResizeFactor==1.0 ? Tilemap : CustomTilemap)
when 1 # Custom
o.setClass(CustomTilemap)
when 2 # Perspective
o.setClass(Draw_Tilemap)
end
}
end
That's all the scripts for now. If you get a problem with one of these, tell me and I'll try to fix it. I'm also open to ideas for new add-ons - the night BGM one was a request.
BTW, think of these as teasers for the game I'm making :P.
Last edited: