- 2
- Posts
- 6
- Years
- Seen May 6, 2019
Ok, before clarifying that I do not speak English, I communicate with a translator so I would thank those who help me write their answers with complete words so the translator understands them.
What I want to do? Well, each Pokémon has a CRY (battle cry) that uses it when it enters the battlefield and also when it dies. The CRY is in the folder AUDIO / SE / Cries, I understand that, but what I want to do is that when the pokemon appears, use the pre-determined CRY, BUT when it dies use a different CRY, that I will put it in, but I do not know how to do it.
Here I leave the scripts I found about the battle CRY.
PSystem_Utilities:
def pbResolveAudioSE (file)
return nil if! file
if RTP.exists? ("Audio / SE /" + file, ["", ". mp3", ". wav"])
return RTP.getPath ("Audio / SE /" + file, ["", ". wav", ". mp3"])
end
return nil
end
def pbCryFrameLength (pokemon, pitch = nil)
return 0 if! pokemon
pitch = 100 if! pitch
pitch = pitch.to_f / 100
return 0 if pitch <= 0
playtime = 0.0
if pokemon.is_a? (Numeric)
pkmnwav = pbResolveAudioSE (pbCryFile (pokemon))
playtime = getPlayTime (pkmnwav) if pkmnwav
elsif! pokemon.isEgg?
if pokemon.respond_to? ("chatter") && pokemon.chatter
playtime = pokemon.chatter.time
pitch = 1.0
else
pkmnwav = pbResolveAudioSE (pbCryFile (pokemon))
playtime = getPlayTime (pkmnwav) if pkmnwav
end
end
playtime / = pitch # sound is lengthened the lower pitch
# 4 is added to provide a buffer between sounds
return (playtime * Graphics.frame_rate) .ceil + 4
end
def pbPlayCry (pokemon, volume = 90, pitch = nil)
return if! pokemon
if pokemon.is_a? (Numeric)
pkmnwav = pbCryFile (pokemon)
if pkmnwav
pbSEPlay (RPG :: AudioFile.new (pkmnwav, volume, pitch? pitch: 100)) rescue nil
end
elsif! pokemon.isEgg?
if pokemon.respond_to? ("chatter") && pokemon.chatter
pokemon.chatter.play
else
pkmnwav = pbCryFile (pokemon)
if pkmnwav
pbSEPlay (RPG :: AudioFile.new (pkmnwav, volume,
pitch? pitch: (pokemon.hp * 0 / pokemon.totalhp) +100)) rescue nil
end
end
end
end
def pbCryFile (pokemon)
return nil if! pokemon
if pokemon.is_a? (Numeric)
filename = sprintf ("Cries /% sCry", getConstantName (PBSpecies, pokemon)) rescue nil
filename = sprintf ("Cries /% 03dCry", pokemon) if! pbResolveAudioSE (filename)
return filename if pbResolveAudioSE (filename)
elsif! pokemon.isEgg?
filename = sprintf ("Cries /% sCry_% d", getConstantName (PBSpecies, pokemon.species), (pokemon.form rescue 0)) rescue nil
filename = sprintf ("Cries /% 03dCry_% d", pokemon.species, (pokemon.form rescue 0)) if! pbResolveAudioSE (filename)
if! pbResolveAudioSE (filename)
filename = sprintf ("Cries /% sCry", getConstantName (PBSpecies, pokemon.species)) rescue nil
end
filename = sprintf ("Cries /% 03dCry", pokemon.species) if! pbResolveAudioSE (filename)
return filename if pbResolveAudioSE (filename)
end
And also thanks to ALDO who provided me with the following information:
For that effect, you'll have to fiddle with scripts. There's one called PokeBattle_Scene, which has the lines that take care of cries. From lines 877 to 880 are the cries from Pokémon sent by an enemy trainer, 1000 to 1003 for a cry of the player's Pokémon. 2049 is for the cry of a wild Pokémon and 2738 to 2745 is the cry for a Pokémon fainting. Not sure what exactly it is that you want, so those lines are probably the first place to look for.
That's it, I hope you can help me shortly. Thanks already
What I want to do? Well, each Pokémon has a CRY (battle cry) that uses it when it enters the battlefield and also when it dies. The CRY is in the folder AUDIO / SE / Cries, I understand that, but what I want to do is that when the pokemon appears, use the pre-determined CRY, BUT when it dies use a different CRY, that I will put it in, but I do not know how to do it.
Here I leave the scripts I found about the battle CRY.
PSystem_Utilities:
def pbResolveAudioSE (file)
return nil if! file
if RTP.exists? ("Audio / SE /" + file, ["", ". mp3", ". wav"])
return RTP.getPath ("Audio / SE /" + file, ["", ". wav", ". mp3"])
end
return nil
end
def pbCryFrameLength (pokemon, pitch = nil)
return 0 if! pokemon
pitch = 100 if! pitch
pitch = pitch.to_f / 100
return 0 if pitch <= 0
playtime = 0.0
if pokemon.is_a? (Numeric)
pkmnwav = pbResolveAudioSE (pbCryFile (pokemon))
playtime = getPlayTime (pkmnwav) if pkmnwav
elsif! pokemon.isEgg?
if pokemon.respond_to? ("chatter") && pokemon.chatter
playtime = pokemon.chatter.time
pitch = 1.0
else
pkmnwav = pbResolveAudioSE (pbCryFile (pokemon))
playtime = getPlayTime (pkmnwav) if pkmnwav
end
end
playtime / = pitch # sound is lengthened the lower pitch
# 4 is added to provide a buffer between sounds
return (playtime * Graphics.frame_rate) .ceil + 4
end
def pbPlayCry (pokemon, volume = 90, pitch = nil)
return if! pokemon
if pokemon.is_a? (Numeric)
pkmnwav = pbCryFile (pokemon)
if pkmnwav
pbSEPlay (RPG :: AudioFile.new (pkmnwav, volume, pitch? pitch: 100)) rescue nil
end
elsif! pokemon.isEgg?
if pokemon.respond_to? ("chatter") && pokemon.chatter
pokemon.chatter.play
else
pkmnwav = pbCryFile (pokemon)
if pkmnwav
pbSEPlay (RPG :: AudioFile.new (pkmnwav, volume,
pitch? pitch: (pokemon.hp * 0 / pokemon.totalhp) +100)) rescue nil
end
end
end
end
def pbCryFile (pokemon)
return nil if! pokemon
if pokemon.is_a? (Numeric)
filename = sprintf ("Cries /% sCry", getConstantName (PBSpecies, pokemon)) rescue nil
filename = sprintf ("Cries /% 03dCry", pokemon) if! pbResolveAudioSE (filename)
return filename if pbResolveAudioSE (filename)
elsif! pokemon.isEgg?
filename = sprintf ("Cries /% sCry_% d", getConstantName (PBSpecies, pokemon.species), (pokemon.form rescue 0)) rescue nil
filename = sprintf ("Cries /% 03dCry_% d", pokemon.species, (pokemon.form rescue 0)) if! pbResolveAudioSE (filename)
if! pbResolveAudioSE (filename)
filename = sprintf ("Cries /% sCry", getConstantName (PBSpecies, pokemon.species)) rescue nil
end
filename = sprintf ("Cries /% 03dCry", pokemon.species) if! pbResolveAudioSE (filename)
return filename if pbResolveAudioSE (filename)
end
And also thanks to ALDO who provided me with the following information:
For that effect, you'll have to fiddle with scripts. There's one called PokeBattle_Scene, which has the lines that take care of cries. From lines 877 to 880 are the cries from Pokémon sent by an enemy trainer, 1000 to 1003 for a cry of the player's Pokémon. 2049 is for the cry of a wild Pokémon and 2738 to 2745 is the cry for a Pokémon fainting. Not sure what exactly it is that you want, so those lines are probably the first place to look for.
That's it, I hope you can help me shortly. Thanks already