赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 12801 |
最后登录 | 2025-3-12 |
在线时间 | 243 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 105
- 在线时间
- 243 小时
- 注册时间
- 2014-9-14
- 帖子
- 38
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
怎么不通过打开仓库的方式
把人物移动至仓库
例如:
我想要队伍人数为8 当队伍为8人时 后面加入的都直接进仓库- #------------------------------------------------------------------------------#
- # 人物仓库
- #------------------------------------------------------------------------------#
- # 适用: RPGMAKER VX ACE
- # 版本: 1.1
- # 作者:66RPG的tan12345
- #-------------------------------------------------------------------------------
- # 人物仓库,也可以理解为宠物仓库,可以将角色从队伍存入到仓库。
- # 本脚本大量参考了Galv's的Army Manager脚本,界面的绘制可以说是直接参照着
- # Galv's的Army Manager来绘制的。
- # 使用方法:将脚本插入至main以上
- # 呼出时,请调用:SceneManager.call(Scene_Party2)
- #-------------------------------------------------------------------------------
- module PARTY2
- #设定命令,可以自行加入
- CMDS = {
- #命令ID,队伍显示的命令,执行内容,显示图标
- :sw => ["切换仓库","切换队伍", :sw, 187],
- :status => ["查看状态","查看状态", :Scene_Party2_Status,236],
- :skill => ["查看技能","查看技能", :Scene_Party2_Skill, 236],
- :in_out => ["存入仓库","放入队伍", :in_out, 187],
- :dismiss => ["宠物放生","宠物放生", :dismiss, 187],
- }
- #不能存入仓库的角色ID
- NO_INPARTY2 = [1]
- #不能放生的角色ID
- NO_DISMISS = [1]
- #仓库最大限制
- PARTY2MAX = 50
- #队伍人数最大限制
- PARTY1MAX = 8
- end
- module SceneManager
- def self.party2call(scene_class)
- @stack.push(@scene)
- @scene = Kernel.const_get(scene_class).new
- end
- end
- class Game_Party < Game_Unit
- attr_accessor :last_party1
- attr_accessor :last_party2
- attr_accessor :party2
- attr_accessor :inparty
-
- alias tan_party2_initialize initialize
- def initialize
- tan_party2_initialize
- #@last_party1 = nil
- #@last_party2 = nil
- @party2 = []
- @inparty = true
- end
- #--------------------------------------------------------------------------
- # ● 加入仓库
- #--------------------------------------------------------------------------
- def party2_add_actor(actor_id)
- @party2.push(actor_id) unless @party2.include?(actor_id)
- end
- #--------------------------------------------------------------------------
- # ● 从仓库取出
- #--------------------------------------------------------------------------
- def party2_remove_actor(actor_id,a = false)
- if a#清除数据
- @party2.delete(actor_id)
- $data_actors[actor_id] = nil
- else#普通取出
- @party2.delete(actor_id)
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取仓库所有成员
- #--------------------------------------------------------------------------
- def party2_all_members
- @party2.collect {|id| $game_actors[id] }
- end
- end
- #--------------------------------------------------------------------------
- # ● 总界面
- #--------------------------------------------------------------------------
- class Scene_Party2 < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 创建窗口
- #--------------------------------------------------------------------------
- def start
- super
- create_party1_window
- create_party2_window
- create_command_window
- create_face_window
- end
- #--------------------------------------------------------------------------
- # ● 队伍窗口设定
- #--------------------------------------------------------------------------
- def create_party1_window
- ww = Graphics.width / 5 * 2
- wh = Graphics.height
- @party1_window = Window_Party1.new(0,0,ww,wh)
- @party1_window.viewport = @viewport
- @party1_window.activate if $game_party.inparty == true
- @party1_window.set_handler(:ok, method(:on_party1_ok))
- @party1_window.set_handler(:cancel, method(:return_scene1))
- end
- #--------------------------------------------------------------------------
- # ● 仓库窗口设定
- #--------------------------------------------------------------------------
- def create_party2_window
- wx = Graphics.width / 5 * 2
- ww = Graphics.width / 5 * 3
- wh = Graphics.height
- @party2_window = Window_Party2.new(wx,0,ww,wh)
- @party2_window.viewport = @viewport
- @party2_window.activate if $game_party.inparty == false
- @party2_window.set_handler(:ok, method(:on_party2_ok))
- @party2_window.set_handler(:cancel, method(:return_scene2))
- end
- #--------------------------------------------------------------------------
- # ● 命令窗口设定
- #--------------------------------------------------------------------------
- def create_command_window
- wx = Graphics.width / 2
- wy = Graphics.height / 2
- @command_window = Window_Party2Command.new(wx + 10,wy)
- @command_window.viewport = @viewport
- PARTY2::CMDS.each { |cmd|
- handle = cmd[1][2]#.delete(' ').downcase.to_sym
- @command_window.set_handler(handle, method(:cmd))
- }
- @command_window.set_handler(:cancel, method(:back_to_myscene))
- @command_window.y -= @command_window.height
- @command_window.hide.deactivate
- end
- #--------------------------------------------------------------------------
- # ● 脸图窗口设定
- #--------------------------------------------------------------------------
- def create_face_window
- ww = @command_window.width
- wh = @command_window.height
- wx = @command_window.x
- wy = @command_window.y
- @face_window = Window_Party2Face.new(wx,wy,ww,wh)
- @face_window.viewport = @viewport
- @face_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 命令窗口命令初始化
- #--------------------------------------------------------------------------
- def cmd
- list = PARTY2::CMDS.to_a
- cmd = @command_window.index
- symbol = list[cmd][1][2]
- if custom_action(symbol)
- custom_on_command_ok(symbol)
- else
- SceneManager.party2call(list[cmd][1][2])
- end
- end
-
- def custom_action(symbol)
- case symbol
- when :dismiss,:sw,:in_out
- return true
- else
- return false
- end
- end
-
- def custom_on_command_ok(symbol)
- case symbol
- when :dismiss
- do_dismiss
- when :sw
- do_sw
- when :in_out
- do_in_out
- end
- end
- def terminate
- super
- end
-
- def update
- super
- end
-
- #--------------------------------------------------------------------------
- # ● 队伍窗口:确定
- #--------------------------------------------------------------------------
- def on_party1_ok
- $game_party.last_party1 = @party1_window.select_actor
- @command_window.refresh
- @face_window.refresh
- @command_window.show.activate
- @face_window.show.activate
- end
- #--------------------------------------------------------------------------
- # ● 队伍窗口:取消
- #--------------------------------------------------------------------------
- def return_scene1
- $game_party.last_party1 = nil
- $game_party.last_party2 = nil
- $game_party.inparty = true
- SceneManager.return
- end
- #--------------------------------------------------------------------------
- # ● 仓库窗口:确定
- #--------------------------------------------------------------------------
- def on_party2_ok
- $game_party.last_party2 = @party2_window.select_actor
- @command_window.refresh
- @face_window.refresh
- @command_window.show.activate
- @face_window.show.activate
- end
- #--------------------------------------------------------------------------
- # ● 仓库窗口:取消
- #--------------------------------------------------------------------------
- def return_scene2
- do_sw
- end
- #--------------------------------------------------------------------------
- # ● 命令窗口:取消
- #--------------------------------------------------------------------------
- def back_to_myscene
- @command_window.hide.deactivate
- @face_window.hide
- if $game_party.inparty == true
- @party1_window.activate
- else
- @party2_window.activate
- end
- end
- #--------------------------------------------------------------------------
- # ● 命令窗口:切换
- #--------------------------------------------------------------------------
- def do_sw
- if $game_party.inparty == true
- $game_party.inparty = false
- @command_window.hide.deactivate
- @face_window.hide
- @party2_window.activate
- else
- $game_party.inparty = true
- @command_window.hide.deactivate
- @face_window.hide
- @party1_window.activate
- end
- end
- #--------------------------------------------------------------------------
- # ● 命令窗口:存入、取出
- #--------------------------------------------------------------------------
- def do_in_out
- if $game_party.inparty == true
- #存入仓库
- $game_party.party2_add_actor(@party1_window.select_actor.id)
- $game_party.remove_actor(@party1_window.select_actor.id)
- @command_window.hide.deactivate
- @face_window.hide
- @party1_window.refresh
- @party2_window.refresh
- @party1_window.activate
- else
- #取出
- $game_party.add_actor(@party2_window.select_actor.id)
- $game_party.party2_remove_actor(@party2_window.select_actor.id)
- if $game_party.party2_all_members.count <= 0
- @party1_window.refresh
- @party2_window.refresh
- do_sw
- else
- @command_window.hide.deactivate
- @face_window.hide
- @party1_window.refresh
- @party2_window.refresh
- @party2_window.activate
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 命令窗口:放生
- #--------------------------------------------------------------------------
- def do_dismiss
- if $game_party.inparty == true
- $game_party.tan_remove_actor(@party1_window.select_actor.id,true)
- @command_window.hide.deactivate
- @face_window.hide
- @party1_window.refresh
- @party1_window.activate
- else
- $game_party.party2_remove_actor(@party2_window.select_actor.id,true)
- @command_window.hide.deactivate
- @face_window.hide
- @party2_window.refresh
- @party2_window.activate
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 队伍窗口
- #--------------------------------------------------------------------------
- class Window_Party1 < Window_Selectable
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @data = []
- @last_index ||= 0
- @animtime = 0
- @walk = 0
- refresh
- select_last
- end
-
- def item_width
- (width - standard_padding * 2 + spacing) / col_max - spacing
- end
- def item_height; item_width; end
- def spacing; return 1; end
- def col_max; return 2; end
- def item_max; @data ? @data.size : 1; end
- def select_actor; @data && index >= 0 ? @data[index] : nil; end
-
- def current_item_enabled?
- enable?(@data[index])
- end
- def enable?(actor)
- return false if !actor
- return true
- end
-
- def include?(actor)
- return false if actor.nil?
- return true
- end
-
- def make_item_list
- @data = $game_party.members.select {|actor| include?(actor) }
- @data.push(nil) if include?(nil)
- end
-
- def select_last
- select(@data.index($game_party.last_party1) || 0)
- end
-
- def actor_rect(index)
- rect = Rect.new
- rect.width = item_width
- rect.height = item_height
- rect.x = index % col_max * (item_width + spacing)
- rect.y = index / col_max * item_height
- rect
- end
-
- def offset
- Graphics.height < 480 ? 0 : 10
- end
-
- def draw_item(index)
- actor = @data[index]
- if actor
- rect = actor_rect(index)
- rect.width -= 4
- draw_actor_text(actor,rect.x + 2,rect.y + 38 + offset, enable?(actor),
- rect.width)
- draw_character(actor.character_name, actor.character_index,
- rect.x + item_width / 1.6 - 1, rect.y + 38 + offset,
- enable?(actor),index)
- end
- end
-
- def draw_actor_text(actor, x, y, enabled = true, w)
- return unless actor
- #icon1 = get_icon(:actor,actor)
- #icon2 = get_icon(:weapon,actor)
- #draw_icon(icon1, x + 6, y - 20, enabled)
- #draw_icon(icon2, x + 6, y - 20, enabled)
- change_color(normal_color, enabled)
- contents.font.size = 18
- draw_text(x, y, w, line_height, actor.name,1)
- contents.font.size = 16
- lvl = Vocab::level_a + actor.level.to_s
- cname = actor.class.name
- draw_text(x + 10, y - 40, w, line_height, lvl,0)
- draw_text(x, y + 16, w, line_height, cname,1)
- end
-
- def draw_character(character_name, character_index, x, y,enabled,i)
- return unless character_name
- bitmap = Cache.character(character_name)
- sign = character_name[/^[\!\$]./]
- if sign && sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = character_index
- step = 0
- step = @walk if enabled && i == index
- src_rect = Rect.new((n%4*3+1+step)*cw, (n/4*4)*ch, cw, ch)
- contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 150)
- end
-
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
-
- def update
- super
- update_walk
- redraw_item(index)
- end
-
- def update_walk
- @animtime += 1
- if @animtime == 10
- case @walk
- when 1; @walk -= 1
- when -1; @walk += 1
- when 0
- if @step == 1
- @walk = -1; @step = 0
- else
- @walk = 1; @step = 1
- end
- end
- @animtime = 0
- end
- end
-
- def cursor_down(wrap = false); super; cursor_move_extras; end
- def cursor_up(wrap = false); super; cursor_move_extras; end
- def cursor_left(wrap = false); super; cursor_move_extras; end
- def cursor_right(wrap = false); super; cursor_move_extras; end
-
- def cursor_move_extras
- @walk = 0
- @animtime = 0
- redraw_item(@last_index)
- @last_index = index
- end
- end
- #--------------------------------------------------------------------------
- # ● 仓库窗口
- #--------------------------------------------------------------------------
- class Window_Party2 < Window_Selectable
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @data = []
- @last_index ||= 0
- @animtime = 0
- @walk = 0
- refresh
- select_last
- end
-
- def item_width
- (width - standard_padding * 2 + spacing) / col_max - spacing
- end
- def item_height; item_width; end
- def spacing; return 1; end
- def col_max; return 3; end
- def item_max; @data ? @data.size : 0; end
- def select_actor; @data && index >= 0 ? @data[index] : nil; end
-
- def current_item_enabled?
- enable?(@data[index])
- end
- def enable?(actor)
- return false if !actor
- return true
- end
-
- def include?(actor)
- return false if actor.nil?
- return true
- end
-
- def make_item_list
- @data = $game_party.party2_all_members.select {|actor| include?(actor) }
- @data.push(nil) if include?(nil)
- end
-
- def select_last
- select(@data.index($game_party.last_party2) || 0)
- end
-
- def actor_rect(index)
- rect = Rect.new
- rect.width = item_width
- rect.height = item_height
- rect.x = index % col_max * (item_width + spacing)
- rect.y = index / col_max * item_height
- rect
- end
-
- def offset
- Graphics.height < 480 ? 0 : 10
- end
-
- def draw_item(index)
- actor = @data[index]
- if actor
- rect = actor_rect(index)
- rect.width -= 4
- draw_actor_text(actor,rect.x + 2,rect.y + 38 + offset, enable?(actor),
- rect.width)
- draw_character(actor.character_name, actor.character_index,
- rect.x + item_width / 1.6 - 1, rect.y + 38 + offset,
- enable?(actor),index)
- end
- end
-
- def draw_actor_text(actor, x, y, enabled = true, w)
- return unless actor
- #icon1 = get_icon(:actor,actor)
- #icon2 = get_icon(:weapon,actor)
- #draw_icon(icon1, x + 6, y - 20, enabled)
- #draw_icon(icon2, x + 6, y - 20, enabled)
- change_color(normal_color, enabled)
- contents.font.size = 18
- draw_text(x, y, w, line_height, actor.name,1)
- contents.font.size = 16
- lvl = Vocab::level_a + actor.level.to_s
- cname = actor.class.name
- draw_text(x + 10, y - 40, w, line_height, lvl,0)
- draw_text(x, y + 16, w, line_height, cname,1)
- end
-
- def draw_character(character_name, character_index, x, y,enabled,i)
- return unless character_name
- bitmap = Cache.character(character_name)
- sign = character_name[/^[\!\$]./]
- if sign && sign.include?(')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = character_index
- step = 0
- step = @walk if enabled && i == index
- src_rect = Rect.new((n%4*3+1+step)*cw, (n/4*4)*ch, cw, ch)
- contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 150)
- end
-
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
-
- def update
- super
- update_walk
- redraw_item(index)
- end
-
- def update_walk
- @animtime += 1
- if @animtime == 10
- case @walk
- when 1; @walk -= 1
- when -1; @walk += 1
- when 0
- if @step == 1
- @walk = -1; @step = 0
- else
- @walk = 1; @step = 1
- end
- end
- @animtime = 0
- end
- end
-
- def cursor_down(wrap = false); super; cursor_move_extras; end
- def cursor_up(wrap = false); super; cursor_move_extras; end
- def cursor_left(wrap = false); super; cursor_move_extras; end
- def cursor_right(wrap = false); super; cursor_move_extras; end
-
- def cursor_move_extras
- @walk = 0
- @animtime = 0
- redraw_item(@last_index)
- @last_index = index
- end
- end
- #--------------------------------------------------------------------------
- # ● 命令窗口
- #--------------------------------------------------------------------------
- class Window_Party2Command < Window_Command
- def initialize(x,y)
- super(x,y)
- self.opacity = 255
- self.back_opacity = 255
- end
-
- def window_width; return 160; end
- def visible_line_number; item_max; end
-
- def make_command_list
- @cmd_index = []
- PARTY2::CMDS.each { |cmd|
- if $game_party.inparty == true
- text = cmd[1][0]
- else
- text = cmd[1][1]
- end
- handle = cmd[1][2]#.delete(' ').downcase.to_sym
- add_command(text,handle,check_enabled(cmd[0]))
- @cmd_index << cmd[0]
- }
- end
-
- def check_enabled(cmd)
- if $game_party.inparty == true
- actor = $game_party.last_party1
- if actor == nil
- return false
- else
- return false if cmd == :in_out && PARTY2::NO_INPARTY2.include?(actor.id)#不能存入仓库的角色ID
- return false if cmd == :dismiss && PARTY2::NO_DISMISS.include?(actor.id)#不能离队的角色
- end
- return false if cmd == :in_out && $game_party.members.count <= 1#队伍不能为空:最后一人不能存入仓库
- return false if cmd == :dismiss && $game_party.members.count <= 1#队伍不能为空:最后一人不能放生
- return false if cmd == :in_out && $game_party.party2_all_members.count >= PARTY2::PARTY2MAX#仓库已满
- return false if cmd == :sw && $game_party.party2_all_members.count <= 0#仓库为空不能切换
- else
- actor = $game_party.last_party2
- if actor == nil
- return false
- else
- return false if cmd == :dismiss && PARTY2::NO_DISMISS.include?(actor.id)#不能离队的角色
- end
- return false if cmd == :in_out && $game_party.all_members.count >= PARTY2::PARTY1MAX#队伍已满
- end
- return true
- end
-
- def draw_item(index)
- change_color(normal_color, command_enabled?(index))
- recti = item_rect_for_text(index)
- recti.x += 26
- draw_text(recti, command_name(index), alignment)
- draw_icon(PARTY2::CMDS[@cmd_index[index]][3],0,recti.y)
- end
- end
- #--------------------------------------------------------------------------
- # ● 脸图窗口
- #--------------------------------------------------------------------------
- class Window_Party2Face < Window_Base
- def initialize(x,y,w,h)
- super(x - w,y,w,h)
- self.opacity = 255
- self.back_opacity = 255
- end
- def draw_cont
- fy = (contents.height - 96) / 2
- fx = (contents.width - 96) / 2
- if $game_party.inparty == true
- draw_actor_face($game_party.last_party1, fx, fy)
- else
- draw_actor_face($game_party.last_party2, fx, fy)
- end
- end
- def refresh
- contents.clear
- draw_cont
- end
- end
复制代码 |
|