Variable-Based Battle Victory MEs
#1
Variable-Based Victory MEs
Version: 1

Introduction
This script allows developers to set victory MEs depending on the value of a game variable. Useful if you want your project's victory ME changed when the player has progressed pretty far in the game.

Features
  • Set variable ID and control victory MEs through the variable's value.

Screenshots
No screencaps.

Demo
No demo.

Script
Code:
=begin
????????????????????????????????????????????????????????????????????????????????
? Variable-Based Battle Victory MEs                                            ?
? by PK8                                                                       ?
? September 29th, 2009                                                         ?
? http://rmvxp.com                                                             ?
????????????????????????????????????????????????????????????????????????????????
? ? Table of Contents                                                          ?
? ?? Author's Notes                - Line 16?18                                ?
? ?? Introduction & Description    - Line 20?23                                ?
? ?? Features                      - Line 25,26                                ?
? ?? How to Use                    - Line 28?35                                ?
? ?? Methods Aliased               - Line 37,38                                ?
? ?? Thanks                        - Line 40?42                                ?
????????????????????????????????????????????????????????????????????????????????
? ? Author's Notes                                                             ?
? After working on Individual Troop Victory MEs, I wanted to work on this      ?
? script. I was pretty bored so yeah.                                          ?
????????????????????????????????????????????????????????????????????????????????
? ? Introduction & Description                                                 ?
? This script allows developers to set victory MEs depending on the value of a ?
? game variable. Useful if you want your project's victory ME changed when the ?
? player has progressed pretty far in the game.                                ?
????????????????????????????????????????????????????????????????????????????????
? ? Features                                                                   ?
? ? Set variable ID and control victory MEs through the variable's value.      ?
????????????????????????????????????????????????????????????????????????????????
? ? How to Use                                                                 ?
? Varba_Victory_Var: Set game variable ID.                                     ?
?                                                                              ?
? Varba_Victory[variable id value] = ["file", volume, pitch]                   ?
? ^ Sets victory ME based on the value of the variable ID.                     ?
?                                                                              ?
? Note: If you're using Individual Troop Victory MEs, please paste this script ?
?       above it. It's so Individual Troop Victory MEs can override this script?
????????????????????????????????????????????????????????????????????????????????
? ? Methods Aliased                                                            ?
? ? start_phase5 of Scene_Battle                                               ?
????????????????????????????????????????????????????????????????????????????????
? ? Thanks                                                                     ?
? ? If it weren't for JoeYoung's original request, I wouldn't have worked on   ?
?   this script.                                                               ?
????????????????????????????????????????????????????????????????????????????????
=end

#------------------------------------------------------------------------------
# * Customise
#------------------------------------------------------------------------------
class PK8
  Varba_Victory = {} # Do not touch this.
  
  Varba_Victory_Var = 2 # Set variable ID.
  
  # The value of PK8::Varba_Victory_Var controls the battle theme.
  #          [id] = [Music File, Volume, Pitch]
  Varba_Victory[1] = ["002-Victory02", 100, 100]
  Varba_Victory[2] = ["003-Victory03", 100, 100]
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#  This class performs battle screen processing.
#==============================================================================
class Scene_Battle
  alias_method(:pk8_var_battle_victoryme_start_phase_5, :start_phase5)
  def start_phase5
    pk8_var_battle_victoryme_start_phase_5
    start_var_battle_victoryme
  end
  
  #----------------------------------------------------------------------------
  # * Start Troop Victory
  #----------------------------------------------------------------------------
  def start_var_battle_victoryme
    PK8::Varba_Victory.each_key { | i |
    # If Variable ID value equals the key.
    if $game_variables[PK8::Varba_Victory_Var] == i
      if PK8::Varba_Victory[i][0] != nil and !PK8::Varba_Victory[i][0].empty?
        # Sets ME volume to 100 if nil.
        PK8::Varba_Victory[i][1] = 100 if PK8::Varba_Victory[i][1] == nil
        # Sets ME pitch to 100 if nil.
        PK8::Varba_Victory[i][2] = 100 if PK8::Varba_Victory[i][2] == nil
        # Plays ME.
        Audio.me_play("Audio/ME/#{PK8::Varba_Victory[i][0]}",
        PK8::Varba_Victory[i][1], PK8::Varba_Victory[i][2])
      end
      break
    end }
  end
end

Instructions
Instructions are in the script.

FAQ
Awaiting question.

Compatibility
Aliases start_phase5 of Scene_Battle.

Credits and Thanks
If it weren't for JoeYoung's original request, I wouldn't have made this script.

Author's Notes
After working on Individual Troop Victory MEs, I wanted to work on this script. I was pretty bored so yeah.

Terms and Conditions
Credit me. :3
Reply }
#2
I can't really figure out the use of this script, given that there's a command to change the battle end ME...
Reply }
#3
I'm pretty bad at explaining this (and I'm getting super sleepy).

So... you set the variable ID.
Varba_Victory_Var = 2 <- Variable ID.

And you need to set which music effects would turn on depending on the value of the above variable.
Varba_Victory[1] = ["002-Victory02", 100, 100]

If Variable 2's value was equal to 1, it would play "002-Victory02" as the victory theme.

And I just wanted to go streamline things.
Reply }
#4
Ok, I mean, what's the difference with just using the "Change Battle End ME" command?
Reply }
#5
Well, this (and Punk's variable based battle theme) could be good because lets say you have a player that you want to be level 20 before the victory and battle theme to change. You could set it in here so that you don't have to use a common event to do it.

I hope this is what Punk was thinking (that's what I would use it as)
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   VARIABLE ENEMY HP & SP DerVVulfman 0 837 06-14-2024, 07:18 PM
Last Post: DerVVulfman
   Battle Item Count kyonides 4 2,176 02-04-2024, 05:49 AM
Last Post: kyonides
   Name Game Switch & Variable XP kyonides 0 1,094 06-27-2023, 09:17 PM
Last Post: kyonides
   Dalissa's Battle Cry DerVVulfman 2 7,441 05-09-2023, 03:07 AM
Last Post: DerVVulfman
   Zenith Tactical Battle System Plus (ZTBS+) DerVVulfman 0 2,853 05-10-2022, 10:42 PM
Last Post: DerVVulfman
   Actor Battle Items DerVVulfman 4 6,112 11-08-2020, 12:36 PM
Last Post: Mel
   Variable Extraction Generator DerVVulfman 0 3,130 07-20-2020, 06:58 PM
Last Post: DerVVulfman
   Battle Report Raziel 1 6,989 05-29-2020, 02:27 AM
Last Post: Whisper
   ZLSL's Battle Portraits DerVVulfman 4 7,533 11-12-2019, 04:10 AM
Last Post: DerVVulfman
   ACBS FIX SCRIPT #1: Victory Cries Patch DerVVulfman 1 4,712 08-08-2019, 02:53 PM
Last Post: aeliath



Users browsing this thread: 1 Guest(s)