Advertisement
FiaPlay

Low HP BGM

Feb 1st, 2024 (edited)
1,147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.69 KB | None | 0 0
  1. # Script creado por FiaPlay para Pokémon Essentials 16.3. Créditos si se usa.
  2. #Para usar, simplemente pega todo esto en un nuevo script encima de Main y activa el interruptor SWITCH_PINCH.
  3. #Añade las claves Pinch(Start) y Pinch(End) para mi sistema MBD.
  4.  
  5. PINCH_MUSIC="Boss Battle 2" #BGM de bajos PS
  6. SWITCH_PINCH=30 #Interruptor que activa el sistema
  7.  
  8. PINCH_TRAINERS={PBTrainers::LEADER_Brock=>"Boss04",
  9.                 PBTrainers::LEADER_Misty=>"Boss02"}
  10.  
  11. class PokeBattle_Battler
  12.  
  13.   alias  pbInitPokemon_fp pbInitPokemon
  14.   def pbInitPokemon(*args)
  15.     pbInitPokemon_fp(*args)
  16.     play_Pinch_BGM()
  17.   end
  18.  
  19.   alias  pbReduceHP_fp pbReduceHP
  20.   def pbReduceHP(*args)
  21.     pbReduceHP_fp(*args)
  22.     play_Pinch_BGM()
  23.   end
  24.  
  25.   alias  pbRecoverHP_fp pbRecoverHP
  26.   def pbRecoverHP(*args)
  27.     pbRecoverHP_fp(*args)
  28.     play_Pinch_BGM()
  29.   end
  30.  
  31.   def get_Pinch_BGM(trainer)
  32.     if trainer && PINCH_TRAINERS.include?(trainer.trainertype)
  33.       return PINCH_TRAINERS[trainer.trainertype]
  34.     else
  35.       return PINCH_MUSIC
  36.     end
  37.   end
  38.  
  39.   def play_Pinch_BGM()
  40.     return unless $game_switches[SWITCH_PINCH]
  41.     if 25>(100*@hp/@totalhp)&& (100*@hp/@totalhp)!=0 &&@battle.pbBelongsToPlayer?(@index)
  42.       pbBGMPlay(get_Pinch_BGM(@battle.opponent),80,100)
  43.       @battle.fpShowText("Pinch(Start)") if PokeBattle_Battle.method_defined?(:fpShowText)
  44.     elsif (100*@hp/@totalhp)>25 && @battle.pbBelongsToPlayer?(@index)
  45.       if @battle.opponent
  46.         pbBGMPlay(pbGetTrainerBattleBGM(@battle.opponent),80,100)
  47.       else
  48.         pbBGMPlay(pbGetWildBattleBGM(pbOpposing1),80,100)
  49.       end
  50.       @battle.fpShowText("Pinch(End)") if PokeBattle_Battle.method_defined?(:fpShowText)
  51.     end
  52.   end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement