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

Project1

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

[已经解决] 这个人物仓库怎么设置一个角色不能放入仓库

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
135 小时
注册时间
2013-8-7
帖子
79
跳转到指定楼层
1
发表于 2013-10-5 16:14:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
RUBY 代码复制
  1. #==============================================================================
  2. # ■ chaochao的人物仓库ver1.02正式版
  3. # 修改了Game_Party
  4. # 功能:
  5. # 用来存放角色的仓库……
  6. # 召唤画面用$scene = Chaochao_Scene_Party.new
  7. # 其它使用说明在代码里已经备注。
  8. #------------------------------------------------------------------------------
  9. # 作者:chaochao
  10. # [url]http://zhuchao.go1.icpcn.com[/url]
  11. #==============================================================================
  12. class Chaochao_Window_PartyLeft < Window_Selectable
  13.   def initialize
  14.     super(0, 0, 320, 224)
  15.     self.contents = Bitmap.new(width - 32, height - 32)
  16.     self.index = 0
  17.     refresh
  18.   end
  19.   def actor
  20.     return @actors[self.index]
  21.   end
  22.   def refresh
  23.     if self.contents != nil
  24.       self.contents.dispose
  25.       self.contents = nil
  26.     end
  27.     @actors = []
  28.     for i in 0...$game_party.actors.size
  29.       @actors.push($game_party.actors[i])
  30.     end
  31.  
  32.     @item_max = 4
  33.     if @item_max > 0
  34.       self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
  35.       for i in 0...@item_max
  36.         draw_item(i)
  37.       end
  38.     end
  39.   end
  40.   def draw_item(index)
  41.     if @actors[index] != nil
  42.       actor = @actors[index]
  43.       text = @actors[index].name
  44.       lv = @actors[index].level.to_s + " "
  45.       if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
  46.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  47.       else
  48.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  49.       end
  50.       self.contents.draw_text(4, index * 32 + 32, 288, 32, text)
  51.       self.contents.font.color = normal_color
  52.       self.contents.font.size = 16
  53.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  "Level:   ", 2)
  54.       colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  55.       colory = [255.0000 / 60 * @actors[index].level,255].min
  56.       self.contents.font.color = Color.new(colorx, colory, 0)
  57.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  lv, 2)
  58.       self.contents.font.color = normal_color
  59.       self.contents.font.size = 22
  60.     else
  61.       self.contents.draw_text(4, index * 32 + 32, 288, 32,  "没有人物!")
  62.     end
  63.   end
  64.   def update_cursor_rect
  65.     if [url=home.php?mod=space&uid=370741]@Index[/url] < 0
  66.       self.cursor_rect.empty
  67.       return
  68.     end
  69.     row = @index / @column_max
  70.     if row < self.top_row
  71.       self.top_row = row
  72.     end
  73.     if row > self.top_row + (self.page_row_max - 1)
  74.       self.top_row = row - (self.page_row_max - 1)
  75.     end
  76.     cursor_width = self.width / @column_max - 32
  77.     x = @index % @column_max * (cursor_width + 32)
  78.     y = @index / @column_max * 32 - self.oy + 32
  79.     self.cursor_rect.set(x, y, cursor_width, 32)
  80.   end
  81.   def item_max
  82.     return @item_max
  83.   end
  84.   def actor?(index)
  85.     return @actors[index] == nil ? false : true
  86.   end
  87.   def set_index(x)
  88.     @index = x
  89.   end
  90. end
  91.  
  92. #------------------------------------------------------------------------------
  93.  
  94. class Chaochao_Window_PartyRight < Window_Selectable
  95.   def initialize
  96.     super(320, 0, 320, 224)
  97.     self.contents = Bitmap.new(width - 32, height - 32)
  98.     self.index = -1
  99.     refresh
  100.   end
  101.   def actor
  102.     return @actors[self.index]
  103.   end
  104.   def refresh
  105.     if self.contents != nil
  106.       self.contents.dispose
  107.       self.contents = nil
  108.     end
  109.     @actors = []
  110.     for i in 0...$game_party.actors2.size
  111.       @actors.push($game_party.actors2[i])
  112.     end
  113.  
  114.     @item_max = $game_party.actors2.size
  115.     if @item_max > 0
  116.       self.contents = Bitmap.new(width - 32, row_max * 32)
  117.       for i in 0...@item_max
  118.         draw_item(i)
  119.       end
  120.     elsif @item_max == 0
  121.  
  122.     end
  123.   end
  124.   def draw_item(index)
  125.     actor = @actors[index]
  126.     text = @actors[index].name
  127.     lv = @actors[index].level.to_s + " "
  128.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  129.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  130.       else
  131.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  132.       end
  133.     self.contents.draw_text(4, index * 32, 288, 32, text)
  134.     self.contents.font.color = normal_color
  135.     self.contents.font.size = 16
  136.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  "Level:   ", 2)
  137.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  138.     colory = [255.0000 / 60 * @actors[index].level,255].min
  139.     self.contents.font.color = Color.new(colorx, colory, 0)
  140.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  lv, 2)
  141.     self.contents.font.color = normal_color
  142.     self.contents.font.size = 22
  143.   end
  144.   def update_cursor_rect
  145.     if @index < 0
  146.       self.cursor_rect.empty
  147.       return
  148.     end
  149.     row = @index / @column_max
  150.     if row < self.top_row
  151.       self.top_row = row
  152.     end
  153.     if row > self.top_row + (self.page_row_max - 1)
  154.       self.top_row = row - (self.page_row_max - 1)
  155.     end
  156.     cursor_width = self.width / @column_max - 32
  157.     x = @index % @column_max * (cursor_width + 32)
  158.     y = @index / @column_max * 32 - self.oy
  159.     self.cursor_rect.set(x, y, cursor_width, 32)
  160.   end
  161.   def item_max
  162.     return @item_max
  163.   end
  164.   def actor?(index)
  165.     return @actors[index] == nil ? false : true
  166.   end
  167.   def set_index(x)
  168.     @index = x
  169.   end
  170. end
  171.  
  172. #------------------------------------------------------------------------------
  173.  
  174. class Chaochao_Window_PartyData < Window_Base
  175.  
  176.   def initialize
  177.     super(0, 224, 640, 256)
  178.     self.contents = Bitmap.new(width - 32, height - 32)
  179.     [url=home.php?mod=space&uid=95897]@actor[/url] = nil
  180.   end
  181.  
  182.   def set_actor(actor)
  183.     self.contents.clear
  184.     draw_actor_name(actor, 4, 0)
  185.     draw_actor_state(actor, 140, 0)
  186.     draw_actor_hp(actor, 284, 0)
  187.     draw_actor_sp(actor, 460, 0)
  188.     @actor = actor
  189.     self.visible = true
  190.   end
  191.   def clear
  192.     self.contents.clear
  193.   end
  194. end
  195.  
  196. #------------------------------------------------------------------------------
  197.  
  198. class Game_Party
  199.   attr_reader   :actors2
  200.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  201.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  202.   def initialize
  203.     @actors = []
  204.     [url=home.php?mod=space&uid=236945]@gold[/url] = 0
  205.     @steps = 0
  206.     @items = {}
  207.     @weapons = {}
  208.     @armors = {}
  209.     @actors2 = []
  210.     [url=home.php?mod=space&uid=9543]@chaochao[/url] = []
  211.     @chaochao2 = []
  212.   end
  213.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  214.     case type
  215.     when 1
  216.       if $game_actors[actor_id] != nil
  217.         actor = $game_actors[actor_id]
  218.         #如果队伍没有满和队伍中没有此角色
  219.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  220.           @actors.push(actor)
  221.           $game_player.refresh
  222.         end
  223.       end
  224.     when 2
  225.       if $game_actors[actor_id] != nil
  226.         actor = $game_actors[actor_id]
  227.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  228.         #向备用角色中添加角色
  229.         if not @actors.include?(actor) and not @actors2.include?(actor)
  230.           @actors2.push(actor)
  231.           $game_player.refresh
  232.         end
  233.       end
  234.     end
  235.   end
  236.  
  237.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  238.     actor = $game_actors[index]
  239.     case type
  240.     when 1
  241.       if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  242.         @actors.push(actor)
  243.         @actors2.delete(actor)
  244.         $game_system.se_play($data_system.decision_se)
  245.         $game_player.refresh
  246.       end
  247.     when 2
  248.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  249.         @actors2.push(actor)
  250.         @actors.delete(actor)
  251.         $game_system.se_play($data_system.decision_se)
  252.         $game_player.refresh
  253.       end
  254.     end
  255.   end
  256.  
  257.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  258.   #type2,1是添加不能移动的,2是删除不能移动的。
  259.   def yidong(actor_id,type1,type2=1)
  260.     case type2
  261.     when 1
  262.       case type1
  263.       when 1
  264.         @chaochao.push(actor_id)
  265.       when 2
  266.         @chaochao2.push(actor_id)
  267.       end
  268.     when 2
  269.       case type1
  270.       when 1
  271.         @chaochao.delete(actor_id)
  272.       when 2
  273.         @chaochao2.delete(actor_id)
  274.       end
  275.     end
  276.   end
  277.  
  278.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  279.   def remove_actor(actor_id,type=1)
  280.     actor = $game_actors[actor_id]
  281.     case type
  282.     when 1
  283.       @actors.delete(actor)
  284.       $game_player.refresh
  285.     when 2
  286.       @actors2.delete(actor)
  287.       $game_player.refresh
  288.     when 3
  289.       @actors.delete(actor)
  290.       @actors2.delete(actor)
  291.       $game_player.refresh
  292.     end
  293.   end
  294.  
  295.   def refresh
  296.     new_actors = []
  297.     new_actors2 = []
  298.     for i in [email]0...@actors.size[/email]
  299.       if $data_actors[@actors[i].id] != nil
  300.         new_actors.push($game_actors[@actors[i].id])
  301.       end
  302.     end
  303.     @actors = new_actors
  304.     for i in [email]0...@actors2.size[/email]
  305.       if $data_actors[@actors2[i].id] != nil
  306.         new_actors2.push($game_actors[@actors2[i].id])
  307.       end
  308.     end
  309.     @actors2 = new_actors2
  310.   end
  311. end
  312.  
  313. #------------------------------------------------------------------------------
  314.  
  315. class Chaochao_Scene_Party
  316.   def main
  317.     @left_temp_command = 0
  318.     @right_temp_command = 0
  319.     [url=home.php?mod=space&uid=263426]@temp[/url] = 0
  320.     @left_window = Chaochao_Window_PartyLeft.new
  321.     @left_window.active = true
  322.     @right_window = Chaochao_Window_PartyRight.new
  323.     @right_window.active = false
  324.     @data_window = Chaochao_Window_PartyData.new
  325.     update_data
  326.     Graphics.transition
  327.     loop do
  328.       Graphics.update
  329.       Input.update
  330.       update
  331.       if $scene != self
  332.         break
  333.       end
  334.     end
  335.     Graphics.freeze
  336.     @left_window.dispose
  337.     @right_window.dispose
  338.     @data_window.dispose
  339.   end
  340.  
  341.   def update
  342.     @left_window.update
  343.     @right_window.update
  344.     @data_window.update
  345.     update_command
  346.     update_data
  347.   end
  348.  
  349.   def update_command
  350.     if Input.trigger?(Input::B)
  351.       $game_system.se_play($data_system.cancel_se)
  352.       #画面切换
  353.       $scene = Scene_Map.new
  354.       return
  355.     end
  356.     if @left_window.active
  357.       update_left
  358.       return
  359.     end
  360.     if @right_window.active
  361.       update_right
  362.       return
  363.     end
  364.   end
  365.  
  366.   def update_left
  367.     if Input.trigger?(Input::RIGHT)
  368.       if @right_window.item_max > 0
  369.         @left_temp_command = @left_window.index
  370.         @left_window.set_index(-1)
  371.         $game_system.se_play($data_system.cursor_se)
  372.         @left_window.active = false
  373.         @right_window.active = true
  374.         @left_window.refresh
  375.         @right_window.refresh
  376.         @right_window.set_index(@right_temp_command)
  377.         return
  378.       else
  379.         $game_system.se_play($data_system.buzzer_se)
  380.         return
  381.       end
  382.     end
  383.     if Input.trigger?(Input::C)
  384.       if @left_window.active and @left_window.actor?(@left_window.index) and $game_party.actors.size > 1 and not $game_party.chaochao.include?($game_party.actors[@left_window.index].id)
  385.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  386.         @left_window.refresh
  387.         @right_window.refresh
  388.       else
  389.         $game_system.se_play($data_system.buzzer_se)
  390.       end
  391.     end
  392.     return
  393.   end
  394.  
  395.   def update_right
  396.     if Input.trigger?(Input::LEFT)
  397.       if @left_window.item_max > 0
  398.         @right_temp_command = @right_window.index
  399.         @right_window.set_index(-1)
  400.         $game_system.se_play($data_system.cursor_se)
  401.         @left_window.active = true
  402.         @right_window.active = false
  403.         @left_window.refresh
  404.         @right_window.refresh
  405.         @left_window.set_index(@left_temp_command)
  406.         return
  407.       else
  408.         $game_system.se_play($data_system.buzzer_se)
  409.         return
  410.       end
  411.     end
  412.     if Input.trigger?(Input::C)
  413.       if $game_party.actors.size >= 4
  414.         $game_system.se_play($data_system.buzzer_se)
  415.         return
  416.       end
  417.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  418.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  419.         if $game_party.actors2.size == 0
  420.           @right_temp_command = @right_window.index
  421.           @right_window.set_index(-1)
  422.           $game_system.se_play($data_system.cursor_se)
  423.           @left_window.active = true
  424.           @right_window.active = false
  425.           @left_window.refresh
  426.           @right_window.refresh
  427.           @left_window.set_index(@left_temp_command)
  428.         end
  429.         if @right_window.index > 0
  430.           @right_window.set_index(@right_window.index-1)
  431.         end
  432.         @left_window.refresh
  433.         @right_window.refresh
  434.       else
  435.         $game_system.se_play($data_system.buzzer_se)
  436.       end
  437.     end
  438.     return
  439.   end
  440.  
  441.   def update_data
  442.     if @left_window.active
  443.       if $game_party.actors[@left_window.index] != nil
  444.         @data_window.set_actor($game_party.actors[@left_window.index])
  445.       else
  446.         @data_window.clear
  447.       end
  448.       return
  449.     end
  450.     if @right_window.active
  451.       if $game_party.actors2[@right_window.index] != nil
  452.         @data_window.set_actor($game_party.actors2[@right_window.index])
  453.       else
  454.         @data_window.clear
  455.       end
  456.       return
  457.     end
  458.   end
  459. end

这个人物仓库怎么设置一个角色不能放入仓库,就是主角不可以放入人物仓库,别的人物可以

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
2
发表于 2013-10-5 16:49:33 | 只看该作者
27行
  1. @actors = []
  2. for i in 0...$game_party.actors.size
  3. if $game_party.actors.id != 1 # 1号角色不可放入仓库
  4. @actors.push($game_party.actors[i])
  5. end
  6. end
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
135 小时
注册时间
2013-8-7
帖子
79
3
 楼主| 发表于 2013-10-5 17:41:20 | 只看该作者
饿,那个,脚本我自己不会改,你能发个改好的吗

点评

做游戏不能偷懒…  发表于 2013-10-6 17:01
好吧,那谢谢你了  发表于 2013-10-5 22:06
懒也不能懒到这样,我也是脚本盲(因为鹰语不好),但至少我会用有道词典翻译对着看点,不会就求问请教,然后自己改,总不能让别人帮你改?...  发表于 2013-10-5 22:05
一个字:懒  发表于 2013-10-5 19:48
那LZ为甚么不去学学呢?简单的添加删除脚本一个小时差不多就能够学会了。  发表于 2013-10-5 18:29
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
295 小时
注册时间
2013-7-25
帖子
773
4
发表于 2013-10-6 16:39:44 | 只看该作者
我也是个脚本盲,以前话说也遇到这种问题——神奇宝贝仓库,竟然可以把小智放到仓库里!!!!!
所以最后就加了一下:
条件分歧:小智在不在背包里,如果在的话就结束,如果不在的话,标签跳转……
可勾搭
<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2::52" alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

5
发表于 2013-10-6 16:51:24 | 只看该作者
本帖最后由 chd114 于 2013-10-6 17:05 编辑
  1. if $game_party.actors.id != 1 # 1号角色不可放入仓库
  2. @actors.push($game_party.actors[i])
  3. end
复制代码
把这段去掉后可以把1号角色放进仓库···但是如果你的角色全部放进去的话在运行游戏就可能出错···
把这段脚本改成
  1. if $game_party.actors.size= 1 and $game_party.actors.id != 1  # 队伍中只有1个队员时不能放入,禁止1号角色放入
  2. @actors.push($game_party.actors[i])
  3. end
复制代码
就可以了

点评

出错了,我感觉应该在200-201行修改?大雾  发表于 2013-10-9 00:04

评分

参与人数 1星屑 +3 收起 理由
guoyq1988 + 3 塞糖

查看全部评分

[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
343
在线时间
72 小时
注册时间
2013-10-4
帖子
42
6
发表于 2013-10-6 17:10:51 | 只看该作者
路过....
我是脚本盲

评分

参与人数 1星屑 -20 收起 理由
myownroc -20 无意义灌水

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
135 小时
注册时间
2013-8-7
帖子
79
7
 楼主| 发表于 2013-10-6 20:48:06 | 只看该作者
唉,算了,总是出错
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
439 小时
注册时间
2013-3-2
帖子
710
8
发表于 2013-10-9 00:24:20 | 只看该作者
本帖最后由 guoyq1988 于 2013-10-9 00:27 编辑
RPG文笔 发表于 2013-10-6 20:48
唉,算了,总是出错


我自己改了下
楼主照我的说的改就好了,很简单
原来的脚本什么都不用改,楼上几位说的改法都错了(不是指责你们,你们也是在帮助他人,只是你们没注意看脚本,在脚本注释那里有改法,只要加个数字就可以了)

在脚本210行   @chaochao = []   的方框里写上你不想离队的人物ID即可

如一号人物不离队      @chaochao = [1]

我亲测了
图片红色名字的人物即为不可离队。。。

点评

粗心了···  发表于 2013-10-12 15:51

评分

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

查看全部评分


   
【RMXP共享】50个脚本整合的系统
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
135 小时
注册时间
2013-8-7
帖子
79
9
 楼主| 发表于 2013-10-12 18:01:06 | 只看该作者
哟西,谢谢你们

点评

礼貌是一定要懂滴  发表于 2013-10-12 21:00

评分

参与人数 1星屑 +2 收起 理由
guoyq1988 + 2 懂礼貌的新人

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
14 小时
注册时间
2013-10-15
帖子
30
10
发表于 2014-1-17 21:09:57 | 只看该作者
guoyq1988 发表于 2013-10-9 00:24
我自己改了下
楼主照我的说的改就好了,很简单
原来的脚本什么都不用改,楼上几位说的改法都错了(不是指 ...

楼主能发下人物仓库的脚本吗?谢谢

点评

已发,话说我不是楼主。。。  发表于 2014-1-18 12:20

评分

参与人数 1星屑 -10 收起 理由
myownroc -10 挖坟

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 10:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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