| | Script PHS (Changer de persos) | |
| | Auteur | Message |
---|
kill00man > Grand artiste
Nombre de messages : 285 Age : 43 Localisation : Derrière-toi, prêt a t'assassiner ! Avez vous RPGMXP ? : On dit RMXP et oui, biensûr que je l'ai :p Quels sont vos projets ? : The Strom Of Chrono Date d'inscription : 03/05/2007
Fiche Créateur Points de Créativité: (0/50) Commentaires:
| Sujet: Script PHS (Changer de persos) Dim 6 Mai - 11:51 | |
| Salut! Alors voila, un PHS c'est un menu qui permet de changer de persos si on en a plus de 4! Donc ce script est tres tres long!!!! Mais il marche a merveille XD Fait un nouveau script au dessus de main et nommez le comme vous voulez!(je vous conseil PHS XD) Place au script:#SCRIPT PHS #TRADUIT ET MODIFIE PAR KILL00MAN
#============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # Modifié par kill00man #==============================================================================
class Window_BasePHS < Window #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : ウィンドウの X 座標 # y : ウィンドウの Y 座標 # width : ウィンドウの幅 # height : ウィンドウの高さ #-------------------------------------------------------------------------- def initialize(x, y, width, height) super() @windowskin_name = $game_system.windowskin_name self.windowskin = RPG::Cache.windowskin(@windowskin_name) self.x = x self.y = y self.width = width self.height = height self.z = 100 end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # ウィンドウ内容のビットマップが設定されていれば解放 if self.contents != nil self.contents.dispose end super end #-------------------------------------------------------------------------- # ● 文字色取得 # n : 文字色番号 (0~7) #-------------------------------------------------------------------------- def text_color(n) case n when 0 return Color.new(255, 255, 255, 255) when 1 return Color.new(128, 128, 255, 255) when 2 return Color.new(255, 128, 128, 255) when 3 return Color.new(128, 255, 128, 255) when 4 return Color.new(128, 255, 255, 255) when 5 return Color.new(255, 128, 255, 255) when 6 return Color.new(255, 255, 128, 255) when 7 return Color.new(192, 192, 192, 255) else normal_color end end #-------------------------------------------------------------------------- # ● 通常文字色の取得 #-------------------------------------------------------------------------- def normal_color return Color.new(255, 255, 255, 255) end #-------------------------------------------------------------------------- # ● 無効文字色の取得 #-------------------------------------------------------------------------- def disabled_color return Color.new(255, 255, 255, 128) end #-------------------------------------------------------------------------- # ● システム文字色の取得 #-------------------------------------------------------------------------- def system_color return Color.new(192, 224, 255, 255) end #-------------------------------------------------------------------------- # ● ピンチ文字色の取得 #-------------------------------------------------------------------------- def crisis_color return Color.new(255, 255, 64, 255) end #-------------------------------------------------------------------------- # ● 戦闘不能文字色の取得 #-------------------------------------------------------------------------- def knockout_color return Color.new(255, 64, 0) end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # ウィンドウスキンが変更された場合、再設定 if $game_system.windowskin_name != @windowskin_name @windowskin_name = $game_system.windowskin_name self.windowskin = RPG::Cache.windowskin(@windowskin_name) end end #-------------------------------------------------------------------------- # ● グラフィックの描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_graphic(actor, x, y) bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) cw = bitmap.width / 4 ch = bitmap.height / 4 src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end #-------------------------------------------------------------------------- # ● 名前の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_name(actor, x, y) self.contents.font.color = normal_color self.contents.draw_text(x, y, 120, 32, actor.name) end #-------------------------------------------------------------------------- # ● クラスの描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_class(actor, x, y) self.contents.font.color = normal_color self.contents.draw_text(x, y, 236, 32, actor.class_name) end #-------------------------------------------------------------------------- # ● レベルの描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "Lv") self.contents.font.color = normal_color self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2) end #-------------------------------------------------------------------------- # ● 描画用のステート文字列作成 # actor : アクター # width : 描画先の幅 # need_normal : [正常] が必要かどうか (true / false) #-------------------------------------------------------------------------- def make_battler_state_text(battler, width, need_normal) # 括弧の幅を取得 brackets_width = self.contents.text_size("[]").width # ステート名の文字列を作成 text = "" for i in battler.states if $data_states[i].rating >= 1 if text == "" text = $data_states[i].name else new_text = text + "/" + $data_states[i].name text_width = self.contents.text_size(new_text).width if text_width > width - brackets_width break end text = new_text end end end # ステート名の文字列が空の場合は "[正常]" にする if text == "" if need_normal text = "[Normal]" end else # 括弧をつける text = "[" + text + "]" end # 完成した文字列を返す return text end #-------------------------------------------------------------------------- # ● ステートの描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 描画先の幅 #-------------------------------------------------------------------------- def draw_actor_state(actor, x, y, width = 120) text = make_battler_state_text(actor, width, true) self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color self.contents.draw_text(x, y, width, 32, text) end #-------------------------------------------------------------------------- # ● EXP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_actor_exp(actor, x, y) self.contents.font.color = system_color self.contents.draw_text(x, y, 24, 32, "E") self.contents.font.color = normal_color self.contents.draw_text(x + 24, y, 84, 32, actor.exp_s, 2) self.contents.draw_text(x + 108, y, 12, 32, "/", 1) self.contents.draw_text(x + 120, y, 84, 32, actor.next_exp_s) end #-------------------------------------------------------------------------- # ● HP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 描画先の幅 #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 144) # 文字列 "HP" を描画 self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.hp) # MaxHP を描画するスペースがあるか計算 if width - 32 >= 108 hp_x = x + width - 108 flag = true elsif width - 32 >= 48 hp_x = x + width - 48 flag = false end # HP を描画 self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2) # MaxHP を描画 if flag self.contents.font.color = normal_color self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1) self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s) end end #-------------------------------------------------------------------------- # ● SP の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # width : 描画先の幅 #-------------------------------------------------------------------------- def draw_actor_sp(actor, x, y, width = 144) # 文字列 "SP" を描画 self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.sp) # MaxSP を描画するスペースがあるか計算 if width - 32 >= 108 sp_x = x + width - 108 flag = true elsif width - 32 >= 48 sp_x = x + width - 48 flag = false end # SP を描画 self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2) # MaxSP を描画 if flag self.contents.font.color = normal_color self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1) self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s) end end #-------------------------------------------------------------------------- # ● パラメータの描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # type : パラメータの種類 (0~6) #-------------------------------------------------------------------------- def draw_actor_parameter(actor, x, y, type) case type when 0 parameter_name = $data_system.words.atk parameter_value = actor.atk when 1 parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 2 parameter_name = $data_system.words.mdef parameter_value = actor.mdef when 3 parameter_name = $data_system.words.str parameter_value = actor.str when 4 parameter_name = $data_system.words.dex parameter_value = actor.dex when 5 parameter_name = $data_system.words.agi parameter_value = actor.agi when 6 parameter_name = $data_system.words.int parameter_value = actor.int end self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, parameter_name) self.contents.font.color = normal_color self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2) end #-------------------------------------------------------------------------- # ● アイテム名の描画 # item : アイテム # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- def draw_item_name(item, x, y) if item == nil return end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 212, 32, item.name) end end
Suite ci-dessus
Dernière édition par le Dim 6 Mai - 12:02, édité 1 fois | |
| | | kill00man > Grand artiste
Nombre de messages : 285 Age : 43 Localisation : Derrière-toi, prêt a t'assassiner ! Avez vous RPGMXP ? : On dit RMXP et oui, biensûr que je l'ai :p Quels sont vos projets ? : The Strom Of Chrono Date d'inscription : 03/05/2007
Fiche Créateur Points de Créativité: (0/50) Commentaires:
| Sujet: Re: Script PHS (Changer de persos) Dim 6 Mai - 11:52 | |
| SUITE [quote] # -------------------------------- def up_color return Color.new(74, 210, 74) end # -------------------------------- def down_color return Color.new(170, 170, 170) end
#============================================================================== # &#9632; Window_Selectable #------------------------------------------------------------------------------ #Modifié par kill00man #==============================================================================
class Window_SelectablePHS < Window_BasePHS #-------------------------------------------------------------------------- # &#9679; &#20844;&#38283;&#12452;&#12531;&#12473;&#12479;&#12531;&#12473;&#22793;&#25968; #-------------------------------------------------------------------------- attr_reader :index # &#12459;&#12540;&#12477;&#12523;&#20301;&#32622; attr_reader :help_window # &#12504;&#12523;&#12503;&#12454;&#12451;&#12531;&#12489;&#12454; #-------------------------------------------------------------------------- # &#9679; &#12458;&#12502;&#12472;&#12455;&#12463;&#12488;&#21021;&#26399;&#21270; # x : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398; X &#24231;&#27161; # y : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398; Y &#24231;&#27161; # width : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398;&#24133; # height : &#12454;&#12451;&#12531;&#12489;&#12454;&#12398;&#39640;&#12373; #-------------------------------------------------------------------------- def initialize(x, y, width, height) super(x, y, width, height) @item_max = 1 @column_max = 1 @index = -1 end #-------------------------------------------------------------------------- # &#9679; &#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12398;&#35373;&#23450; # index : &#26032;&#12375;&#12356;&#12459;&#12540;&#12477;&#12523;&#20301;&#32622; #-------------------------------------------------------------------------- def index=(index) @index = index # &#12504;&#12523;&#12503;&#12486;&#12461;&#12473;&#12488;&#12434;&#26356;&#26032; (update_help &#12399;&#32153;&#25215;&#20808;&#12391;&#23450;&#32681;&#12373;&#12428;&#12427;) if self.active and @help_window != nil update_help end # &#12459;&#12540;&#12477;&#12523;&#12398;&#30697;&#24418;&#12434;&#26356;&#26032; update_cursor_rect end #-------------------------------------------------------------------------- # &#9679; &#34892;&#25968;&#12398;&#21462;&#24471; #-------------------------------------------------------------------------- def row_max # &#38917;&#30446;&#25968;&#12392;&#21015;&#25968;&#12363;&#12425;&#34892;&#25968;&#12434;&#31639;&#20986; return (@item_max + @column_max - 1) / @column_max end #-------------------------------------------------------------------------- # &#9679; &#20808;&#38957;&#12398;&#34892;&#12398;&#21462;&#24471; #-------------------------------------------------------------------------- def top_row # &#12454;&#12451;&#12531;&#12489;&#12454;&#20869;&#23481;&#12398;&#36578;&#36865;&#20803; Y &#24231;&#27161;&#12434;&#12289;1 &#34892;&#12398;&#39640;&#12373; 32 &#12391;&#21106;&#12427; return self.oy / 32 end #-------------------------------------------------------------------------- # &#9679; &#20808;&#38957;&#12398;&#34892;&#12398;&#35373;&#23450; # row : &#20808;&#38957;&#12395;&#34920;&#31034;&#12377;&#12427;&#34892; #-------------------------------------------------------------------------- def top_row=(row) # row &#12364; 0 &#26410;&#28288;&#12398;&#22580;&#21512;&#12399; 0 &#12395;&#20462;&#27491; if row < 0 row = 0 end # row &#12364; row_max - 1 &#36229;&#12398;&#22580;&#21512;&#12399; row_max - 1 &#12395;&#20462;&#27491; if row > row_max - 1 row = row_max - 1 end # row &#12395; 1 &#34892;&#12398;&#39640;&#12373; 32 &#12434;&#25499;&#12369;&#12289;&#12454;&#12451;&#12531;&#12489;&#12454;&#20869;&#23481;&#12398;&#36578;&#36865;&#20803; Y &#24231;&#27161;&#12392;&#12377;&#12427; self.oy = row * 32 end #-------------------------------------------------------------------------- # &#9679; 1 &#12506;&#12540;&#12472;&#12395;&#34920;&#31034;&#12391;&#12365;&#12427;&#34892;&#25968;&#12398;&#21462;&#24471; #-------------------------------------------------------------------------- def page_row_max # &#12454;&#12451;&#12531;&#12489;&#12454;&#12398;&#39640;&#12373;&#12363;&#12425;&#12289;&#12501;&#12524;&#12540;&#12512;&#12398;&#39640;&#12373; 32 &#12434;&#24341;&#12365;&#12289;1 &#34892;&#12398;&#39640;&#12373; 32 &#12391;&#21106;&#12427; return (self.height - 32) / 32 end #-------------------------------------------------------------------------- # &#9679; 1 &#12506;&#12540;&#12472;&#12395;&#34920;&#31034;&#12391;&#12365;&#12427;&#38917;&#30446;&#25968;&#12398;&#21462;&#24471; #-------------------------------------------------------------------------- def page_item_max # &#34892;&#25968; page_row_max &#12395; &#21015;&#25968; @column_max &#12434;&#25499;&#12369;&#12427; return page_row_max * @column_max end #-------------------------------------------------------------------------- # &#9679; &#12504;&#12523;&#12503;&#12454;&#12451;&#12531;&#12489;&#12454;&#12398;&#35373;&#23450; # help_window : &#26032;&#12375;&#12356;&#12504;&#12523;&#12503;&#12454;&#12451;&#12531;&#12489;&#12454; #-------------------------------------------------------------------------- def help_window=(help_window) @help_window = help_window # &#12504;&#12523;&#12503;&#12486;&#12461;&#12473;&#12488;&#12434;&#26356;&#26032; (update_help &#12399;&#32153;&#25215;&#20808;&#12391;&#23450;&#32681;&#12373;&#12428;&#12427;) if self.active and @help_window != nil update_help end end #-------------------------------------------------------------------------- # &#9679; &#12459;&#12540;&#12477;&#12523;&#12398;&#30697;&#24418;&#26356;&#26032; #-------------------------------------------------------------------------- def update_cursor_rect # &#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12364; 0 &#26410;&#28288;&#12398;&#22580;&#21512; if @index < 0 self.cursor_rect.empty return end # &#29694;&#22312;&#12398;&#34892;&#12434;&#21462;&#24471; row = @index / @column_max # &#29694;&#22312;&#12398;&#34892;&#12364;&#12289;&#34920;&#31034;&#12373;&#12428;&#12390;&#12356;&#12427;&#20808;&#38957;&#12398;&#34892;&#12424;&#12426;&#21069;&#12398;&#22580;&#21512; if row < self.top_row # &#29694;&#22312;&#12398;&#34892;&#12364;&#20808;&#38957;&#12395;&#12394;&#12427;&#12424;&#12358;&#12395;&#12473;&#12463;&#12525;&#12540;&#12523; self.top_row = row end # &#29694;&#22312;&#12398;&#34892;&#12364;&#12289;&#34920;&#31034;&#12373;&#12428;&#12390;&#12356;&#12427;&#26368;&#24460;&#23614;&#12398;&#34892;&#12424;&#12426;&#24460;&#12429;&#12398;&#22580;&#21512; if row > self.top_row + (self.page_row_max - 1) # &#29694;&#22312;&#12398;&#34892;&#12364;&#26368;&#24460;&#23614;&#12395;&#12394;&#12427;&#12424;&#12358;&#12395;&#12473;&#12463;&#12525;&#12540;&#12523; self.top_row = row - (self.page_row_max - 1) end # &#12459;&#12540;&#12477;&#12523;&#12398;&#24133;&#12434;&#35336;&#31639; cursor_width = self.width / @column_max - 32 # &#12459;&#12540;&#12477;&#12523;&#12398;&#24231;&#27161;&#12434;&#35336;&#31639; x = @index % @column_max * (cursor_width + 32) y = @index / @column_max * 32 - self.oy # &#12459;&#12540;&#12477;&#12523;&#12398;&#30697;&#24418;&#12434;&#26356;&#26032; self.cursor_rect.set(x, y, cursor_width, 32) end #-------------------------------------------------------------------------- # &#9679; &#12501;&#12524;&#12540;&#12512;&#26356;&#26032; #-------------------------------------------------------------------------- def update super # &#12459;&#12540;&#12477;&#12523;&#12398;&#31227;&#21205;&#12364;&#21487;&#33021;&#12394;&#29366;&#24907;&#12398;&#22580;&#21512; if self.active and @item_max > 0 and @index >= 0 # &#26041;&#21521;&#12508;&#12479;&#12531;&#12398;&#19979;&#12364;&#25276;&#12373;&#12428;&#12383;&#22580;&#21512; if Input.repeat?(Input::DOWN) # &#21015;&#25968;&#12364; 1 &#12363;&#12388; &#26041;&#21521;&#12508;&#12479;&#12531;&#12398;&#19979;&#12398;&#25276;&#19979;&#29366;&#24907;&#12364;&#12522;&#12500;&#12540;&#12488;&#12391;&#12394;&#12356;&#22580;&#21512;&#12363;&#12289; # &#12414;&#12383;&#12399;&#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12364;(&#38917;&#30446;&#25968; - &#21015;&#25968;)&#12424;&#12426;&#21069;&#12398;&#22580;&#21512; if (@column_max == 1 and Input.trigger?(Input::DOWN)) or @index < @item_max - @column_max # &#12459;&#12540;&#12477;&#12523;&#12434;&#19979;&#12395;&#31227;&#21205; $game_system.se_play($data_system.cursor_se) @index = (@index + @column_max) % @item_max end end # &#26041;&#21521;&#12508;&#12479;&#12531;&#12398;&#19978;&#12364;&#25276;&#12373;&#12428;&#12383;&#22580;&#21512; if Input.repeat?(Input::UP) # &#21015;&#25968;&#12364; 1 &#12363;&#12388; &#26041;&#21521;&#12508;&#12479;&#12531;&#12398;&#19978;&#12398;&#25276;&#19979;&#29366;&#24907;&#12364;&#12522;&#12500;&#12540;&#12488;&#12391;&#12394;&#12356;&#22580;&#21512;&#12363;&#12289; # &#12414;&#12383;&#12399;&#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12364;&#21015;&#25968;&#12424;&#12426;&#24460;&#12429;&#12398;&#22580;&#21512; if (@column_max == 1 and Input.trigger?(Input::UP)) or @index >= @column_max # &#12459;&#12540;&#12477;&#12523;&#12434;&#19978;&#12395;&#31227;&#21205; $game_system.se_play($data_system.cursor_se) @index = (@index - @column_max + @item_max) % @item_max end end # &#26041;&#21521;&#12508;&#12479;&#12531;&#12398;&#21491;&#12364;&#25276;&#12373;&#12428;&#12383;&#22580;&#21512; if Input.repeat?(Input::RIGHT) # &#21015;&#25968;&#12364; 2 &#20197;&#19978;&#12391;&#12289;&#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12364;(&#38917;&#30446;&#25968; - 1)&#12424;&#12426;&#21069;&#12398;&#22580;&#21512; if @column_max >= 2 and @index < @item_max - 1 # &#12459;&#12540;&#12477;&#12523;&#12434;&#21491;&#12395;&#31227;&#21205; $game_system.se_play($data_system.cursor_se) @index += 1 end end # &#26041;&#21521;&#12508;&#12479;&#12531;&#12398;&#24038;&#12364;&#25276;&#12373;&#12428;&#12383;&#22580;&#21512; if Input.repeat?(Input::LEFT) # &#21015;&#25968;&#12364; 2 &#20197;&#19978;&#12391;&#12289;&#12459;&#12540;&#12477;&#12523;&#20301;&#32622;&#12364; 0 &#12424;&#12426;&#24460;&#12429;&#12398;&#22580;&#21512; if @column_max >= 2 and @index > 0 # &#12459;&#12540;&#12477;&#12523;&#12434;&#24038;&#12395;&#31227;&#21205; $game_system.se_play($data_system.cursor_se) @index -= 1 end end # R &#12508;&#12479;&#12531;&#12364;&#25276;&#12373;&#12428;&#12383;&#22580;&#21512; if Input.repeat?(Input::R) # &#34920;&#31034;&#12373;&#12428;&#12390;&#12356;&#12427;&#26368;&#24460;&#23614;&#12398;&#34892;&#12364;&#12289;&#12487;&#12540;&#12479;&#19978;&#12398;&#26368;&#24460;&#12398;&#34892;&#12424;&#12426;&#12418;&#21069;&#12398;&#22580;&#21512; if self.top_row + (self.page_row_max - 1) < (self.row_max - 1) # &#12459;&#12540;&#12477;&#12523;&#12434; 1 &#12506;&#12540;&#12472;&#24460;&#12429;&#12395;&#31227;&#21205; $game_system.se_play($data_system.cursor_se) @index = [@index + self.page_item_max, @item_max - 1].min self.top_row += self.page_row_max end end # L &#12508;&#12479;&#12531;&#12364;&#25276;&#12373;&#12428;&#12383;&#22580;&#21512; if Input.repeat?(Input::L) # &#34920;&#31034;&#12373;&#12428;&#12390;&#12356;&#12427;&#20808;&#38957;&#12398;&#34892;&#12364; 0 &#12424;&#12426;&#24460;&#12429;&#12398;&#22580;&#21512; if self.top_row > 0 # &#12459;&#12540;&#12477;&#12523;&#12434; 1 &#12506;&#12540;&#12472;&#21069;&#12395;&#31227;&#21205; $game_system.se_play($data_system.cursor_se) @index = [@index - self.page_item_max, 0].max self.top_row -= self.page_row_max end end end # &#12504;&#12523;&#12503;&#12486;&#12461;&#12473;&#12488;&#12434;&#26356;&#26032; (update_help &#12399;&#32153;&#25215;&#20808;&#12391;&#23450;&#32681;&#12373;&#12428;&#12427;) if self.active and @help_window != nil update_help end [code] SUITE CI-DESSUS | |
| | | kill00man > Grand artiste
Nombre de messages : 285 Age : 43 Localisation : Derrière-toi, prêt a t'assassiner ! Avez vous RPGMXP ? : On dit RMXP et oui, biensûr que je l'ai :p Quels sont vos projets ? : The Strom Of Chrono Date d'inscription : 03/05/2007
Fiche Créateur Points de Créativité: (0/50) Commentaires:
| Sujet: Re: Script PHS (Changer de persos) Dim 6 Mai - 11:53 | |
| SUITE # カーソルの矩形を更新 update_cursor_rect end end
#============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ # Modifié par kill00man #==============================================================================
class Game_Actor < Game_Battler def now_exp return @exp - @exp_list[@level] end def next_exp return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0 end end
#============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # ゲーム中のすべてのウィンドウのスーパークラスです。 #==============================================================================
class Window_BasePHS < Window #-------------------------------------------------------------------------- # ● HP ゲージの描画 #-------------------------------------------------------------------------- # オリジナルのHP描画を draw_actor_hp_hpsp と名前変更 alias :draw_actor_hp_hpsp :draw_actor_hp def draw_actor_hp(actor, x, y, width = 288) # 変数rateに 現在のHP/MHPを代入 if actor.maxhp != 0 rate = actor.hp.to_f / actor.maxhp else rate = 0 end # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正 # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅 # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め # align3:ゲージタイプ 0:左詰め 1:右詰め plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # グラデーション設定 grade1:空ゲージ grade2:実ゲージ # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重)) grade1 = 1 grade2 = 0 # 色設定。color1:外枠,color2:中枠 # color3:空ゲージダークカラー,color4:空ゲージライトカラー # color5:実ゲージダークカラー,color6:実ゲージライトカラー color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(64, 0, 0, 192) color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192) color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192) # 変数spに描画するゲージの幅を代入 if actor.maxhp != 0 hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp else hp = 0 end # ゲージの描画 gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, hp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # オリジナルのHP描画処理を呼び出し draw_actor_hp_hpsp(actor, x, y, width) end #-------------------------------------------------------------------------- # ● SP ゲージの描画 #-------------------------------------------------------------------------- # オリジナルのSP描画を draw_actor_sp_hpsp と名前変更 alias :draw_actor_sp_hpsp :draw_actor_sp def draw_actor_sp(actor, x, y, width = 288) # 変数rateに 現在のSP/MSPを代入 if actor.maxsp != 0 rate = actor.sp.to_f / actor.maxsp else rate = 1 end SUITE CI-DESSUS | |
| | | kill00man > Grand artiste
Nombre de messages : 285 Age : 43 Localisation : Derrière-toi, prêt a t'assassiner ! Avez vous RPGMXP ? : On dit RMXP et oui, biensûr que je l'ai :p Quels sont vos projets ? : The Strom Of Chrono Date d'inscription : 03/05/2007
Fiche Créateur Points de Créativité: (0/50) Commentaires:
| Sujet: Re: Script PHS (Changer de persos) Dim 6 Mai - 11:54 | |
| SUITE # plus_x:X座標の位置補正 rate_x:X座標の位置補正(%) plus_y:Y座標の位置補正 # plus_width:幅の補正 rate_width:幅の補正(%) height:縦幅 # align1:描画タイプ1 0:左詰め 1:中央揃え 2:右詰め # align2:描画タイプ2 0:上詰め 1:中央揃え 2:下詰め # align3:ゲージタイプ 0:左詰め 1:右詰め plus_x = 0 rate_x = 0 plus_y = 25 plus_width = 0 rate_width = 100 height = 10 align1 = 1 align2 = 2 align3 = 0 # グラデーション設定 grade1:空ゲージ grade2:実ゲージ # (0:横にグラデーション 1:縦にグラデーション 2:斜めにグラデーション(激重)) grade1 = 1 grade2 = 0 # 色設定。color1:外枠,color2:中枠 # color3:空ゲージダークカラー,color4:空ゲージライトカラー # color5:実ゲージダークカラー,color6:実ゲージライトカラー color1 = Color.new(0, 0, 0, 192) color2 = Color.new(255, 255, 192, 192) color3 = Color.new(0, 0, 0, 192) color4 = Color.new(0, 64, 0, 192) color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192) color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192) # 変数spに描画するゲージの幅を代入 if actor.maxsp != 0 sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp else sp = (width + plus_width) * rate_width / 100 end # ゲージの描画 gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y, width, plus_width + width * rate_width / 100, height, sp, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) # オリジナルのSP描画処理を呼び出し draw_actor_sp_hpsp(actor, x, y, width) end #-------------------------------------------------------------------------- # ● ゲージの描画 #-------------------------------------------------------------------------- def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3, color1, color2, color3, color4, color5, color6, grade1, grade2) case align1 when 1 x += (rect_width - width) / 2 when 2 x += rect_width - width end case align2 when 1 y -= height / 2 when 2 y -= height end # 枠描画 self.contents.fill_rect(x, y, width, height, color1) self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2) if align3 == 0 if grade1 == 2 grade1 = 3 end if grade2 == 2 grade2 = 3 end end if (align3 == 1 and grade1 == 0) or grade1 > 0 color = color3 color3 = color4 color4 = color end if (align3 == 1 and grade2 == 0) or grade2 > 0 color = color5 color5 = color6 color6 = color end # 空ゲージの描画 self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4, color3, color4, grade1) if align3 == 1 x += width - gauge end # 実ゲージの描画 self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4, color5, color6, grade2) end end
#------------------------------------------------------------------------------ # Bitmapクラスに新たな機能を追加します。 #==============================================================================
class Bitmap #-------------------------------------------------------------------------- # ● 矩形をグラデーション表示 # color1 : スタートカラー # color2 : エンドカラー # align : 0:横にグラデーション # 1:縦にグラデーション # 2:斜めにグラデーション(激重につき注意) #-------------------------------------------------------------------------- def gradation_rect(x, y, width, height, color1, color2, align = 0) if align == 0 for i in x...x + width red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1) green = color1.green + (color2.green - color1.green) * (i - x) / (width - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - x) / (width - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - x) / (width - 1) color = Color.new(red, green, blue, alpha) fill_rect(i, y, 1, height, color) end elsif align == 1 for i in y...y + height red = color1.red + (color2.red - color1.red) * (i - y) / (height - 1) green = color1.green + (color2.green - color1.green) * (i - y) / (height - 1) blue = color1.blue + (color2.blue - color1.blue) * (i - y) / (height - 1) alpha = color1.alpha + (color2.alpha - color1.alpha) * (i - y) / (height - 1) color = Color.new(red, green, blue, alpha) fill_rect(x, i, width, 1, color) end elsif align == 2 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end elsif align == 3 for i in x...x + width for j in y...y + height red = color1.red + (color2.red - color1.red) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 green = color1.green + (color2.green - color1.green) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 blue = color1.blue + (color2.blue - color1.blue) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 alpha = color1.alpha + (color2.alpha - color1.alpha) * ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2 color = Color.new(red, green, blue, alpha) set_pixel(i, j, color) end end end end end
SUITE CI-DESSUS | |
| | | kill00man > Grand artiste
Nombre de messages : 285 Age : 43 Localisation : Derrière-toi, prêt a t'assassiner ! Avez vous RPGMXP ? : On dit RMXP et oui, biensûr que je l'ai :p Quels sont vos projets ? : The Strom Of Chrono Date d'inscription : 03/05/2007
Fiche Créateur Points de Créativité: (0/50) Commentaires:
| Sujet: Re: Script PHS (Changer de persos) Dim 6 Mai - 11:54 | |
| SUITE ET FIN #DEBUT SCRIPT PHS EN LUI MEME #Ici c'est très important #Remplacer @party_max = 4 par le nombre de héros voulu maximum (mettre @party_max = 6 pour avoir 6 héros...) #Remplacer @party_min = 1 par le nombre de héro minimum comme haut dessus #@must_actors=[1] défini l'id des heros obligatoire (metre [1,2,3] pour obliger les héros 1 2 et 3) class Game_Party attr_accessor :party_max attr_accessor :party_min attr_accessor :must_actors alias party_select_initialize initialize def initialize party_select_initialize @party_max = 4 @party_min = 1 @must_actors = [1] end def must_actor_include?(actor) return @must_actors.include?(actor.id) end end
class Window_Party_Select < Window_SelectablePHS def initialize super(0, 96, 640, 384) @party_in_ok_menber = party_in_menber @item_max = party_in_menber.size @column_max = 4 self.contents = Bitmap.new(width - 32, row_max * 88) self.contents.font.name = "Times New Roman" self.contents.font.size = 18 self.index = 0 refresh end def menber return @party_in_ok_menber[self.index] end #-------------------------------------------------------------------------- # Ici c'est très important!! #Endessus, on vois des trucs bizarres #menber.push($game_actors[1]) # menber.push($game_actors[2]) if $game_switches[1] #Explications menber.push($game_actors[X]) if $game_switches[Y] #Remplacer le X par l'Id du héro voulu dans l'équipe #Remplacer le Y par l'Id de l'événement a partir duquel il est possible d'insérer le héro X dans l'équipe #Ensuite apprend a l'utiliser en détail par toi-même #-------------------------------------------------------------------------- def party_in_menber menber = [] menber.push($game_actors[1]) menber.push($game_actors[2]) if $game_switches[1] menber.push($game_actors[3]) if $game_switches[2] menber.push($game_actors[4]) if $game_switches[3] menber.push($game_actors[5]) if $game_switches[4] menber.push($game_actors[6]) if $game_switches[5] menber.push($game_actors[7]) if $game_switches[6] menber.push($game_actors[8]) if $game_switches[7] return menber end def refresh self.contents.clear for i in 0...@party_in_ok_menber.size draw_menber(i) end end def draw_menber(index) actor = @party_in_ok_menber[index] x = 4 + index % @column_max * (640 / @column_max) y = index / @column_max * 88 if $game_party.must_actor_include?(actor) color = text_color(3) opacity = 255 elsif $game_party.actors.include?(actor) color = normal_color opacity = 255 else color = disabled_color opacity = 128 end self.contents.font.color = color self.contents.draw_text(x, y, 120, 32, actor.name) bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) cw = bitmap.width / 4 ch = bitmap.height / 4 src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x+32 - cw / 2, y+64+16 - ch, bitmap, src_rect, opacity) end def row_max return (@item_max + @column_max - 1) / @column_max end def top_row return self.oy / 88 end def top_row=(row) if row < 0 row = 0 end if row > row_max - 1 row = row_max - 1 if row < 0 row = 0 end end self.oy = row * 88 end def page_row_max return (self.height - 32) / 88 end def update_cursor_rect if @index < 0 self.cursor_rect.empty return end row = @index / @column_max if row < self.top_row self.top_row = row end if row > self.top_row + (self.page_row_max - 1) self.top_row = row - (self.page_row_max - 1) end cursor_width = 512 / @column_max x = @index % @column_max * (cursor_width + 32) y = @index / @column_max * 88 - self.oy self.cursor_rect.set(x, y, cursor_width, 32) end end
class Window_Party_Select_Menber < Window_BasePHS def initialize super(0, 0, 640, 96) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Times New Roman" self.contents.font.size = 18 refresh end def refresh self.contents.clear for i in 0...$game_party.actors.size draw_menber(i) end end def draw_menber(index) actor = $game_party.actors[index] x = 4 + index * (640 / $game_party.party_max) y = 0 draw_actor_graphic(actor, x+32, y+48+8) end end
class Window_Party_Select_Menber_Status < Window_BasePHS def initialize super(0, 288, 640, 192) self.contents = Bitmap.new(width - 32, height - 32) self.contents.font.name = "Times New Roman" self.contents.font.size = 18 self.visible = false end def refresh(actor) self.contents.clear draw_actor_name(actor, 4, 0) draw_actor_class(actor, 4 + 144, 0) draw_actor_level(actor, 4, 32) draw_actor_state(actor, 4 + 72, 32) draw_actor_hp(actor, 4, 64, 172) draw_actor_sp(actor, 4, 96, 172) draw_actor_parameter(actor, 218, 32, 0) draw_actor_parameter(actor, 218, 64, 1) draw_actor_parameter(actor, 218, 96, 2) draw_actor_parameter(actor, 430, 32, 3) draw_actor_parameter(actor, 430, 64, 4) draw_actor_parameter(actor, 430, 96, 5) draw_actor_parameter(actor, 430, 128, 6) end end
class Scene_Party_in def main @main_window = Window_Party_Select.new @menber_window = Window_Party_Select_Menber.new @status_window = Window_Party_Select_Menber_Status.new @status_window.opacity = 192 @status_window.z += 10 @show_index = 0 Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @main_window.dispose @menber_window.dispose @status_window.dispose end def update @main_window.update if @status_window.visible and @show_index != @main_window.index status_window_position @status_window.refresh(@main_window.menber) @show_index = @main_window.index end if Input.trigger?(Input::B) if $game_party.actors.size < $game_party.party_min $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end if keyboard($Key_NUMPAD1) if $game_party.must_actor_include?(@main_window.menber) $game_system.se_play($data_system.buzzer_se) return end if $game_party.actors.include?(@main_window.menber) $game_party.remove_actor(@main_window.menber.id) else if $game_party.actors.size == $game_party.party_max $game_system.se_play($data_system.buzzer_se) return end $game_party.add_actor(@main_window.menber.id) end $game_system.se_play($data_system.decision_se) @main_window.refresh @menber_window.refresh return end if @status_window.visible @status_window.visible = true else status_window_position @status_window.refresh(@main_window.menber) @status_window.visible = true @show_index = @main_window.index end return end end def status_window_position if @main_window.cursor_rect.y < 176 @status_window.y = 288 else @status_window.y = 96 end end
Maintenant, les explications! Regardez vers la ligne 790; cherchez en dessous: party_select_initialize @party_max = 4 @party_min = 1 @must_actors = [1] changez le 4 par le nombre max de persos en jeu changez le 1 par le nombre min de persos en jeu changez le [1] par l'ID des persos obligatoires
Ensuite, vers la ligne 833: menber.push($game_actors[1]) menber.push($game_actors[2]) if $game_switches[1] menber.push($game_actors[3]) if $game_switches[2] menber.push($game_actors[4]) if $game_switches[3] menber.push($game_actors[5]) if $game_switches[4] menber.push($game_actors[6]) if $game_switches[5] menber.push($game_actors[7]) if $game_switches[6] menber.push($game_actors[8]) if $game_switches[7] regardez et essayez de comprendre! explications: menber.push($game_actors[2]) if $game_switches[1] L'héro a l'id 2 est changeable dans le menu Si Interrupteur [1] est activé Et ainsi de suite pour les autres! Vous l'aurez compris, changez le [1] pour la ligne ci-dessus par le numéro de l'interrupteur a partir du quel, dans le menu PHS on pourra choisir le perso dont l'Id est dit avant.
Je coirs que c'était clair, mais si jamais vous n'y arrivez pas, dites le moi! Si vous voulez, je vous ferez un tuto/script pour mettre l'options PHS dans le menu ;) Voila! Pour l'appeler: $scene = Scene_Party_in.new ++
EDIT: Me suis gourer, en postant le scrit j'ai mis tout le long suite ci-dessus mais c'est suite ci-dessous^^
Dernière édition par le Dim 6 Mai - 13:12, édité 1 fois | |
| | | Luck > Administrateur
Nombre de messages : 507 Age : 31 Localisation : 35 Avez vous RPGMXP ? : Oui Quels sont vos projets ? : Nightmares of Apocalypsia - Mario Kart XP Date d'inscription : 17/11/2006
Fiche Créateur Points de Créativité: (50/50) Commentaires:
| Sujet: Re: Script PHS (Changer de persos) Dim 6 Mai - 12:44 | |
| Pas grave ... pour le partage du script et le temps que tu as mis pour poster, je te donne deux PA. | |
| | | Contenu sponsorisé
| Sujet: Re: Script PHS (Changer de persos) | |
| |
| | | | Script PHS (Changer de persos) | |
|
Sujets similaires | |
|
| Permission de ce forum: | Vous ne pouvez pas répondre aux sujets dans ce forum
| |
| |
| |