Individual Troop Victory MEs

Individual Troop Victory MEs
Version: 1


Introduction
This script allows game makers to give a specific Troop ID their own victory MEs when your party defeats them. Useful for Boss battles and other stuff.

Features
  • Give a specific troop ID a unique victory music effect when defeated.
  • Set the song, volume and pitch.

Screenshots
No screencaps.

Demo
No demo.

Script
  1. =begin
  2. ╔══════════════════════════════════════════════════════════════════════════════╗
  3. ║ Individual Troop Victory MEs                                                 ║
  4. ║ by PK8                                                                       ║
  5. ║ September 29th, 2009                                                         ║
  6. ║ http://rmvxp.com                                                             ║
  7. ╟──────────────────────────────────────────────────────────────────────────────╢
  8. ║ ■ Table of Contents                                                          ║
  9. ║ ├─ Author's Notes                - Line 16─18                                ║
  10. ║ ├─ Introduction & Description    - Line 20─22                                ║
  11. ║ ├─ Features                      - Line 24─26                                ║
  12. ║ ├─ How to Use                    - Line 28─30                                ║
  13. ║ ├─ Methods Aliased               - Line 32,33                                ║
  14. ║ └─ Thanks                        - Line 35,36                                ║
  15. ╟──────────────────────────────────────────────────────────────────────────────╢
  16. ║ ■ Author's Notes                                                             ║
  17. ║ This script was requested by a user in HBGames.org's IRC channel and I was   ║
  18. ║ interested in creating this script so... here you go!                        ║
  19. ╟──────────────────────────────────────────────────────────────────────────────╢
  20. ║ ■ Introduction & Description                                                 ║
  21. ║ This script allows game makers to give a specific Troop ID their own victory ║
  22. ║ MEs when your party defeats them. Useful for Boss battles and other stuff.   ║
  23. ╟──────────────────────────────────────────────────────────────────────────────╢
  24. ║ ■ Features                                                                   ║
  25. ║ ─ Give a specific troop ID a unique victory music effect when defeated.      ║
  26. ║ ─ Set the song, volume and pitch.                                            ║
  27. ╟──────────────────────────────────────────────────────────────────────────────╢
  28. ║ ■ How to Use                                                                 ║
  29. ║ To give a troop ID their own victory ME, simply type this:                   ║
  30. ║ Troops_Victory[id] = ["file", volume, pitch]                                 ║
  31. ╟──────────────────────────────────────────────────────────────────────────────╢
  32. ║ ■ Methods Aliased                                                            ║
  33. ║ ─ start_phase5 of Scene_Battle                                               ║
  34. ╟──────────────────────────────────────────────────────────────────────────────╢
  35. ║ ■ Thanks                                                                     ║
  36. ║ ─ JoeYoung requested something like this in the HBGames.org's IRC channel.   ║
  37. ╚══════════════════════════════════════════════════════════════════════════════╝
  38. =end
  39.  
  40. #------------------------------------------------------------------------------
  41. # * Customise
  42. #------------------------------------------------------------------------------
  43. class PK8
  44.   Troops_Victory = {} # Do not touch this.
  45.  
  46.   #            [id] = [ME File, Volume, Pitch]
  47.   Troops_Victory[1] = ["002-Victory02", 100, 100]
  48.   Troops_Victory[2] = ["003-Victory03", 100, 100]
  49. end
  50.  
  51. #==============================================================================
  52. # ** Scene_Battle
  53. #------------------------------------------------------------------------------
  54. #  This class performs battle screen processing.
  55. #==============================================================================
  56. class Scene_Battle
  57.   alias_method(:pk8_troops_victoryme_start_phase_5, :start_phase5)
  58.   def start_phase5
  59.     pk8_troops_victoryme_start_phase_5
  60.     start_troop_victory
  61.   end
  62.  
  63.   #----------------------------------------------------------------------------
  64.   # * Start Troop Victory
  65.   #----------------------------------------------------------------------------
  66.   def start_troop_victory
  67.     PK8::Troops_Victory.each_key { | i |
  68.     # If Troop ID equals the key.
  69.     if $game_temp.battle_troop_id == i
  70.       if PK8::Troops_Victory[i][0] != nil and !PK8::Troops_Victory[i][0].empty?
  71.         # Sets ME volume to 100 if nil.
  72.         PK8::Troops_Victory[i][1] = 100 if PK8::Troops_Victory[i][1] == nil
  73.         # Sets ME pitch to 100 if nil.
  74.         PK8::Troops_Victory[i][2] = 100 if PK8::Troops_Victory[i][2] == nil
  75.         # Plays ME.
  76.         Audio.me_play("Audio/ME/#{PK8::Troops_Victory[i][0]}",
  77.         PK8::Troops_Victory[i][1], PK8::Troops_Victory[i][2])
  78.       end
  79.       break
  80.     end }
  81.   end
  82. end
Expand to see the code.


Instructions
Instructions are in the script.

FAQ
Awaiting question.

Compatibility
This aliases start_phase5 of Scene_Battle.

Credits and Thanks
JoeYoung for requesting a script like this in HBGames.org's IRC channel.

Author's Notes
This script was requested by a user in HBGames.org's IRC channel and I was interested in creating this script so... here you go!

Terms and Conditions
Exclusive to RMVXP.com and HBGames.org.
Man, this is something I'd been after a while when I was still into RMXP :/ why do you release the good scripts now! Haha. Nice work anyway, looks good to me (and works).

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=68372