查看: 3077|回复: 6

[已经解决] 有关chaochao的人物仓库脚本的一些修改问题。。。。

[复制链接]
梦石
0
星屑
484
在线时间
24 小时
注册时间
2020-8-15
回帖
7
发表于 2020-8-29 13:52:53 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
我使用了chaochao大佬的人物仓库脚本,但是我发现当队伍满人时,往队伍里继续添加人物不会加入仓库了。。
所以我就自己往里面加入了一段判断,,但是没有用,,能不能请大佬指点一下!拜托了!
擦。。发现没法上传图片。。显示 Server (IO) Error。。
以下是

class Game_Party
  attr_reader   :actors2
  attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  def initialize
    @actors = []
    @gold = 0
    @steps = 0
    @items = {}
    @weapons = {}
    @armors = {}
    @actors2 = []
    @chaochao = []
    @chaochao2 = []
  end
  
  
  #
   def add
   if $game_actors[actor_id] != nil
        actor = $game_actors[actor_id]
        #如果角色不在队伍中和不在备用角色队伍中的情况下
        #向备用角色中添加角色
        if @actors2.push(actor) and not @actors2.include?(actor)
          $game_player.refresh
        end
    end
  end
  #以上是我添加的
  
  
  def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
    case type
    when 1
      if $game_actors[actor_id] != nil
        actor = $game_actors[actor_id]
        #如果队伍没有满和队伍中没有此角色
        if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
          @actors.push(actor)
          $game_player.refresh
        end
      end
    when 2
      if $game_actors[actor_id] != nil
        actor = $game_actors[actor_id]
        #如果角色不在队伍中和不在备用角色队伍中的情况下
        #向备用角色中添加角色
        if @actors2.push(actor) and not @actors2.include?(actor)
          $game_player.refresh
        end
      end
    end
  end

  def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
    actor = $game_actors[index]
    case type
    when 1
      if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
        @actors.push(actor)
        @actors2.delete(actor)
        $game_system.se_play($data_system.decision_se)
        $game_player.refresh
      end
    when 2
      if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
        @actors2.push(actor)
        @actors.delete(actor)
        $game_system.se_play($data_system.decision_se)
        $game_player.refresh
      end
    end
  end
  
  #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  #type2,1是添加不能移动的,2是删除不能移动的。
  def yidong(actor_id,type1,type2=1)
    case type2
    when 1
      case type1
      when 1
        @chaochao.push(actor_id)
      when 2
        @chaochao2.push(actor_id)
      end
    when 2
      case type1
      when 1
        @chaochao.delete(actor_id)
      when 2
        @chaochao2.delete(actor_id)
      end
    end
  end
  
萌新一枚
梦石
0
星屑
484
在线时间
24 小时
注册时间
2020-8-15
回帖
7
 楼主| 发表于 2020-8-29 13:56:30 | 显示全部楼层
不知道为什么一直在上传文件时显示“server(IO)error”后失败,,只能这样发出来了。。抱歉

点评

可能是等级太低?我先帮你升到2级  发表于 2020-8-29 21:34

评分

参与人数 1星屑 +200 收起 理由
guoxiaomi + 200 塞糖

查看全部评分

萌新一枚
回复

使用道具 举报

梦石
0
星屑
484
在线时间
24 小时
注册时间
2020-8-15
回帖
7
 楼主| 发表于 2020-8-30 12:10:54 | 显示全部楼层
这是我的工程。。希望大佬能看一下。。(我发现我这电脑只要是360的浏览器就上传文件失败,,,一换搜狗就好了)

奥.7z

284.87 KB, 下载次数: 56

萌新一枚
回复

使用道具 举报

梦石
0
星屑
2782
在线时间
140 小时
注册时间
2018-6-29
回帖
19

R考场第七期纪念奖

发表于 2020-8-30 23:57:24 | 显示全部楼层
改过的地方加了注释,对照一下就能看出来
[pre lang="ruby" line="1"]class Game_Party
  attr_reader   :actors2
  attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  def initialize
    @actors = []
    @gold = 0
    @steps = 0
    @items = {}
    @weapons = {}
    @armors = {}
    @actors2 = []
    @chaochao = []
    @chaochao2 = []
  end
  
  
  #add变成了add(actor_id)(宝箱君)
   def add(actor_id)
   if $game_actors[actor_id] != nil
        actor = $game_actors[actor_id]
        #如果角色不在队伍中和不在备用角色队伍中的情况下
        #向备用角色中添加角色
        if @actors2.push(actor) and not @actors2.include?(actor)
          $game_player.refresh
        end
    end
  end
  #以上是我添加的
  
  
  def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
    case type
    when 1
      if $game_actors[actor_id] != nil
        actor = $game_actors[actor_id]
        #如果队伍没有满和队伍中没有此角色
        if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
          @actors.push(actor)
          $game_player.refresh
        else
         #如果队伍全满和队伍中没有此角色(宝箱君)
         if not @actors.include?(actor) and not @actors2.include?(actor)
         add(actor_id)
         end
        end
      #分割线===========(宝箱君)
      end
    when 2
      if $game_actors[actor_id] != nil
        actor = $game_actors[actor_id]
        #如果角色不在队伍中和不在备用角色队伍中的情况下
        #向备用角色中添加角色
        if @actors2.push(actor) and not @actors2.include?(actor)
          $game_player.refresh
        end
      end
    end
  end[/pre]

评分

参与人数 1星屑 +100 赞 +1 收起 理由
RyanBern + 100 + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
484
在线时间
24 小时
注册时间
2020-8-15
回帖
7
 楼主| 发表于 2020-8-31 23:07:54 | 显示全部楼层
1103123301 发表于 2020-8-30 23:57
改过的地方加了注释,对照一下就能看出来
class Game_Party
  attr_reader   :actors2

谢谢大佬!!!问题已经解决!
萌新一枚
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部