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

Project1

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

[已经解决] 人物仓库添加人物行走图

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1237
在线时间
163 小时
注册时间
2019-10-4
帖子
217
跳转到指定楼层
1
发表于 2022-12-19 18:21:41 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ chaochao的人物仓库ver1.02正式版
  6. # 修改了Game_Party
  7. # 功能:
  8. # 用来存放角色的仓库……
  9. # 召唤画面用$scene = Chaochao_Scene_Party.new
  10. # 其它使用说明在代码里已经备注。
  11. #------------------------------------------------------------------------------
  12. # 作者:chaochao
  13. # http://zhuchao.go1.icpcn.com
  14. #==============================================================================
  15. class Chaochao_Window_PartyLeft < Window_Selectable
  16.   def initialize
  17.     super(0, 0, 320, 224)
  18.     self.contents = Bitmap.new(width - 32, height - 32)
  19.     self.index = 0
  20.     refresh
  21.   end
  22.   def actor
  23.     return @actors[self.index]
  24.   end
  25.   def refresh
  26.     if self.contents != nil
  27.       self.contents.dispose
  28.       self.contents = nil
  29.     end
  30.     @actors = []
  31.     for i in 0...$game_party.actors.size
  32.       @actors.push($game_party.actors[i])
  33.     end
  34.    
  35.     @item_max = 4
  36.     if @item_max > 0
  37.       self.contents = Bitmap.new(width - 32, (row_max+1) * 32)
  38.       for i in 0...@item_max
  39.         draw_item(i)
  40.       end
  41.     end
  42.   end
  43.   def draw_item(index)
  44.     if @actors[index] != nil
  45.       actor = @actors[index]
  46.       text = @actors[index].name
  47.       lv = @actors[index].level.to_s + " "
  48.       if $game_party.chaochao.include?(actor.id) or $game_party.actors.size <= 1
  49.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  50.       else
  51.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  52.       end
  53.       self.contents.draw_text(4, index * 32 + 32, 288, 32, text)
  54.       self.contents.font.color = normal_color
  55.       self.contents.font.size = 16
  56.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  "Level:   ", 2)
  57.       colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  58.       colory = [255.0000 / 60 * @actors[index].level,255].min
  59.       self.contents.font.color = Color.new(colorx, colory, 0)
  60.       self.contents.draw_text(4, index * 32 + 36, 288, 32,  lv, 2)
  61.       self.contents.font.color = normal_color
  62.       self.contents.font.size = 22
  63.     else
  64.       self.contents.draw_text(4, index * 32 + 32, 288, 32,  "米有人物!")
  65.     end
  66.   end
  67.   def update_cursor_rect
  68.     if @index < 0
  69.       self.cursor_rect.empty
  70.       return
  71.     end
  72.     row = @index / @column_max
  73.     if row < self.top_row
  74.       self.top_row = row
  75.     end
  76.     if row > self.top_row + (self.page_row_max - 1)
  77.       self.top_row = row - (self.page_row_max - 1)
  78.     end
  79.     cursor_width = self.width / @column_max - 32
  80.     x = @index % @column_max * (cursor_width + 32)
  81.     y = @index / @column_max * 32 - self.oy + 32
  82.     self.cursor_rect.set(x, y, cursor_width, 32)
  83.   end
  84.   def item_max
  85.     return @item_max
  86.   end
  87.   def actor?(index)
  88.     return @actors[index] == nil ? false : true
  89.   end
  90.   def set_index(x)
  91.     @index = x
  92.   end
  93. end

  94. #------------------------------------------------------------------------------

  95. class Chaochao_Window_PartyRight < Window_Selectable
  96.   def initialize
  97.     super(320, 0, 320, 224)
  98.     self.contents = Bitmap.new(width - 32, height - 32)
  99.     self.index = -1
  100.     refresh
  101.   end
  102.   def actor
  103.     return @actors[self.index]
  104.   end
  105.   def refresh
  106.     if self.contents != nil
  107.       self.contents.dispose
  108.       self.contents = nil
  109.     end
  110.     @actors = []
  111.     for i in 0...$game_party.actors2.size
  112.       @actors.push($game_party.actors2[i])
  113.     end
  114.    
  115.     @item_max = $game_party.actors2.size
  116.     if @item_max > 0
  117.       self.contents = Bitmap.new(width - 32, row_max * 32)
  118.       for i in 0...@item_max
  119.         draw_item(i)
  120.       end
  121.     elsif @item_max == 0
  122.       
  123.     end
  124.   end
  125.   def draw_item(index)
  126.     actor = @actors[index]
  127.     text = @actors[index].name
  128.     lv = @actors[index].level.to_s + " "
  129.     if $game_party.chaochao2.include?(actor.id) or $game_party.actors.size >= 4
  130.         self.contents.font.color = Color.new(255, 0, 0) #不能被移动的颜色
  131.       else
  132.         self.contents.font.color = Color.new(0, 255, 0) #可以被移动的颜色
  133.       end
  134.     self.contents.draw_text(4, index * 32, 288, 32, text)
  135.     self.contents.font.color = normal_color
  136.     self.contents.font.size = 16
  137.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  "Level:   ", 2)
  138.     colorx = [255.0000 - 255.0000/60 * @actors[index].level,0].max
  139.     colory = [255.0000 / 60 * @actors[index].level,255].min
  140.     self.contents.font.color = Color.new(colorx, colory, 0)
  141.     self.contents.draw_text(4, index * 32 + 4, 288, 32,  lv, 2)
  142.     self.contents.font.color = normal_color
  143.     self.contents.font.size = 22
  144.   end
  145.   def update_cursor_rect
  146.     if @index < 0
  147.       self.cursor_rect.empty
  148.       return
  149.     end
  150.     row = @index / @column_max
  151.     if row < self.top_row
  152.       self.top_row = row
  153.     end
  154.     if row > self.top_row + (self.page_row_max - 1)
  155.       self.top_row = row - (self.page_row_max - 1)
  156.     end
  157.     cursor_width = self.width / @column_max - 32
  158.     x = @index % @column_max * (cursor_width + 32)
  159.     y = @index / @column_max * 32 - self.oy
  160.     self.cursor_rect.set(x, y, cursor_width, 32)
  161.   end
  162.   def item_max
  163.     return @item_max
  164.   end
  165.   def actor?(index)
  166.     return @actors[index] == nil ? false : true
  167.   end
  168.   def set_index(x)
  169.     @index = x
  170.   end
  171. end

  172. #------------------------------------------------------------------------------

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

  194. #------------------------------------------------------------------------------

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

  309. #------------------------------------------------------------------------------

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

  455. #==============================================================================
  456. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  457. #==============================================================================
复制代码

Lv3.寻梦者

梦石
0
星屑
3065
在线时间
1429 小时
注册时间
2009-7-27
帖子
1448
2
发表于 2022-12-22 11:30:32 | 只看该作者
在188行那里修改,加行走图代码进去
  1. def set_actor(actor)
  2.     self.contents.clear
  3.     draw_actor_name(actor, 4, 0)
  4.     draw_actor_state(actor, 140, 0)
  5.     draw_actor_hp(actor, 284, 0)
  6.     draw_actor_sp(actor, 460, 0)
  7.     @actor = actor
  8.     self.visible = true
  9.   end
复制代码

点评

感谢问题解决  发表于 2022-12-30 20:50

评分

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

查看全部评分


博客:我的博客
回复 支持 1 反对 0

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 04:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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