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

Project1

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

[已经解决] 主站的人物仓库的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
26 小时
注册时间
2012-5-4
帖子
351
跳转到指定楼层
1
发表于 2012-6-5 18:55:51 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 苹果星ねこ 于 2012-6-6 18:26 编辑
  1. #==============================================================================
  2. # ■ chaochao的人物仓库ver1.02正式版
  3. # 修改了Game_Party
  4. # 功能:
  5. # 用来存放角色的仓库……
  6. # 召唤画面用$scene = Chaochao_Scene_Party.new
  7. # 其它使用说明在代码里已经备注。
  8. #------------------------------------------------------------------------------
  9. # 作者:chaochao
  10. # http://zhuchao.go1.icpcn.com
  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 @index < 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. class Chaochao_Window_PartyRight < Window_Selectable
  93.   def initialize
  94.     super(320, 0, 320, 224)
  95.     self.contents = Bitmap.new(width - 32, height - 32)
  96.     self.index = -1
  97.     refresh
  98.   end
  99.   def actor
  100.     return @actors[self.index]
  101.   end
  102.   def refresh
  103.     if self.contents != nil
  104.       self.contents.dispose
  105.       self.contents = nil
  106.     end
  107.     @actors = []
  108.     for i in 0...$game_party.actors2.size
  109.       @actors.push($game_party.actors2[i])
  110.     end
  111.    
  112.     @item_max = $game_party.actors2.size
  113.     if @item_max > 0
  114.       self.contents = Bitmap.new(width - 32, row_max * 32)
  115.       for i in 0...@item_max
  116.         draw_item(i)
  117.       end
  118.     elsif @item_max == 0
  119.       
  120.     end
  121.   end
  122.   def draw_item(index)
  123.     actor = @actors[index]
  124.     text = @actors[index].name
  125.     lv = @actors[index].level.to_s + " "
  126.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  127.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  128.       else
  129.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  130.       end
  131.     self.contents.draw_text(4, index * 32, 288, 32, text)
  132.     self.contents.font.color = normal_color
  133.     self.contents.font.size = 16
  134.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  "Level:   ", 2)
  135.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  136.     colory = [255.0000 / 60 * @actors[index].level,255].min
  137.     self.contents.font.color = Color.new(colorx, colory, 0)
  138.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  lv, 2)
  139.     self.contents.font.color = normal_color
  140.     self.contents.font.size = 22
  141.   end
  142.   def update_cursor_rect
  143.     if @index < 0
  144.       self.cursor_rect.empty
  145.       return
  146.     end
  147.     row = @index / @column_max
  148.     if row < self.top_row
  149.       self.top_row = row
  150.     end
  151.     if row > self.top_row + (self.page_row_max - 1)
  152.       self.top_row = row - (self.page_row_max - 1)
  153.     end
  154.     cursor_width = self.width / @column_max - 32
  155.     x = @index % @column_max * (cursor_width + 32)
  156.     y = @index / @column_max * 32 - self.oy
  157.     self.cursor_rect.set(x, y, cursor_width, 32)
  158.   end
  159.   def item_max
  160.     return @item_max
  161.   end
  162.   def actor?(index)
  163.     return @actors[index] == nil ? false : true
  164.   end
  165.   def set_index(x)
  166.     @index = x
  167.   end
  168. end

  169. #------------------------------------------------------------------------------

  170. class Chaochao_Window_PartyData < Window_Base
  171.   
  172.   def initialize
  173.     super(0, 224, 640, 256)
  174.     self.contents = Bitmap.new(width - 32, height - 32)
  175.     @actor = nil
  176.   end
  177.   
  178.   def set_actor(actor)
  179.     self.contents.clear
  180.     draw_actor_name(actor, 4, 0)
  181.     draw_actor_state(actor, 140, 0)
  182.     draw_actor_hp(actor, 284, 0)
  183.     draw_actor_sp(actor, 460, 0)
  184.     @actor = actor
  185.     self.visible = true
  186.   end
  187.   def clear
  188.     self.contents.clear
  189.   end
  190. end

  191. #------------------------------------------------------------------------------

  192. class Game_Party
  193.   attr_reader   :actors2
  194.   attr_reader   :chaochao#不能从队伍向备用角色移动的角色ID
  195.   attr_reader   :chaochao2#不能从备用角色向队伍移动的角色ID
  196.   def initialize
  197.     @actors = []
  198.     @gold = 0
  199.     @steps = 0
  200.     @items = {}
  201.     @weapons = {}
  202.     @armors = {}
  203.     @actors2 = []
  204.     @chaochao = []
  205.     @chaochao2 = []
  206.   end
  207.   def add_actor(actor_id,type=1)#type为1是向队伍中添加,为2则相反。
  208.     case type
  209.     when 1
  210.       if $game_actors[actor_id] != nil
  211.         actor = $game_actors[actor_id]
  212.         #如果队伍没有满和队伍中没有此角色
  213.         if @actors.size < 4 and not @actors.include?(actor) and not @actors2.include?(actor)
  214.           @actors.push(actor)
  215.           $game_player.refresh
  216.         end
  217.       end
  218.     when 2
  219.       if $game_actors[actor_id] != nil
  220.         actor = $game_actors[actor_id]
  221.         #如果角色不在队伍中和不在备用角色队伍中的情况下
  222.         #向备用角色中添加角色
  223.         if not @actors.include?(actor) and not @actors2.include?(actor)
  224.           @actors2.push(actor)
  225.           $game_player.refresh
  226.         end
  227.       end
  228.     end
  229.   end
  230.   
  231.   def huanren(index,type=1)#type为1是从备用角色向队伍中移动,为2则相反。
  232.     actor = $game_actors[index]
  233.     case type
  234.     when 1
  235.       if @actors.size < 4 and @actors2.include?(actor) and not @chaochao2.include?(index) and not @actors.include?(actor)
  236.         @actors.push(actor)
  237.         @actors2.delete(actor)
  238.         $game_system.se_play($data_system.decision_se)
  239.         $game_player.refresh
  240.       end
  241.     when 2
  242.       if @actors.include?(actor) and not @chaochao.include?(index) and not @actors2.include?(actor)
  243.         @actors2.push(actor)
  244.         @actors.delete(actor)
  245.         $game_system.se_play($data_system.decision_se)
  246.         $game_player.refresh
  247.       end
  248.     end
  249.   end
  250.   
  251.   #type1,1是操作队伍中的角色能否向备用队伍移动,2则相反。
  252.   #type2,1是添加不能移动的,2是删除不能移动的。
  253.   def yidong(actor_id,type1,type2=1)
  254.     case type2
  255.     when 1
  256.       case type1
  257.       when 1
  258.         @chaochao.push(actor_id)
  259.       when 2
  260.         @chaochao2.push(actor_id)
  261.       end
  262.     when 2
  263.       case type1
  264.       when 1
  265.         @chaochao.delete(actor_id)
  266.       when 2
  267.         @chaochao2.delete(actor_id)
  268.       end
  269.     end
  270.   end
  271.   
  272.   #type,1从队伍中离开,2从备用角色中离开,3从队伍和备用角色中离开。
  273.   def remove_actor(actor_id,type=1)
  274.     actor = $game_actors[actor_id]
  275.     case type
  276.     when 1
  277.       @actors.delete(actor)
  278.       $game_player.refresh
  279.     when 2
  280.       @actors2.delete(actor)
  281.       $game_player.refresh
  282.     when 3
  283.       @actors.delete(actor)
  284.       @actors2.delete(actor)
  285.       $game_player.refresh
  286.     end
  287.   end
  288.   
  289.   def refresh
  290.     new_actors = []
  291.     new_actors2 = []
  292.     for i in [email protected]
  293.       if $data_actors[@actors[i].id] != nil
  294.         new_actors.push($game_actors[@actors[i].id])
  295.       end
  296.     end
  297.     @actors = new_actors
  298.     for i in [email protected]
  299.       if $data_actors[@actors2[i].id] != nil
  300.         new_actors2.push($game_actors[@actors2[i].id])
  301.       end
  302.     end
  303.     @actors2 = new_actors2
  304.   end
  305. end

  306. #------------------------------------------------------------------------------

  307. class Chaochao_Scene_Party
  308.   def main
  309.     @left_temp_command = 0
  310.     @right_temp_command = 0
  311.     @temp = 0
  312.     @left_window = Chaochao_Window_PartyLeft.new
  313.     @left_window.active = true
  314.     @right_window = Chaochao_Window_PartyRight.new
  315.     @right_window.active = false
  316.     @data_window = Chaochao_Window_PartyData.new
  317.     update_data
  318.     Graphics.transition
  319.     loop do
  320.       Graphics.update
  321.       Input.update
  322.       update
  323.       if $scene != self
  324.         break
  325.       end
  326.     end
  327.     Graphics.freeze
  328.     @left_window.dispose
  329.     @right_window.dispose
  330.     @data_window.dispose
  331.   end
  332.   
  333.   def update
  334.     @left_window.update
  335.     @right_window.update
  336.     @data_window.update
  337.     update_command
  338.     update_data
  339.   end
  340.   
  341.   def update_command
  342.     if Input.trigger?(Input::B)
  343.       $game_system.se_play($data_system.cancel_se)
  344.       #画面切换
  345.       $scene = Scene_Map.new
  346.       return
  347.     end
  348.     if @left_window.active
  349.       update_left
  350.       return
  351.     end
  352.     if @right_window.active
  353.       update_right
  354.       return
  355.     end
  356.   end
  357.   
  358.   def update_left
  359.     if Input.trigger?(Input::RIGHT)
  360.       if @right_window.item_max > 0
  361.         @left_temp_command = @left_window.index
  362.         @left_window.set_index(-1)
  363.         $game_system.se_play($data_system.cursor_se)
  364.         @left_window.active = false
  365.         @right_window.active = true
  366.         @left_window.refresh
  367.         @right_window.refresh
  368.         @right_window.set_index(@right_temp_command)
  369.         return
  370.       else
  371.         $game_system.se_play($data_system.buzzer_se)
  372.         return
  373.       end
  374.     end
  375.     if Input.trigger?(Input::C)
  376.       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)
  377.         $game_party.huanren($game_party.actors[@left_window.index].id,2)#type为1是从备用角色向队伍中移动,为2则相反。
  378.         @left_window.refresh
  379.         @right_window.refresh
  380.       else
  381.         $game_system.se_play($data_system.buzzer_se)
  382.       end
  383.     end
  384.     return
  385.   end
  386.   
  387.   def update_right
  388.     if Input.trigger?(Input::LEFT)
  389.       if @left_window.item_max > 0
  390.         @right_temp_command = @right_window.index
  391.         @right_window.set_index(-1)
  392.         $game_system.se_play($data_system.cursor_se)
  393.         @left_window.active = true
  394.         @right_window.active = false
  395.         @left_window.refresh
  396.         @right_window.refresh
  397.         @left_window.set_index(@left_temp_command)
  398.         return
  399.       else
  400.         $game_system.se_play($data_system.buzzer_se)
  401.         return
  402.       end
  403.     end
  404.     if Input.trigger?(Input::C)
  405.       if $game_party.actors.size >= 4
  406.         $game_system.se_play($data_system.buzzer_se)
  407.         return
  408.       end
  409.       if @right_window.active and @right_window.actor?(@right_window.index) and not $game_party.chaochao2.include?($game_party.actors2[@right_window.index].id)
  410.         $game_party.huanren($game_party.actors2[@right_window.index].id,1)#type为1是从备用角色向队伍中移动,为2则相反。
  411.         if $game_party.actors2.size == 0
  412.           @right_temp_command = @right_window.index
  413.           @right_window.set_index(-1)
  414.           $game_system.se_play($data_system.cursor_se)
  415.           @left_window.active = true
  416.           @right_window.active = false
  417.           @left_window.refresh
  418.           @right_window.refresh
  419.           @left_window.set_index(@left_temp_command)
  420.         end
  421.         if @right_window.index > 0
  422.           @right_window.set_index(@right_window.index-1)
  423.         end
  424.         @left_window.refresh
  425.         @right_window.refresh
  426.       else
  427.         $game_system.se_play($data_system.buzzer_se)
  428.       end
  429.     end
  430.     return
  431.   end
  432.   
  433.   def update_data
  434.     if @left_window.active
  435.       if $game_party.actors[@left_window.index] != nil
  436.         @data_window.set_actor($game_party.actors[@left_window.index])
  437.       else
  438.         @data_window.clear
  439.       end
  440.       return
  441.     end
  442.     if @right_window.active
  443.       if $game_party.actors2[@right_window.index] != nil
  444.         @data_window.set_actor($game_party.actors2[@right_window.index])
  445.       else
  446.         @data_window.clear
  447.       end
  448.       return
  449.     end
  450.   end
  451. end
复制代码
下载下来才发现下面状态栏空空的
只有HPSP显示
如何多显示一些属性呢
比如攻击力防御力

点评

脚·本,范·例...  发表于 2012-6-5 18:57

Lv1.梦旅人

梦石
0
星屑
50
在线时间
30 小时
注册时间
2014-4-16
帖子
9
3
发表于 2014-4-24 21:22:06 | 只看该作者
明特·布兰马修 发表于 2012-6-5 04:14
略微写了一点
出入在原脚本下面试试
如果哪行出错的话就注释掉再试试!

求大神赐教 该脚本如何增加仓库人数数量 达到能存放100人或者无限数量

点评

请勿挖坟,下次见到直接扣100经验  发表于 2014-4-28 21:49
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
47
在线时间
412 小时
注册时间
2012-6-1
帖子
1021
2
发表于 2012-6-5 19:14:49 | 只看该作者
本帖最后由 明特·布兰马修 于 2012-6-5 20:50 编辑

略微写了一点
出入在原脚本下面试试
如果哪行出错的话就注释掉再试试!
  1. class Chaochao_Window_PartyData < Window_Base
  2. #--------------------------------------------------------------------------
  3. # ● 初始化对像
  4. #--------------------------------------------------------------------------
  5. def initialize
  6. super(0, 224, 640, 256)
  7. self.contents = Bitmap.new(width - 32, height - 32)
  8. @actor = nil
  9. end
  10. #--------------------------------------------------------------------------
  11. # ● 设置角色
  12. #--------------------------------------------------------------------------
  13. def set_actor(actor)
  14. clear
  15. @actor = actor

  16. x = 4 + 32
  17. y = 0
  18. draw_actor_face(@actor, x - 30, y + 8)
  19. self.contents.font.color = normal_color
  20. self.contents.draw_text(x - 120 + 128, y, 120, 32, @actor.name, 2)
  21. draw_actor_state(@actor, x + 64, y + 32)

  22. x = 4
  23. y = 72
  24. draw_actor_level(@actor, x, y)
  25. self.contents.draw_text(x - 236 + 160, y, 236, 32, @actor.class_name, 2)
  26. draw_actor_hp(@actor, x, y + 32, 172)
  27. draw_actor_sp(@actor, x, y + 64, 172)
  28. self.contents.font.color = system_color
  29. self.contents.draw_text(x, y + 96 , 80, 32, "经验")
  30. self.contents.draw_text(x, y + 128, 80, 32, "下一级剩余")
  31. self.contents.font.color = normal_color
  32. self.contents.draw_text(x + 72, y + 96 , 84, 32, @actor.exp_s, 2)
  33. self.contents.draw_text(x + 72, y + 128, 84, 32, @actor.next_rest_exp_s, 2)

  34. x = 224 - 16
  35. for i in 0..6 do draw_actor_parameter(@actor, x, 32*i, i) end

  36. x = 420 - 16
  37. width = 96
  38. self.contents.font.color = system_color
  39. self.contents.draw_text(x-16, 32*0, width, 32, "装备")
  40. self.contents.draw_text(x-16, 32*1, width, 32, $data_system.words.weapon)
  41. self.contents.draw_text(x-16, 32*2, width, 32, $data_system.words.armor1)
  42. self.contents.draw_text(x-16, 32*3, width, 32, $data_system.words.armor2)
  43. self.contents.draw_text(x-16, 32*4, width, 32, $data_system.words.armor3)
  44. self.contents.draw_text(x-16, 32*5, width, 32, $data_system.words.armor4)
  45. draw_item_name($data_weapons[@actor.weapon_id], x + 36, 32*1)
  46. draw_item_name($data_armors[@actor.armor1_id] , x + 36, 32*2)
  47. draw_item_name($data_armors[@actor.armor2_id] , x + 36, 32*3)
  48. draw_item_name($data_armors[@actor.armor3_id] , x + 36, 32*4)
  49. draw_item_name($data_armors[@actor.armor4_id] , x + 36, 32*5)
  50. end
  51. #--------------------------------------------------------------------------
  52. # ● 清除
  53. #--------------------------------------------------------------------------
  54. def clear
  55. self.contents.clear
  56. end
  57. end
复制代码

点评

太感谢了,急用仓库脚本,奖励给多了表达一下谢意!> <  发表于 2012-6-6 18:27
这里是新人 明特·布兰马修
脚本盲 事件盲 美工盲
还是色盲ORZ
XP\VX略懂VA无助很抱歉
所以问题什么如果答不好就不要提醒我了
短篇7已经放弃,但是坑在继续补上。所以回答和现身次数少之。
有事烧纸或者留言即可。

还有我不是正太啊ORZ
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-2-24 01:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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