https://img188.imageshack.us/img188/4366/ruletheworldfail1x.png
Thanks again! I tried it and it worked.
Now i have another problem , im trying to make so that the player cant get out of the city without a pokemon but either the player cant go through even do he has a pokemon , or he can go through without one.
Here is some screenshots of the events i have:
https://img188.imageshack.us/img188/4366/ruletheworldfail1x.png
https://img215.imageshack.us/img215/43/ruletheworldfail2w.png
You can use a script-based switch. If you name a switch 's:$Trainer.party.size>0', then the switch will automatically turn on when you have a Pokémon in your party, and off if you don't.
Greetings.
I have two questions about the pokemon essentials kit. I'm doing a small project... just something to get some experience on, before perhaps applying myself to one of the budding projects around here and using said project as proof of experience. However.. I've run into a rut. In fact, two ruts. Minor ones though, I hope.
My first question is- how does one customise the BGM for a wild pokémon battle? I've got the default music changed, but I'd like the special music to play for specific battles. Legendary Pokémon battles, for example. I know how to activate them and such, I just don't know how to implement to the music.
My second question is another battle mechanic, that unfortunately spreads across the board. Battlebacks. I read up on the notes and such- as you should, but the script for me at least was working; yet not. You see, the code didn't make things permanent- sure, the next battle would have the said backing, but after that it would revert straight back to the boring old default. And when I set the script up as an invisible auto-running event, when it entered another area with a different battleback script event through a door, the game would freeze up and cease to play. Naturally, this wasn't what I was going for.
Any help would be much appreciated, as this really is irking me a bit.
1. Edit the pbGetWildBattleBGM method in PokemonUtilities. For example:
Code:
def pbGetWildBattleBGM(species)
if $PokemonGlobal.nextBattleBGM
return $PokemonGlobal.nextBattleBGM.clone
end
wildbgm=pbGetMetadata(0,MetadataWildBattleBGM)
if wildbgm
wildbgm="#{wildbgm}"
else
wildbgm="002-Battle02.mid"
end[B]
case species
when PBSpecies::REGICE, PBSpecies::REGIROCK, PBSpecies::REGISTEEL
wildbgm="RegiBattle.mid"
when PBSpecies::GROUDON, PBSpecies::KYOGRE, PBSpecies::RAYQUAZA
wildbgm="TrioBattle.mid"
when PBSpecies::DEOXYS
wildbgm="DeoxysBattle.mid"
end[/B]
return pbStringToAudioFile(wildbgm)
end
2. You can edit the pbBackdrop method in PokeBattle_ActualScene to use a different background depending on a variable. For example:
Code:
def pbBackdrop
outdoor=false
if $game_map && pbGetMetadata($game_map.map_id,MetadataOutdoor)
outdoor=true
end
case @battle.environment
when PBEnvironment::Grass
id=1
when PBEnvironment::TallGrass
id=2
when PBEnvironment::MovingWater
id=3
when PBEnvironment::StillWater
id=4
when PBEnvironment::Underwater
id=5
when PBEnvironment::Rock
id=7
when PBEnvironment::Cave
id=8
when PBEnvironment::Sand
id=9
else
id=(outdoor) ? 0 : 6
end[B]
if $game_variables[26]>0
id=$game_variables[26]
end[/B]
if $PokemonGlobal.nextBattleBack
id=$PokemonGlobal.nextBattleBack
end
battlebg="Graphics/Pictures/battlebg#{id}.png"
enemybase="Graphics/Pictures/enemybase#{id}.png"
playerbase="Graphics/Pictures/playerbase#{id}.png"
if true # !$game_temp.background_bitmap.respond_to?("radial_blur")
pbAddPlane("battlebg",battlebg,@viewport)
else
source = $game_temp.background_bitmap
bitmap = Bitmap.new(Graphics.width+32,Graphics.height)
bitmap.stretch_blt(bitmap.rect, source, source.rect)
bitmap.radial_blur(90, 12)
@sprites["battlebg"] = Sprite.new(@viewport)
@sprites["battlebg"].bitmap = bitmap
@sprites["battlebg"].x = -16
@sprites["battlebg"].y = 0
@sprites["battlebg"].wave_amp = 8
@sprites["battlebg"].wave_length = 240
@sprites["battlebg"].wave_speed = 120
end
pbAddSprite("enemybase",-256,96+@yoffset,enemybase,@viewport) # ends at (224,96)
pbAddSprite("playerbase",Graphics.width,192+@yoffset,playerbase,@viewport) # ends at (0,192)
@sprites["enemybase"].z=-1 # For compatibility with RGSS2
@sprites["playerbase"].z=-1 # For compatibility with RGSS2
@sprites["battlebg"].z=-1 # For compatibility with RGSS2
=begin
if outdoor
tone = $HourlyTones[Time.now.hour]
@sprites["battlebg"].tone=tone
@sprites["enemybase"].tone=tone
@sprites["playerbase"].tone=tone
end
=end
end
That change will make the background ID equal to that of variable 26 if it is greater than 0. So if you named an image "battlebg10.png", you'd use it by changing variable 26 to 10. To go back to normal, change it to 0.
*sigh* this thread is annoying when asking a question and it doesn't get answered right away. Anyway, still need help with my whirlpool script (edit of PokemonField)
This was in reply to Wichu btw
I can't really see any problems with that... Could I see the event as well?
It would be great to get help with this one. I want to make that shiny pokémon have a different second type from their normal one, let's say I want it to be fire. A Shiny Gyarados instead of being Water/Flying, it would be Water/Fire you see... I tried a few times but had no success, so I hope you help me out xD.
The simplest way would be to assign an array of all the new types to a constant. For example, you could add this to a new script section:
Code:
SHINYTYPES=[]
SHINYTYPES[PBSpecies::GYARADOS]=[PBTypes::WATER,PBTypes::FIRE]
If you're going to change every Pokémon's type, it might be easier to do this instead:
Code:
SHINYTYPES=[
[PBTypes::GRASS],
[PBTypes::GRASS],
[PBTypes::GRASS],
[PBTypes::FIRE,PBTypes::ELECTRIC],
... # insert nearly 500 lines here
[PBTypes::PSYCHIC]
]
Then, edit the type1 and type2 methods in PokeBattle_Pokemon to this:
Code:
def type1
if isShiny?
if SHINYTYPES[@species]
return SHINYTYPES[@species][0]
end
end
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@species,8)
ret=dexdata.fgetb
dexdata.close
return ret
end
def type2
if isShiny?
if SHINYTYPES[@species]
if SHINYTYPES[@species][1]
return SHINYTYPES[@species][1]
else
return SHINYTYPES[@species][0]
end
end
end
dexdata=pbOpenDexData
pbDexDataOffset(dexdata,@species,9)
ret=dexdata.fgetb
dexdata.close
return ret
end
A bit complicated, but it should do the trick.
fff got logged out before I could post this and now I need to start over D:
Hello. I'm new to RGSS scripting and working with Essentials and I have two questions for you all.
First of all, as part of my efforts to teach myself RGSS and Essentials and all that (that and it's an excuse to mess around with my fakemon without having to slog through making an entire game), I'd like to make a small game that only includes a Battle Factory, like the ones in Emerald and Platinum. How difficult would it be to implement something like that? I'd imagine that several scripts, as well as btpokemon.txt and bttrainers.txt, could be borrowed from the Battle Tower and Battle Palace that are already included in Essentials, but then I'd need to figure out how to give the player a choice of three out of six of the btpokemon.txt Pokémon, how to implement the swapping system, etc.. I'm not concerned with the really advanced stuff like the IVs increasing when the player has more consecutive wins (unless the Tower and Palace scripts can already handle that...?); I can work that out later, if I bother with it at all. But as far as the swapping, the randomization and all of that... how far is that from the current capabilities of Essentials, and how difficult do you think it would be to implement such a system?
Someone else asked a similar question maybe 50 pages back but was never answered; he hasn't asked again recently, though. If you've stopped asking because you figured out how to do it yourself, would you mind pointing me in the right direction?
Second, how does one go about editing or adding abilities? I know that it's not as straightforward as adding/editing moves or Pokémon and that it involves working with the battle scripts, among other things, but I've done some searching and so far I haven't been able to find anything that looks relevant. :( This one's not as terribly important because I don't need it anytime soon and the mini-project can get along fine without edited abilities, but this has been bothering me for a while and I'd really like to know what to do to start figuring it out.
Please note that I'm not asking for any free script handouts or for anyone to teach me how to do this; I fully intend to teach myself how to script and will implement all of this myself. I'd just like to know where to look to start modifying these sorts of things and approximately how difficult it would be to do them: are they things that could be handled by a relative novice or would they require incredibly complex scripts and weeks, months or more of practice? As soon as I know all that I'll get to work on learning the basics, and then whenever I'm good enough I'll try adding these on my own. :)
Thanks in advance for any insight you can provide, and thanks to poccil for providing such an excellent starter kit.
A Battle Factory would be pretty hard to make. I can give you some information on how the Pokémon and trainer data is stored, though.
The Pokémon data is stored in btpokemon.dat, and the trainer data in bttrainers.dat. In a script, you'd extract the data like this:
Code:
bttrainers=load_data("Data/bttrainers.dat") #loads trainer data
trainerdata=bttrainers[trainerid] #trainers are stored in an array
trainer=PokeBattle_Trainer.new(trainerdata[1],trainerdata[0]) #each trainer is an array too; you have to create a PokeBattle_Trainer object using the data in the array
btpokemon=load_data("Data/btpokemon.dat") #loads Pokémon data
pokemon=btpokemon[pokemonid].createPokemon(level,iv,trainer) #each Pokémon is stored as a PBPokemon object. The createPokemon method converts it to a PokeBattle_Pokemon
To select six random Pokémon, you could do something like this:
Code:
def randomPokemon
btpokemon=load_data("Data/btpokemon.dat")
numpokes=btpokemon.size
selectedids=[]
selectedpokes=[]
while selectedids.size<6
id=rand(numpokes)
if !selectedids.include?(id)
selectedids.push(id)
end
end
for i in 0...6
pokemon=btpokemon[selectedids[i]].createPokemon(50,31,$Trainer)
end
return selectedpokes
end
You'd have to write a script to allow the player to select three of those, then assign the player's old party to a variable, and assign the selected Pokémon to $Trainer.party.
As I said, it's pretty challenging :)
Abilities are a bit easier. To add an ability, add a new entry to PBS/Abilities.txt. However, the new ability won't do anything. To give it an effect, search the PokeBattle scripts for 'PBAbilities::ABILITYNAME', replacing ABILITYNAME with a similar ability. For example, say I wanted to make an ability which increased the power of all Psychic-type moves in a pinch. I'd search for PBAbilities::BLAZE (seeing as it's basically a variation of the same thing). This gets me this line:
Code:
basedmg=modbasedmg if attacker.ability==PBAbilities::BLAZE&&type==PBTypes::FIRE
So to add your new ability, you'd copy that line, and change it a bit, like this:
Code:
basedmg=modbasedmg if attacker.ability==PBAbilities::BLAZE&&type==PBTypes::FIRE
basedmg=modbasedmg if attacker.ability==PBAbilities::PSYCHO&&type==PBTypes::PSYCHIC
Obviously, for more complex abilities, it will be harder; the basics are the same, though.