Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #======================#
- # Z-Systems by: Zetu #
- #===========================#======================#===========================#
- # * * * Party System v1.03 * * * #
- #=#==========================================================================#=#
- # CONTROLS : #
- # $game_party.full_party = Array of all actors based on FULLPARTY's indexs #
- # (ACTOR).unlock = Gives access to this charactor. #
- # Starting party members are automatically unlocked! #
- # Actors added to the party using the Add Event are automatically #
- # unlocked if actor is disabled. #
- # (ACTOR).lock = Prevents actor from joining/leaving party. #
- # (ACTOR).disable = Disables access to this charactor. #
- # Good for if an actor permenatly leaves a party or dies (poor Aeris) #
- # (ACOTR).locked? = Checks if an actor is locked. #
- # (ACTOR).unlocked? = Checks if an actor is enabled. #
- #==========================================================================#
- # This script does NOT have a default menu positon. Use the call script #
- # '$scene = Scene_PartySys' for an event call and #
- # '$scene = Scene_PartySys(true)' for menu scripts. Recommend use for #
- # Neo Menu System (http://www.rpgmakervx.net/index.php?showtopic=42742) #
- #==========================================================================#
- # OVERWRITES: #
- # * Game_Interpreter::command_129 #
- #==========================================================================#
- # VERSION HISTORY: #
- # v1.02 #
- # * General Bug Fixes #
- # * Frames Added #
- # * No longer draws disabled actors #
- # v1.03 #
- # * Step Fix #
- #==========================================================================#
- module Z_Systems
- module Party_System
- FULLPARTY = 1..8 #Array of indexs for all party members to be included
- #within the menu. Max 8! 0 is NOT a valid index.
- INDEX = 4 #Index of Menu
- end
- end
- #========#======================#====#================================#========#
- #--------# #----# DO NOT EDIT PAST THIS POINT!!! #--------#
- #--------# End of Customization #----# Editing will cause death by #--------#
- #--------# #----# brain asplosions. #--------#
- #========#======================#====#================================#========#
- class Scene_PartySys < Scene_Base
- def initialize(from_menu = false)
- @window_a = Window_PartySys_A.new
- @window_b = Window_PartySys_B.new
- @window_a.active = true
- @from_menu = from_menu
- end
- def update
- super
- if @window_a.active
- update_window_a
- elsif @window_b.active
- update_window_b
- end
- end
- def return_scene
- if @from_menu
- $scene = Scene_Menu.new(Z_Systems::Party_System::INDEX)
- else
- $scene = Scene_Map.new
- end
- end
- def update_window_a
- if Input.trigger?(Input::B)
- if $game_party.members.size == 0
- Sound.play_buzzer
- else
- Sound.play_cancel
- return_scene
- end
- elsif Input.trigger?(Input::C)
- actor = $game_party.members[@window_a.index]
- if $game_party.lock_array[@window_a.index] == true
- Sound.play_buzzer
- return
- end
- if actor == nil
- Sound.play_buzzer
- return
- end
- $game_party.remove_actor(actor.actor_index)
- Sound.play_cancel
- @window_a.refresh
- @window_b.refresh
- elsif Input.trigger?(Input::DOWN)
- @window_a.index += 1
- @window_a.index %= 4
- elsif Input.trigger?(Input::UP)
- @window_a.index += 3
- @window_a.index %= 4
- elsif Input.trigger?(Input::RIGHT)
- @window_a.active = false
- @window_b.active = true
- @window_b.index = 2*@window_a.index
- @window_a.index = -1
- end
- end
- def update_window_b
- if Input.trigger?(Input::B)
- if $game_party.members.size == 0
- Sound.play_buzzer
- else
- Sound.play_cancel
- return_scene
- end
- elsif Input.trigger?(Input::C)
- actor = $game_party.full_party[@window_b.index]
- if actor.locked?
- Sound.play_buzzer
- return
- end
- if actor == nil
- Sound.play_buzzer
- return
- end
- if $game_party.members.include?(actor)
- Sound.play_buzzer
- return
- end
- $game_party.add_actor(actor.actor_index)
- Sound.play_decision
- @window_a.refresh
- @window_b.refresh
- elsif Input.trigger?(Input::DOWN)
- @window_b.index += 2
- @window_b.index %= 8
- elsif Input.trigger?(Input::UP)
- @window_b.index += 6
- @window_b.index %= 8
- elsif Input.trigger?(Input::LEFT)
- if @window_b.index%2 == 0
- @window_a.active = true
- @window_b.active = false
- @window_a.index = @window_b.index/2
- @window_b.index = -1
- else
- @window_b.index -= 1
- end
- elsif Input.trigger?(Input::RIGHT)
- @window_b.index += 1
- @window_b.index %= 8
- end
- end
- def terminate
- @window_a.dispose
- @window_b.dispose
- end
- end
- class Game_Party < Game_Unit
- def full_party
- result = []
- for i in Z_Systems::Party_System::FULLPARTY
- result.push($game_actors[i])
- end
- return result
- end
- def lock_array
- result = []
- for actor in members
- result.push(actor.locked?)
- end
- return result
- end
- end
- class Game_Actor < Game_Battler
- alias zsps_setup setup
- def setup(actor_id)
- zsps_setup(actor_id)
- @locked = $data_system.party_members.include?(actor_id) == false
- @unlocked = $data_system.party_members.include?(actor_id)
- end
- def locked?
- return @locked
- end
- def unlocked?
- return @unlocked
- end
- def unlock
- @locked = false
- @unlocked = true
- end
- def lock
- @locked = true
- end
- def disable
- @locked = true
- @unlocked = false
- end
- def actor_index
- return @actor_id
- end
- end
- class Game_Interpreter
- def command_129 #OVERWRITE
- actor = $game_actors[@params[0]]
- if actor != nil
- if @params[1] == 0
- if @params[2] == 1
- $game_actors[@params[0]].setup(@params[0])
- end
- $game_party.add_actor(@params[0])
- else
- $game_party.remove_actor(@params[0])
- end
- $game_map.need_refresh = true
- end
- $game_actors[@params[0]].unlock if @params[1] == 0
- return true
- end
- end
- class Window_PartySys_A < Window_Selectable
- def initialize
- super(0, 0, 192, 416)
- refresh
- self.index = 0
- end
- def refresh
- self.contents.clear
- @item_max = 4
- for actor in $game_party.members
- draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
- x = 56
- y = actor.index * 96 + WLH / 2
- if actor.locked? == true
- draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
- draw_frame(1, y - WLH/2, 158, 94, text_color(14))
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x, y + WLH)
- draw_actor_level(actor, x, y + WLH * 2)
- else
- draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
- draw_frame(1, y - WLH/2, 158, 94, text_color(3))
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x, y + WLH)
- draw_actor_level(actor, x, y + WLH * 2)
- end
- end
- end
- def update_cursor
- if @index < 0 # No cursor
- self.cursor_rect.empty
- elsif @index < @item_max # Normal
- self.cursor_rect.set(0, @index * 96, contents.width, 96)
- elsif @index >= 100 # Self
- self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
- else # All
- self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
- end
- end
- end
- class Window_PartySys_B < Window_Selectable
- def initialize
- super(192, 0, 352, 416)
- refresh
- self.active = false
- self.index = -1
- end
- def refresh
- self.contents.clear
- @item_max = 8
- xo = 0
- for actor in $game_party.full_party
- x = 160 * (xo%2) + 56
- y = xo/2 * 96 + WLH / 2
- if actor.unlocked? != true
- draw_frame(1 + 160 * (xo%2), y - WLH/2, 158, 94, text_color(7))
- elsif actor.locked? == true or $game_party.members.include?(actor)
- draw_actor_face(actor, 2 + 160 * (xo%2), y - WLH/2, 92)
- draw_frame(1 + 160 * (xo%2), y - WLH/2, 158, 94, text_color(14))
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x, y + WLH)
- draw_actor_level(actor, x, y + WLH * 2)
- else
- draw_actor_face(actor, 2 + 160 * (xo%2), y - WLH/2, 92)
- draw_frame(1 + 160 * (xo%2), y - WLH/2, 158, 94, text_color(3))
- draw_actor_name(actor, x, y)
- draw_actor_class(actor, x, y + WLH)
- draw_actor_level(actor, x, y + WLH * 2)
- end
- xo += 1
- end
- end
- def update_cursor
- if @index < 0 # No cursor
- self.cursor_rect.empty
- elsif @index < @item_max # Normal
- self.cursor_rect.set(160*(@index%2), (@index/2) * 96, contents.width/2, 96)
- elsif @index >= 100 # Self
- self.cursor_rect.set(160*(@index%2), ((@index/2) - 100) * 96, contents.width/2, 96)
- else # All
- self.cursor_rect.set(160*(@index%2), 0, contents.width/2, @item_max/2 * 96)
- end
- end
- end
- class Window_Base < Window
- def draw_frame(x, y, width, height, color = normal_color)
- self.contents.fill_rect(x, y, 1, height, color)
- self.contents.fill_rect(x, y, width, 1, color)
- self.contents.fill_rect(x + width - 1, y, 1, height, color)
- self.contents.fill_rect(x, y + height - 1, width, 1, color)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement