luistop12Jue Sep 12, 2013 4:47 am
SUPER MODERADOR
Hace rato que hunter me hiso . y no he aportado nada xD, Pero en fin.
DESCRIPCIÓN
Con este script podrás cambiar tu grupo en un estilo unico
USO
- Spoiler:
- Para poder usar este script mediante un evento haz una llamada de script y colocaPara Llamar script
- Código:
$scene = Scene_PartyEdit.new
Para Permitir que un personaje se una al grupo (true activado/false Desactivado)- Código:
$game_actors[Numero Del Actor].enable_change = true
Para Impedir que un personaje pueda dejar el grupo (true activado/false Desactivado)- Código:
$game_actors[Numero Del Actor].lock_change = true
SCREENS
DEMO
De momento ninguna
SCRIPT
- Spoiler:
- Código:
#==============================================================================
# ■ VX-RGSS2-13 パーティー編集 [Ver.1.0.0] by Claimh
#------------------------------------------------------------------------------
# パーティー入れ替えをする画面です。
# パーティーの人数の最大値はGame_PartyのMAX_MEMBERSに依存します。
# パーティー未加入のメンバーには経験値は入りません。
#------------------------------------------------------------------------------
# ● パーティー編集呼び出し
# $scene = Scene_PartyEdit.new(menu_index)
# menu_index : メニューに戻る場合のコマンドIndex
# 省略 or -1にしておくとマップに戻ります
#------------------------------------------------------------------------------
# ● パーティー加入許可 flag : true(許可) / false(禁止)
# $game_actors[アクターID].enable_change = flag
# … enable_changeがtrueとなっているアクターのみパーティーへ加入できます
# 初期状態は全員falseです
#------------------------------------------------------------------------------
# ● 入れ替えロック flag : true(ロック) / false(ロック解除)
# $game_actors[アクターID].lock_change = flag
# … lock_changeがtrueとなっているアクターは入れ替えできません
# 初期状態は全員falseです
#==============================================================================
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :enable_change # 入れ替え可能
attr_accessor :lock_change # 入れ替えロック
#--------------------------------------------------------------------------
# ● セットアップ
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias setup_member setup
def setup(actor_id)
setup_member(actor_id)
@enable_change = false
@lock_change = false
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ● メンバー入れ替え
# index : メンバーIndex
# actor_id : アクター ID
#--------------------------------------------------------------------------
def change_actor(index, actor_id)
@actors[index] = actor_id
$game_player.refresh
end
end
#==============================================================================
# ■ Window_PartyMembers
#------------------------------------------------------------------------------
# パーティー編集画面でメンバーリストを表示するウィンドウ
#==============================================================================
class Window_PartyMembers < Window_Selectable
# ロック状態のアクターに付けるアイコンIndex
LOCK_ICON_IDX = 82
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# x : ウィンドウの X 座標
# y : ウィンドウの Y 座標
#--------------------------------------------------------------------------
def initialize(members, text="")
super(0, 0, 260, 416)
@text = text
refresh(members)
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● アクターID
#--------------------------------------------------------------------------
def actor_id
return nil if @members[@index].nil?
return @members[@index]
end
#--------------------------------------------------------------------------
# ● アクター
#--------------------------------------------------------------------------
def actor
return nil if self.actor_id.nil?
return $game_actors[self.actor_id]
end
#--------------------------------------------------------------------------
# ● アクターLock
#--------------------------------------------------------------------------
def actor_lock?
return false if self.actor_id.nil?
return $game_actors[self.actor_id].lock_change
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(members)
@members = members
@item_max = @members.size
create_contents
for i in 0...@members.size
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● ウィンドウ内容の作成
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * 96].max)
end
#--------------------------------------------------------------------------
# ● 先頭の行の取得
#--------------------------------------------------------------------------
def top_row
return self.oy / 96
end
#--------------------------------------------------------------------------
# ● 先頭の行の設定
# row : 先頭に表示する行
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * 96
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる行数の取得
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / 96
end
#--------------------------------------------------------------------------
# ● 項目を描画する矩形の取得
# index : 項目番号
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = 96
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * rect.height
return rect
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
if @members[index].nil?
self.contents.draw_text(rect,@text,1)
return
end
act = $game_actors[@members[index]]
draw_actor_face(act, rect.x+2, rect.y)
yy = WLH / 2
draw_actor_name(act, rect.x+104, rect.y + yy)
if act.lock_change
draw_icon(LOCK_ICON_IDX, rect.x+rect.width-24, rect.y+yy)
end
draw_actor_hp(act, rect.x+104, rect.y + yy + WLH * 1)
draw_actor_mp(act, rect.x+104, rect.y + yy + WLH * 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.refresh(self.actor)
end
end
#==============================================================================
# ■ Window_MemberStatus
#------------------------------------------------------------------------------
# パーティー編集画面でメンバーのステータスを表示するウィンドウ
#==============================================================================
class Window_MemberStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor : アクター
#--------------------------------------------------------------------------
def initialize
super(320, 0, 224, 416)
@actor = 1
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh(actor=nil)
return if actor == @actor
self.contents.clear
@actor = actor
if actor.nil?
self.contents.draw_text(0,0,contents.width,contents.height,"Empty",1)
return
end
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 128, 0)
draw_basic_info(4, 32)
draw_actor_graphic(@actor, 160, 96)
draw_parameters(24, 120)
#draw_exp_info(4, 240)
draw_equipments(4, 240)
end
#--------------------------------------------------------------------------
# ● 基本情報の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_basic_info(x, y)
draw_actor_level(@actor, x, y + WLH * 0)
draw_actor_state(@actor, x+72, y + WLH * 0)
draw_actor_hp(@actor, x, y + WLH * 1)
draw_actor_mp(@actor, x, y + WLH * 2)
end
#--------------------------------------------------------------------------
# ● 能力値の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_parameters(x, y)
draw_actor_parameter(@actor, x, y + WLH * 0, 0)
draw_actor_parameter(@actor, x, y + WLH * 1, 1)
draw_actor_parameter(@actor, x, y + WLH * 2, 2)
draw_actor_parameter(@actor, x, y + WLH * 3, 3)
end
#--------------------------------------------------------------------------
# ● 経験値情報の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_exp_info(x, y)
s1 = @actor.exp_s
s2 = @actor.next_rest_exp_s
s_next = sprintf(Vocab::ExpNext, Vocab::level)
self.contents.font.color = system_color
self.contents.draw_text(x, y + WLH * 0, 180, WLH, Vocab::ExpTotal)
self.contents.draw_text(x, y + WLH * 2, 180, WLH, s_next)
self.contents.font.color = normal_color
self.contents.draw_text(x, y + WLH * 1, 180, WLH, s1, 2)
self.contents.draw_text(x, y + WLH * 3, 180, WLH, s2, 2)
end
#--------------------------------------------------------------------------
# ● 装備品の描画
# x : 描画先 X 座標
# y : 描画先 Y 座標
#--------------------------------------------------------------------------
def draw_equipments(x, y)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, WLH, Vocab::equip)
for i in 0..4
draw_item_name(@actor.equips[i], x + 16, y + WLH * (i + 1))
end
end
end
#==============================================================================
# ■ Scene_PartyEdit
#------------------------------------------------------------------------------
# パーティー編集画面の処理を行うクラスです。
#==============================================================================
class Scene_PartyEdit < Scene_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# menu_index : コマンドのカーソル初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = -1)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_main_members
create_sub_members
@main_window = Window_PartyMembers.new(@main_members, "Add")
@sub_window = Window_PartyMembers.new(@sub_members, "Remove")
@status_window = Window_MemberStatus.new
@sub_window.x = 60
change_window(@sub_window, @main_window)
end
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@main_window.dispose
@sub_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
update_menu_background
if @main_window.active
@main_window.update
update_main_selection
elsif @sub_window.active
@sub_window.update
update_sub_selection
end
end
#--------------------------------------------------------------------------
# ● 元の画面へ戻る
#--------------------------------------------------------------------------
def return_scene
$scene = @menu_index < 0 ? Scene_Map.new : Scene_Menu.new(@menu_index)
end
#--------------------------------------------------------------------------
# ● Window切り替え
#--------------------------------------------------------------------------
def change_window(old, new)
old.z = 100
old.active = false
old.contents_opacity = 160
old.help_window = nil
new.z = 200
new.active = true
new.contents_opacity = 255
new.help_window = @status_window
new.index = new.index < 0 ? 0 : new.index
end
#--------------------------------------------------------------------------
# ● パーティーメンバー生成
#--------------------------------------------------------------------------
def create_main_members
@main_members = []
for actor in $game_party.members
@main_members.push(actor.id)
end
@main_members.push(nil) if @main_members.size < Game_Party::MAX_MEMBERS
end
#--------------------------------------------------------------------------
# ● 待機メンバー生成
#--------------------------------------------------------------------------
def create_sub_members
@sub_members = []
for i in 1...$data_actors.size
actor = $game_actors[$data_actors[i].id]
if actor.enable_change and !$game_party.members.include?(actor)
@sub_members.push(actor.id)
end
end
@sub_members.push(nil)
end
#--------------------------------------------------------------------------
# ● パーティーメンバー更新処理
#--------------------------------------------------------------------------
def update_main_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
if @sub_members.size == 0
Sound.play_buzzer # 待機不可
return
elsif @main_window.actor_lock?
Sound.play_buzzer # Lock状態
return
end
Sound.play_decision
change_window(@main_window, @sub_window)
end
end
#--------------------------------------------------------------------------
# ● 待機メンバー更新処理
#--------------------------------------------------------------------------
def update_sub_selection
if Input.trigger?(Input::B)
Sound.play_cancel
change_window(@sub_window, @main_window)
elsif Input.trigger?(Input::C)
if $game_party.members.size <= 1 and @sub_window.actor.nil?
Sound.play_buzzer # 1人未満パーティーは禁止
return
elsif @main_window.actor.nil? and @sub_window.actor.nil?
Sound.play_buzzer # Empty交換は禁止
return
elsif @sub_window.actor_lock?
Sound.play_buzzer # 待機側がLock
return
end
Sound.play_decision
if @main_window.actor_id.nil?
$game_party.add_actor(@sub_window.actor_id)
elsif @sub_window.actor_id.nil?
$game_party.remove_actor(@main_window.actor_id)
else
$game_party.change_actor(@main_window.index, @sub_window.actor_id)
end
create_main_members
create_sub_members
@main_window.refresh(@main_members)
@sub_window.refresh(@sub_members)
change_window(@sub_window, @main_window)
@sub_window.index = -1
end
end
end