Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # Battle Self Switches
- # Version: 1.00
- # Author : LiTTleDRAgo
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- #
- # This script will make you able to use Self Switches in battles
- #
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- module LiTTleDRAgo
- SwitchKey = 'BattleSelfSwitch'
- ClearwhenFinish = false
- # If true, the self switch will reset on battle starts
- end
- #==============================================================================
- # ** Interpreter
- #------------------------------------------------------------------------------
- # This interpreter runs event commands. This class is used within the
- # Game_System class and the Game_Event class.
- #==============================================================================
- VX = defined?(Window_ActorCommand)
- eval "
- class #{VX ? 'Game_' : ''}Interpreter
- #--------------------------------------------------------------------------
- # * Constant Variables
- #--------------------------------------------------------------------------
- SwitchKey = LiTTleDRAgo::SwitchKey
- ClearwhenFinish = LiTTleDRAgo::ClearwhenFinish
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias drg129_cmd111 command_111 unless method_defined?(:drg129_cmd111)
- alias drg129_cmd123 command_123 unless method_defined?(:drg129_cmd123)
- #--------------------------------------------------------------------------
- # * Control Self Switch
- #--------------------------------------------------------------------------
- def command_123
- inbattle = $BlizzABS ? @event_id == 0 : $game_temp.in_battle
- if in_battle
- @params = @parameters unless VX
- key = [ SwitchKey ,$game_troop.troop_id, @params[0]]
- $game_self_switches[key] = (@params[1] == 0)
- end
- drg129_cmd123
- end
- #--------------------------------------------------------------------------
- # * Conditional Branch
- #--------------------------------------------------------------------------
- def command_111
- result = false
- unless VX
- @params = @parameters
- @indent = @list[@index].indent
- end
- inbattle = $BlizzABS ? @event_id == 0 : $game_temp.in_battle
- if @params[0] == 2 && in_battle
- key = [(SwitchKey),$game_troop.troop_id, @params[1]]
- if @params[2] == 0
- result = ($game_self_switches[key] == true)
- else
- result = ($game_self_switches[key] != true)
- end
- @branch[@indent] = result
- if @branch[@indent] == true
- @branch.delete(@indent)
- return true
- end
- return command_skip
- end
- drg129_cmd111
- end
- end#"
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias drg129_main main unless method_defined?(:drg129_main)
- #--------------------------------------------------------------------------
- # * Main Processing
- #--------------------------------------------------------------------------
- def main
- drg129_main
- val = ['A','B','C','D']
- (0...val.size).each {|i|
- key = [LiTTleDRAgo::SwitchKey,$game_troop.troop_id, val[i]]
- $game_self_switches[key] = false } if LiTTleDRAgo::ClearwhenFinish
- end
- end
- #==============================================================================
- # ** Game_Troop
- #------------------------------------------------------------------------------
- # This class deals with troops. Refer to "$game_troop" for the instance of
- # this class.
- #==============================================================================
- class Game_Troop
- #--------------------------------------------------------------------------
- # * Public Instance Variables
- #--------------------------------------------------------------------------\
- attr_reader :troop_id
- #--------------------------------------------------------------------------
- # * Alias Listing
- #--------------------------------------------------------------------------
- alias drg129_setup setup unless method_defined?(:drg129_setup)
- #--------------------------------------------------------------------------
- # * Setup
- # troop_id : troop ID
- #--------------------------------------------------------------------------
- def setup(troop_id)
- @troop_id = troop_id
- drg129_setup(troop_id)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement