Advertisement
Adon237

YEM: Party Influenced Music Ported to Ace by Adon237

Aug 12th, 2012
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.52 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Yanfly Engine Melody - Party Influenced Music
  4. # Last Date Updated: 2010.06.24
  5. # Level: Normal
  6. # Ported to Ace by Adon237
  7. # No matter how good an RPG's battle music is, players are going to get sick and
  8. # tired of listening to it for the zillionth time. This script won't rid RPG's
  9. # of that problem, but will hopefully stall the process by playing randomized
  10. # music dependent on who the player has in the active party at the start of any
  11. # normal battle.
  12. #
  13. #===============================================================================
  14. # Updates
  15. # -----------------------------------------------------------------------------
  16. # o 2010.06.24 - Started Script and Finished.
  17. #===============================================================================
  18. # Instructions
  19. # -----------------------------------------------------------------------------
  20. # To install this script, open up your script editor and copy/paste this script
  21. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  22. #
  23. # To use this script, modify the module down below to create the arrays of
  24. # music themes used by each actor. Depending on who is present in the battle,
  25. # a random piece of music will play gathered from the music pool.
  26. #
  27. # To force a theme to play, just set the battle theme to something else other
  28. # than the default battle theme. It will always choose the selected theme over
  29. # the random themes. Once the battle theme is changed back to the default battle
  30. # theme, then random battle themes will trigger once again.
  31. #
  32. #===============================================================================
  33.  
  34. $imported = {} if $imported == nil
  35. $imported["PartyInfluencedMusic"] = true
  36.  
  37. module YEM
  38.   module BATTLE_THEMES
  39.    
  40.     # This hash adjusts the random battle themes that may be played depending
  41.     # on whether or not the party member is present in the battle when the music
  42.     # loads up. Each array contains possible themes that may play for battle.
  43.     # Actor 0 is the common pool. Inside of that array contains all of the
  44.     # battle themes that can bebe played regardless of who's in the party.
  45.     ACTOR_MUSIC ={ # ActorID 0 must exist.
  46.     # ActorID => [BGM, BGM, BGM]
  47.        0 => [RPG::BGM.new("Battle1", 100, 100)
  48.              ], # End Common
  49.        1 => [RPG::BGM.new("Battle2", 100, 100)
  50.              ], # End Actor1
  51.        2 => [RPG::BGM.new("Town3", 100, 100)
  52.              ], # End Actor2
  53.        3 => [RPG::BGM.new("Dungeon4", 100, 100)
  54.              ], # End Actor3
  55.     } # Do not remove this.
  56.    
  57.   end # BATTLE_THEMES
  58. end # YEM
  59.  
  60. #===============================================================================
  61. # Editting anything past this point may potentially result in causing computer
  62. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  63. # Therefore, edit at your own risk.
  64. #===============================================================================
  65.  
  66. #===============================================================================
  67. # Game_System
  68. #===============================================================================
  69.  
  70. class Game_System
  71.  
  72.   #--------------------------------------------------------------------------
  73.   # overwrite method: battle_bgm
  74.   #--------------------------------------------------------------------------
  75.   def battle_bgm
  76.     return @battle_bgm if @battle_bgm != nil
  77.     former_in_battle = $game_party.in_battle
  78.     $game_party.in_battle == true
  79.     music_list = YEM::BATTLE_THEMES::ACTOR_MUSIC[0]
  80.     for member in $game_party.battle_members
  81.       next unless YEM::BATTLE_THEMES::ACTOR_MUSIC.include?(member.id)
  82.       result = YEM::BATTLE_THEMES::ACTOR_MUSIC[member.id]
  83.       if result.is_a?(Array)
  84.         music_list |= result
  85.       elsif result.is_a?(RPG::BGM)
  86.         music_list.push(result)
  87.       end
  88.     end
  89.     $game_party.in_battle == former_in_battle
  90.     return music_list[rand(music_list.size)]
  91.   end
  92.  
  93.   #--------------------------------------------------------------------------
  94.   # overwrite method: battle_bgm=
  95.   #--------------------------------------------------------------------------
  96.   def battle_bgm=(battle_bgm)
  97.     @battle_bgm = battle_bgm
  98.     @battle_bgm = nil if @battle_bgm == $data_system.battle_bgm
  99.   end
  100.  
  101. end # Game_System
  102.  
  103. #===============================================================================
  104. #
  105. # END OF FILE
  106. #
  107. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement