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

Project1

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

[已经过期] [脚本修改]将人物选择窗口改为队伍状态窗口

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
228 小时
注册时间
2012-2-27
帖子
30
跳转到指定楼层
1
发表于 2012-7-27 18:03:55 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 l616631804 于 2012-7-29 08:28 编辑

在国外网站找到一个脚本 http://www.atelier-rgss.com/RGSS/Menu/ACE_Menu07.html  ,
它的作用是打开一个显示窗口显示角色属性并且选人加入队伍,我觉得那个界面很好看,想请人帮忙修改一下,换成队伍状态窗口,即换成只显示当前队伍成员属性的界面,原脚本是显示数据库中所有角色的信息的,还有就是最后面把按确认和取消后的改成返回菜单界面。




RUBY 代码复制
  1. #==============================================================================
  2. # +++ MOG - Scene Character Select V1.0 +++
  3. #==============================================================================
  4. # By Moghunter
  5. # [url]http://www.atelier-rgss.com/[/url]
  6. #==============================================================================
  7. # Tela de seleção de personagens.
  8. #==============================================================================
  9. # 1 - Deverão conter as seguintes imagens na pasta GRAPHICS/SYSTEM.
  10. #
  11. # Background
  12. # Char_Layout01
  13. # Char_Layout02
  14. # Char_Status_Layout
  15. # Number_Char
  16. #
  17. # 2 - Imagem de pose. (Opcional)
  18. # Para ativar a imagem de pose dos personagens, basta ter os arquivos de pose
  19. # gravados na pasta (GRAPHICS/PICTURES)
  20. # Você deverá nomear as imagens da seguinte forma.
  21. #
  22. # Character + ID_DO_PERSONAGEM
  23. #
  24. # Exemplo:
  25. #
  26. # Character1.png
  27. #
  28. #==============================================================================
  29. # Para chamar o script use o seguinte comando.
  30. #
  31. # SceneManager.call(Scene_Character_Select)
  32. #
  33. #==============================================================================
  34.  
  35.  
  36. #==============================================================================
  37. # ■ Window_Base
  38. #==============================================================================
  39. class Window_Base < Window
  40.  
  41.   #--------------------------------------------------------------------------
  42.   # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)     
  43.   #--------------------------------------------------------------------------
  44.   # X - Posição na horizontal
  45.   # Y - Posição na vertical
  46.   # VALUE - Valor Numérico
  47.   # FILE_NAME - Nome do arquivo
  48.   # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita  
  49.   # SPACE - Espaço entre os números.
  50.   # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
  51.   # FRAME_INDEX - Definição do quadro a ser utilizado.
  52.   #--------------------------------------------------------------------------  
  53.   def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)     
  54.       number_image = Cache.system(file_name)
  55.       frame_max = 1 if frame_max < 1
  56.       frame_index = frame_max -1 if frame_index > frame_max -1
  57.       align = 2 if align > 2
  58.       cw = number_image.width / 10
  59.       ch = number_image.height / frame_max
  60.       h = ch * frame_index
  61.       number = value.abs.to_s.split(//)
  62.       case align
  63.           when 0
  64.              plus_x = (-cw + space) * number.size
  65.           when 1
  66.              plus_x = (-cw + space) * number.size
  67.              plus_x /= 2
  68.           when 2  
  69.              plus_x = 0
  70.       end
  71.       for r in 0..number.size - 1      
  72.           number_abs = number[r].to_i
  73.           number_rect = Rect.new(cw * number_abs, h, cw, ch)
  74.           self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)        
  75.       end
  76.       number_image.dispose  
  77.    end
  78.   #--------------------------------------------------------------------------
  79.   # ● draw_char_window_status  
  80.   #--------------------------------------------------------------------------  
  81.   def draw_char_window_status(x,y)
  82.       image = Cache.system("Char_Status_Layout")   
  83.       cw = image.width  
  84.       ch = image.height
  85.       src_rect = Rect.new(0, 0, cw, ch)   
  86.       self.contents.blt(x , y , image, src_rect)
  87.       image.dispose
  88.   end     
  89. end  
  90.  
  91. #===============================================================================
  92. # ■ RPG_FileTest
  93. #===============================================================================
  94. module RPG_FileTest
  95.  
  96.   #--------------------------------------------------------------------------
  97.   # ● RPG_FileTest.system_exist?
  98.   #--------------------------------------------------------------------------
  99.   def RPG_FileTest.system_exist?(filename)
  100.       return Cache.system(filename) rescue return false
  101.   end  
  102.  
  103.   #--------------------------------------------------------------------------
  104.   # ● RPG_FileTest.picture_exist?
  105.   #--------------------------------------------------------------------------
  106.   def RPG_FileTest.picture_exist?(filename)
  107.       return Cache.picture(filename) rescue return false
  108.   end   
  109.  
  110. end
  111.  
  112. #==============================================================================
  113. # ** Window_Character_Status
  114. #==============================================================================
  115. class Window_Character_Status < Window_Base
  116.   attr_accessor :index
  117.   #--------------------------------------------------------------------------
  118.   # ● initialize
  119.   #--------------------------------------------------------------------------
  120.   def initialize(actor)
  121.       super(0, 0, 400, 130)
  122.       self.opacity = 0
  123.       actor_id = []
  124.       @index = actor
  125.       for i in 1...$data_actors.size
  126.         actor_id.push($game_actors[i])
  127.       end
  128.       @actor = actor_id[actor -1]
  129.       refresh
  130.   end
  131.   #--------------------------------------------------------------------------
  132.   # ● Refresh
  133.   #--------------------------------------------------------------------------
  134.   def refresh
  135.       self.contents.clear
  136.       self.contents.font.bold = true
  137.       self.contents.font.italic = true
  138.       draw_char_window_status(0, 6)   
  139.       draw_actor_face(@actor, 0, 0)
  140.       draw_actor_name(@actor, 140, -5)
  141.       draw_actor_class(@actor, 60, 70)   
  142.       draw_picture_number(155,20,@actor.mhp, "Number_char",1)   
  143.       draw_picture_number(145,48,@actor.mmp, "Number_char",1)   
  144.       draw_picture_number(228,28,@actor.atk, "Number_char",1)   
  145.       draw_picture_number(297,28,@actor.def, "Number_char",1)  
  146.       draw_picture_number(207,68,@actor.mat, "Number_char",1)  
  147.       draw_picture_number(277,68,@actor.agi, "Number_char",1)  
  148.   end
  149. end
  150.  
  151.  
  152. #==============================================================================
  153. # ■ Scene Character Select
  154. #==============================================================================
  155. class Scene_Character_Select
  156.  
  157. #--------------------------------------------------------------------------
  158. # ● Initialize
  159. #--------------------------------------------------------------------------
  160. def initialize
  161.      setup
  162.      create_layout
  163.      create_window_status
  164.      create_char_image
  165.      reset_position(0)      
  166. end
  167.  
  168. #--------------------------------------------------------------------------
  169. # ● Setup
  170. #--------------------------------------------------------------------------
  171. def setup
  172.      @char_index = 1
  173.      @char_max = $data_actors.size - 1
  174.      @pw_x = 300
  175.      @aw_x = 200     
  176.      @nw_x = 100         
  177. end  
  178.  
  179. #--------------------------------------------------------------------------
  180. # ● Main
  181. #--------------------------------------------------------------------------         
  182. def main
  183.      Graphics.transition
  184.      execute_loop
  185.      execute_dispose
  186. end   
  187.  
  188. #--------------------------------------------------------------------------
  189. # ● Execute Loop
  190. #--------------------------------------------------------------------------           
  191. def execute_loop
  192.      loop do
  193.           Graphics.update
  194.           Input.update
  195.           update
  196.           if SceneManager.scene != self
  197.               break
  198.           end
  199.      end
  200. end
  201.  
  202. #--------------------------------------------------------------------------
  203. # ● create_background
  204. #--------------------------------------------------------------------------   
  205. def create_layout
  206.       @background = Plane.new  
  207.       @background.bitmap = Cache.system("Background")
  208.       @background.z = 0
  209.       @layout_01 = Sprite.new  
  210.       @layout_01.bitmap = Cache.system("Char_Layout01")
  211.       @layout_01.z = 10      
  212.       @layout_02 = Sprite.new  
  213.       @layout_02.bitmap = Cache.system("Char_Layout02")
  214.       @layout_02.blend_type = 1
  215.       @layout_02.z = 1  
  216.   end  
  217.  
  218.   #--------------------------------------------------------------------------
  219.   # ● create_window_status
  220.   #--------------------------------------------------------------------------  
  221.   def create_window_status
  222.       @window_status = []
  223.       for i in 1...$data_actors.size
  224.           @window_status[i] = Window_Character_Status.new(i)
  225.           @window_status[i].z = 7
  226.       end
  227.       check_active_window
  228.   end  
  229.  
  230.   #--------------------------------------------------------------------------
  231.   # ● create_window_status
  232.   #--------------------------------------------------------------------------  
  233.   def create_char_image   
  234.       @actor_picture = []
  235.       actor_id = []
  236.       for i in 1...$data_actors.size
  237.           actor_id.push($game_actors[i])
  238.           actor = actor_id[i - 1]
  239.           @actor_picture[i] = Sprite.new
  240.           file_name = "Character" + i.to_s
  241.           file_name = "" unless RPG_FileTest.picture_exist?(file_name)
  242.           @actor_picture[i].bitmap = Cache.picture(file_name)
  243.       end   
  244.       check_active_picture
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● check_active_window
  248.   #--------------------------------------------------------------------------   
  249.   def check_active_window
  250.      for i in 1...$data_actors.size
  251.         @pw = @char_index - 1
  252.         @pw = 1 if @pw > @char_max
  253.         @pw_y = 32
  254.         @pw = @char_max if @pw < 1
  255.         @aw = @char_index
  256.         @aw_y = 160
  257.         @nw = @char_index + 1
  258.         @nw = 1 if @nw > @char_max
  259.         @nw = @char_max if @nw < 1
  260.         @nw_y = 288
  261.         case @window_status[i].index
  262.             when @pw,@aw,@nw
  263.                  @window_status[i].visible = true
  264.             else
  265.                  @window_status[i].visible = false
  266.         end
  267.       end  
  268.   end
  269.  
  270.   #--------------------------------------------------------------------------
  271.   # ● check_active_picture  
  272.   #--------------------------------------------------------------------------   
  273.   def check_active_picture  
  274.       for i in 1...$data_actors.size     
  275.         case @window_status[i].index
  276.             when @pw,@aw,@nw
  277.                  @actor_picture[i].visible = true
  278.                  @actor_picture[@pw].z = 4
  279.                  @actor_picture[@aw].z = 6   
  280.                  @actor_picture[@nw].z = 4      
  281.                  @actor_picture[@pw].opacity = 120
  282.                  @actor_picture[@aw].opacity = 255
  283.                  @actor_picture[@nw].opacity = 120            
  284.             else
  285.                  @actor_picture[i].visible = false
  286.         end     
  287.       end
  288.   end      
  289.  
  290.   #--------------------------------------------------------------------------
  291.   # ● terminate
  292.   #--------------------------------------------------------------------------
  293.   def execute_dispose
  294.       RPG::BGM.fade(2500)
  295.       Graphics.fadeout(60)
  296.       Graphics.wait(40)
  297.       RPG::BGM.stop      
  298.       for i in 1...$data_actors.size
  299.           @window_status[i].dispose
  300.           @actor_picture[i].bitmap.dispose
  301.           @actor_picture[i].dispose        
  302.       end   
  303.       @background.bitmap.dispose
  304.       @background.dispose
  305.       @layout_01.bitmap.dispose   
  306.       @layout_01.dispose
  307.       @layout_02.bitmap.dispose   
  308.       @layout_02.dispose   
  309.     end
  310.  
  311.   #--------------------------------------------------------------------------
  312.   # ● update
  313.   #--------------------------------------------------------------------------
  314.   def update
  315.       @background.ox += 1
  316.       update_select
  317.       update_slide_window
  318.       update_slide_image
  319.   end
  320.  
  321.   #--------------------------------------------------------------------------
  322.   # ● update_slide_window
  323.   #--------------------------------------------------------------------------  
  324.   def update_slide_window
  325.       @window_status[@aw].x += 1 if @window_status[@aw].x < 0
  326.       @window_status[@nw].x -= 2 if @window_status[@nw].x > -30
  327.       @window_status[@pw].x -= 2 if @window_status[@pw].x > -30
  328.       slide_window_y(@pw,@pw_y)
  329.       slide_window_y(@aw,@aw_y)
  330.       slide_window_y(@nw,@nw_y)
  331.   end
  332.  
  333.   #--------------------------------------------------------------------------
  334.   # ● update_slide_image   
  335.   #--------------------------------------------------------------------------  
  336.   def update_slide_image   
  337.       slide_picture_x(@pw,@pw_x,15)
  338.       slide_picture_x(@aw,@aw_x,5)
  339.       slide_picture_x(@nw,@nw_x,15)
  340.   end
  341.  
  342.   #--------------------------------------------------------------------------
  343.   # ● slide_picture_x
  344.   #--------------------------------------------------------------------------   
  345.   def slide_picture_x(i,x_pos,speed)
  346.       if @actor_picture[i].x < x_pos
  347.          @actor_picture[i].x += speed
  348.          @actor_picture[i].x = x_pos if @actor_picture[i].x > x_pos
  349.       end  
  350.       if @actor_picture[i].x > x_pos
  351.          @actor_picture[i].x -= speed
  352.          @actor_picture[i].x = x_pos if @actor_picture[i].x < x_pos        
  353.        end            
  354.   end     
  355.  
  356.   #--------------------------------------------------------------------------
  357.   # ● slide_window_y
  358.   #--------------------------------------------------------------------------   
  359.   def slide_window_y(i,y_pos)
  360.       if @window_status[i].y < y_pos
  361.          @window_status[i].y += 15
  362.          @window_status[i].y = y_pos if @window_status[i].y > y_pos
  363.       end  
  364.       if @window_status[i].y > y_pos
  365.          @window_status[i].y -= 15
  366.          @window_status[i].y = y_pos if @window_status[i].y < y_pos        
  367.        end            
  368.   end   
  369.  
  370.   #--------------------------------------------------------------------------
  371.   # ● reset_position
  372.   #--------------------------------------------------------------------------     
  373.   def reset_position(diretion)
  374.       check_active_window
  375.       check_active_picture
  376.       case diretion
  377.          when 0
  378.             @window_status[@pw].y = -64
  379.             @actor_picture[@pw].x = 100
  380.          when 1  
  381.             @window_status[@nw].y = 440
  382.             @actor_picture[@nw].x = 400
  383.       end        
  384.   end  
  385.  
  386.   #--------------------------------------------------------------------------
  387.   # ● update_select
  388.   #--------------------------------------------------------------------------
  389.   def update_select
  390.        if Input.trigger?(Input::DOWN) or Input.trigger?(Input::LEFT)
  391.           Sound.play_cursor
  392.           @char_index += 1
  393.           @char_index = 1 if @char_index > @char_max
  394.           if @char_max < 3         
  395.              reset_position(0)
  396.           else  
  397.              reset_position(1)
  398.           end   
  399.        elsif Input.trigger?(Input::UP) or Input.trigger?(Input::RIGHT)
  400.           Sound.play_cursor
  401.           @char_index -= 1
  402.           @char_index = @char_max if @char_index < 1
  403.           reset_position(0)
  404.         elsif Input.trigger?(Input::C) or Input.trigger?(Input::B)  
  405.  
  406.  
  407.           Sound.play_ok
  408.  
  409.           $game_party.add_actor(@char_index)
  410.  
  411.           SceneManager.return
  412.        end
  413.   end
  414. end  
  415.  
  416.  
  417. $mog_rgss3_scene_character_select = true
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.  
  426. #==============================================================================
  427. # ■ Window Menu Command
  428. #==============================================================================
  429. class Window_MenuCommand < Window_Command  
  430.  
  431. #------------------------------------------------------------------------------
  432. # ● 加入菜单
  433. #------------------------------------------------------------------------------     
  434.   alias mog_Character_add_main_commands add_main_commands
  435.   def add_main_commands
  436.       mog_Character_add_main_commands
  437.       add_command("另一种人物", :mog_Character, main_commands_enabled)
  438.   end
  439. end   
  440.  
  441. #==============================================================================
  442. # ■ Scene Menu
  443. #==============================================================================
  444. class Scene_Menu < Scene_MenuBase
  445.  
  446. #------------------------------------------------------------------------------
  447. # ●加入指令窗口
  448. #------------------------------------------------------------------------------      
  449.    alias mog_Character_create_command_window create_command_window
  450.    def create_command_window
  451.        mog_Character_create_command_window
  452.        @command_window.set_handler(:mog_Character,     method(:command_Character_Select))
  453.    end
  454.  
  455. #------------------------------------------------------------------------------
  456. # ●生成窗口
  457. #------------------------------------------------------------------------------        
  458.    def command_Character_Select
  459.       SceneManager.call(Scene_Character_Select)
  460.    end
  461.  
  462. end



 http://115.com/file/an8qjitm# ACE_Character_Select.zip



咦,为什么我看不到自己的内容呢!?


Lv1.梦旅人

梦石
0
星屑
50
在线时间
228 小时
注册时间
2012-2-27
帖子
30
2
 楼主| 发表于 2012-7-28 11:13:59 | 只看该作者
咦,我怎么看不到自己的内容,有人能看见吗!———大家帮忙看看能看到内容吗?
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
42 小时
注册时间
2012-5-16
帖子
56
3
发表于 2012-7-28 17:07:22 | 只看该作者
看不見
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
228 小时
注册时间
2012-2-27
帖子
30
4
 楼主| 发表于 2012-8-1 11:40:19 | 只看该作者
本帖最后由 l616631804 于 2012-8-1 14:43 编辑

唔,还是看不到,版主帮忙关下帖子,自己尝试改了半天,还是没搞清楚怎么做,只好把显示图片的功能单独提了出来,再把Window_Status给换了,虽然达不到理想效果,还是算可以了!顺便问下,使用
  1. draw_picture_number(125,120,@actor.atk, "Number_char",1)   
复制代码
可以用图片数字显示角色物理攻击,怎么才能同样的用图片数字显示属性有效度呢?          额,不用了,实验出来了 ,用
RUBY 代码复制
  1. draw_picture_number(100,220,(@actor.element_rate(1) * 100).to_i, "Number_char",1)
  就行了!
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-13 02:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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