我倒,真的假的,我是新建个工程,然后把这2个放上去,发现没错才发的啊,还有错误不是我的问题吧,你出现的是哪的错误啊,晕死了 |
本帖最后由 巧克力猫咪 于 2010-10-20 18:16 编辑 |
本帖最后由 巧克力猫咪 于 2010-10-20 17:34 编辑 回复 反斗奇彬 的帖子 插入脚本$scene = Scene_PartyChanger.new,不过这个的话有点BUG # 1.系统呼出命令: $scene = Scene_Party.new # 2.队员锁定命令: $game_party.members[0].actor.required = true # (其中数字0表示1号队员在队伍中锁定而无法进入仓库,1即为2号队员,以此类推) # 3.队员加入仓库命令: $data_actors[5].found = true # (其中数字5表示5号队员直接进入仓库等待招募而不加入队伍,当队伍满员时使用此命令) # 4.队员踢除仓库命令: $data_actors[5].found = false # (其中数字5表示将呆在仓库里的5号队员清除,该命令用于离开的队员) # 5.队员加入仓库但无法被招募:$data_actors[8].found = true # $data_actors[8].unavailable = true # (其中数字8表示8号队员# 直接进入仓库但无法被招募,该命令用于俘虏类) # 6.仓库里无法招募的队员启动命令: $data_actors.each do |a| # a.unavailable = false if a # end # (该命令作为第5项命令的补充,使所有仓库里无法被招募的队员重启为可招募状态) # 7.全体队员进入仓库: $data_actors.each do |a| # a.found = true if a # nd # (该命令使所有队员进入仓库等待招募,在队伍 中的队员不受影响) # 队员管理脚本(v1.1c) module RPG class Actor def setup @found = false @unavailable = false @required = false end attr_accessor :found attr_accessor :unavailable attr_accessor :required end end class Game_Actors attr_reader :data alias prex_party_g_actors_initialize initialize def initialize prex_party_g_actors_initialize $data_actors.each do |actor| actor.setup if actor @data[actor.id] = Game_Actor.new(actor.id) if actor end end end class Scene_File < Scene_Base alias prex_party_s_file_write_save_data write_save_data alias prex_party_s_file_read_save_data read_save_data def write_save_data(file) prex_party_s_file_write_save_data(file) Marshal.dump($data_actors, file) end def read_save_data(file) prex_party_s_file_read_save_data(file) $data_actors = Marshal.load(file) end end class Scene_Title < Scene_Base alias prex_party_s_title_command_new_game command_new_game def command_new_game prex_party_s_title_command_new_game $game_party.members.each {|s| s.actor.found = true if s} end end class Window_Base < Window def draw_item_name(item, x, y, enabled = true, width = 172) if item != nil draw_icon(item.icon_index, x, y, enabled) self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, width, WLH, item.name) end end end class Scene_Party < Scene_Base def start super create_menu_background create_windows end def create_windows @member_window = Window_CurrentMember.new @party_window = Window_CurrentParty.new @party_window.active = true @selectable_window = Window_SelectMember.new end def update_windows @member_window.update @party_window.update @selectable_window.update if @party_window.active @member_window.set_member(@party_window.member) elsif @selectable_window.active @member_window.set_member(@selectable_window.member) end end def terminate super @member_window.dispose @party_window.dispose @selectable_window.dispose end def update super update_windows update_input end def update_input if Input.trigger?(Input::A) if @member_window.mode == 1 @member_window.set_mode(0) elsif @member_window.mode == 0 @member_window.set_mode(1) end end if @party_window.active if Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Map.new elsif Input.trigger?(Input::C) member = @party_window.member if member != nil if member.actor.unavailable or member.actor.required Sound.play_buzzer return end end Sound.play_decision @party_window.active = false @selectable_window.active = true @selectable_window.index = 0 end elsif @selectable_window.active if Input.trigger?(Input::B) Sound.play_cancel @selectable_window.index = -1 @selectable_window.active = false @party_window.active = true elsif Input.trigger?(Input::C) member = @selectable_window.member if member != nil if member.actor.unavailable Sound.play_buzzer return end end Sound.play_decision $game_party.remove_actor(@party_window.member.id) if @party_window.member != nil $game_party.add_actor(@selectable_window.member.id) if @selectable_window.member != nil @selectable_window.refresh @party_window.refresh @selectable_window.index = -1 @selectable_window.active = false @party_window.active = true end end end end class Window_CurrentMember < Window_Base attr_reader :mode def initialize(member = nil, mode = 0) super(304, 80, 192, 256) create_contents @member = member @mode = 0 refresh end def member return @member end def set_member(member) old_member = @member @member = member refresh if old_member != @member end def set_mode(mode) @mode = mode if [0, 1].include?(mode) refresh end def refresh self.contents.clear return unless @member x, y = 0, 0 self.draw_actor_name(@member, x + 100, y) self.draw_actor_class(@member, x + 100, y + WLH) self.draw_actor_level(@member, x + 103, y + WLH*2) case @mode when 0 self.draw_actor_face(@member, x, y, 96) #**** self.draw_actor_hp(@member, x, y + WLH*3, 160) self.draw_actor_mp(@member, x, y + WLH*4, 160) self.draw_actor_parameter(@member, x, y + WLH*5, 0) self.draw_actor_parameter(@member, x, y + WLH*6, 1) self.draw_actor_parameter(@member, x, y + WLH*7, 2) self.draw_actor_parameter(@member, x, y + WLH*8, 3) when 1 self.draw_actor_face(@member, x, y, 96) #**** for i in [email protected] item = @member.equips self.draw_item_name(item, x, y + WLH*(3+i), true, self.contents.width - 24) end end end end class Window_CurrentParty < Window_Selectable def initialize super(48, 80, 256, 64) @item_max = 4 @column_max = @item_max create_contents self.index = 0 refresh end def member return $game_party.members[self.index] end def refresh for i in 0...@item_max rect = item_rect(i) self.contents.clear_rect(rect) end for i in 0...$game_party.members.size rect = item_rect(i) bitmap = Cache.character($game_party.members.character_name) sign = $game_party.members.character_name[/^[\!\$]./] if sign != nil and sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = $game_party.members.character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) if $game_party.members.actor.unavailable self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128) else self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255) end if $game_party.members.actor.required lock_bitmap = Cache.system("Locked") self.contents.blt(rect.x + rect.width - lock_bitmap.width, rect.y + rect.height - lock_bitmap.height, lock_bitmap, lock_bitmap.rect) end end end def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = (contents.width + @spacing) / @column_max - @spacing rect.height = 32 rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * 32 return rect end end class Window_SelectMember < Window_Selectable def initialize super(48, 144, 256, 192) calculate_actors @item_max = @actors.size + 1 @column_max = 4 self.index = -1 self.active = false refresh end def calculate_actors @actors = [] for a in $game_actors.data @actors << a if a != nil and a.actor.found and !$game_party.members.include?(a) end end def member return @actors[self.index] end def refresh self.contents.clear calculate_actors @item_max = @actors.size + 1 for i in [email protected] rect = item_rect(i) bitmap = Cache.character(@actors.character_name) sign = @actors.character_name[/^[\!\$]./] if sign != nil and sign.include?('$') cw = bitmap.width / 3 ch = bitmap.height / 4 else cw = bitmap.width / 12 ch = bitmap.height / 8 end n = @actors.character_index src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch) if @actors.actor.unavailable self.contents.blt(rect.x, rect.y, bitmap, src_rect, 128) else self.contents.blt(rect.x, rect.y, bitmap, src_rect, 255) end if @actors.actor.required lock_bitmap = Cache.system("Locked") self.contents.blt(rect.x + rect.width - lock_bitmap.width, rect.y + rect.height - lock_bitmap.height, lock_bitmap, lock_bitmap.rect) end end end def item_rect(index) rect = Rect.new(0, 0, 0, 0) rect.width = (contents.width + @spacing) / @column_max - @spacing rect.height = 32 rect.x = index % @column_max * (rect.width + @spacing) rect.y = index / @column_max * 32 return rect end end 我个人建议,这个比较好,至少我喜欢用这个 |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-15 10:07
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.