设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2381|回复: 6
打印 上一主题 下一主题

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
484
在线时间
24 小时
注册时间
2020-8-15
帖子
10
跳转到指定楼层
1
发表于 2020-8-29 13:52:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我使用了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
  
萌新一枚

Lv2.观梦者

梦石
0
星屑
484
在线时间
24 小时
注册时间
2020-8-15
帖子
10
2
 楼主| 发表于 2020-8-29 13:56:30 | 只看该作者
不知道为什么一直在上传文件时显示“server(IO)error”后失败,,只能这样发出来了。。抱歉

点评

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

评分

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

查看全部评分

萌新一枚
回复 支持 反对

使用道具 举报

Lv2.观梦者

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

奥.7z

284.87 KB, 下载次数: 56

萌新一枚
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2089
在线时间
80 小时
注册时间
2018-6-29
帖子
19

R考场第七期纪念奖

4
发表于 2020-8-30 23:57:24 | 只看该作者
改过的地方加了注释,对照一下就能看出来
RUBY 代码复制
  1. class Game_Party
  2.   attr_reader   :actors2
  3.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  4.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  5.   def initialize
  6.     @actors = []
  7.     @gold = 0
  8.     @steps = 0
  9.     @items = {}
  10.     @weapons = {}
  11.     @armors = {}
  12.     @actors2 = []
  13.     @chaochao = []
  14.     @chaochao2 = []
  15.   end
  16.  
  17.  
  18.   #add变成了add(actor_id)(宝箱君)
  19.    def add(actor_id)
  20.    if $game_actors[actor_id] != nil
  21.         actor = $game_actors[actor_id]
  22.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  23.         #向备用角色中添加角色
  24.         if @actors2.push(actor) and not @actors2.include?(actor)
  25.           $game_player.refresh
  26.         end
  27.     end
  28.   end
  29.   #以上是我添加的
  30.  
  31.  
  32.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  33.     case type
  34.     when 1
  35.       if $game_actors[actor_id] != nil
  36.         actor = $game_actors[actor_id]
  37.         #如果队伍没有满和队伍中没有此角色
  38.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  39.           @actors.push(actor)
  40.           $game_player.refresh
  41.         else
  42.          #如果队伍全满和队伍中没有此角色(宝箱君)
  43.          if not @actors.include?(actor) and not @actors2.include?(actor)
  44.          add(actor_id)
  45.          end
  46.         end
  47.       #分割线===========(宝箱君)
  48.       end
  49.     when 2
  50.       if $game_actors[actor_id] != nil
  51.         actor = $game_actors[actor_id]
  52.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  53.         #向备用角色中添加角色
  54.         if @actors2.push(actor) and not @actors2.include?(actor)
  55.           $game_player.refresh
  56.         end
  57.       end
  58.     end
  59.   end

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
484
在线时间
24 小时
注册时间
2020-8-15
帖子
10
5
 楼主| 发表于 2020-8-31 23:07:54 | 只看该作者
1103123301 发表于 2020-8-30 23:57
改过的地方加了注释,对照一下就能看出来
class Game_Party
  attr_reader   :actors2

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

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-26 09:09

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表