查看: 3251|回复: 3

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

[复制链接]
梦石
0
星屑
50
在线时间
228 小时
注册时间
2012-2-27
回帖
25
发表于 2012-7-27 18:03:55 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 l616631804 于 2012-7-29 08:28 编辑

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




  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. # ■ Window_Base
  36. #==============================================================================
  37. class Window_Base < Window
  38.   
  39.   #--------------------------------------------------------------------------
  40.   # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)     
  41.   #--------------------------------------------------------------------------
  42.   # X - Posição na horizontal
  43.   # Y - Posição na vertical
  44.   # VALUE - Valor Numérico
  45.   # FILE_NAME - Nome do arquivo
  46.   # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita  
  47.   # SPACE - Espaço entre os números.
  48.   # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
  49.   # FRAME_INDEX - Definição do quadro a ser utilizado.
  50.   #--------------------------------------------------------------------------  
  51.   def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)     
  52.       number_image = Cache.system(file_name)
  53.       frame_max = 1 if frame_max < 1
  54.       frame_index = frame_max -1 if frame_index > frame_max -1
  55.       align = 2 if align > 2
  56.       cw = number_image.width / 10
  57.       ch = number_image.height / frame_max
  58.       h = ch * frame_index
  59.       number = value.abs.to_s.split(//)
  60.       case align
  61.           when 0
  62.              plus_x = (-cw + space) * number.size
  63.           when 1
  64.              plus_x = (-cw + space) * number.size
  65.              plus_x /= 2
  66.           when 2  
  67.              plus_x = 0
  68.       end
  69.       for r in 0..number.size - 1      
  70.           number_abs = number[r].to_i
  71.           number_rect = Rect.new(cw * number_abs, h, cw, ch)
  72.           self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)        
  73.       end
  74.       number_image.dispose  
  75.    end
  76.   #--------------------------------------------------------------------------
  77.   # ● draw_char_window_status  
  78.   #--------------------------------------------------------------------------  
  79.   def draw_char_window_status(x,y)
  80.       image = Cache.system("Char_Status_Layout")   
  81.       cw = image.width  
  82.       ch = image.height
  83.       src_rect = Rect.new(0, 0, cw, ch)   
  84.       self.contents.blt(x , y , image, src_rect)
  85.       image.dispose
  86.   end     
  87. end  

  88. #===============================================================================
  89. # ■ RPG_FileTest
  90. #===============================================================================
  91. module RPG_FileTest
  92.   
  93.   #--------------------------------------------------------------------------
  94.   # ● RPG_FileTest.system_exist?
  95.   #--------------------------------------------------------------------------
  96.   def RPG_FileTest.system_exist?(filename)
  97.       return Cache.system(filename) rescue return false
  98.   end  
  99.   
  100.   #--------------------------------------------------------------------------
  101.   # ● RPG_FileTest.picture_exist?
  102.   #--------------------------------------------------------------------------
  103.   def RPG_FileTest.picture_exist?(filename)
  104.       return Cache.picture(filename) rescue return false
  105.   end   
  106.   
  107. end

  108. #==============================================================================
  109. # ** Window_Character_Status
  110. #==============================================================================
  111. class Window_Character_Status < Window_Base
  112.   attr_accessor :index
  113.   #--------------------------------------------------------------------------
  114.   # ● initialize
  115.   #--------------------------------------------------------------------------
  116.   def initialize(actor)
  117.       super(0, 0, 400, 130)
  118.       self.opacity = 0
  119.       actor_id = []
  120.       @index = actor
  121.       for i in 1...$data_actors.size
  122.         actor_id.push($game_actors[i])
  123.       end
  124.       @actor = actor_id[actor -1]
  125.       refresh
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● Refresh
  129.   #--------------------------------------------------------------------------
  130.   def refresh
  131.       self.contents.clear
  132.       self.contents.font.bold = true
  133.       self.contents.font.italic = true
  134.       draw_char_window_status(0, 6)   
  135.       draw_actor_face(@actor, 0, 0)
  136.       draw_actor_name(@actor, 140, -5)
  137.       draw_actor_class(@actor, 60, 70)   
  138.       draw_picture_number(155,20,@actor.mhp, "Number_char",1)   
  139.       draw_picture_number(145,48,@actor.mmp, "Number_char",1)   
  140.       draw_picture_number(228,28,@actor.atk, "Number_char",1)   
  141.       draw_picture_number(297,28,@actor.def, "Number_char",1)  
  142.       draw_picture_number(207,68,@actor.mat, "Number_char",1)  
  143.       draw_picture_number(277,68,@actor.agi, "Number_char",1)  
  144.   end
  145. end


  146. #==============================================================================
  147. # ■ Scene Character Select
  148. #==============================================================================
  149. class Scene_Character_Select
  150.   
  151. #--------------------------------------------------------------------------
  152. # ● Initialize
  153. #--------------------------------------------------------------------------
  154. def initialize
  155.      setup
  156.      create_layout
  157.      create_window_status
  158.      create_char_image
  159.      reset_position(0)      
  160. end
  161.    
  162. #--------------------------------------------------------------------------
  163. # ● Setup
  164. #--------------------------------------------------------------------------
  165. def setup
  166.      @char_index = 1
  167.      @char_max = $data_actors.size - 1
  168.      @pw_x = 300
  169.      @aw_x = 200     
  170.      @nw_x = 100         
  171. end  

  172. #--------------------------------------------------------------------------
  173. # ● Main
  174. #--------------------------------------------------------------------------         
  175. def main
  176.      Graphics.transition
  177.      execute_loop
  178.      execute_dispose
  179. end   

  180. #--------------------------------------------------------------------------
  181. # ● Execute Loop
  182. #--------------------------------------------------------------------------           
  183. def execute_loop
  184.      loop do
  185.           Graphics.update
  186.           Input.update
  187.           update
  188.           if SceneManager.scene != self
  189.               break
  190.           end
  191.      end
  192. end
  193.   
  194. #--------------------------------------------------------------------------
  195. # ● create_background
  196. #--------------------------------------------------------------------------   
  197. def create_layout
  198.       @background = Plane.new  
  199.       @background.bitmap = Cache.system("Background")
  200.       @background.z = 0
  201.       @layout_01 = Sprite.new  
  202.       @layout_01.bitmap = Cache.system("Char_Layout01")
  203.       @layout_01.z = 10      
  204.       @layout_02 = Sprite.new  
  205.       @layout_02.bitmap = Cache.system("Char_Layout02")
  206.       @layout_02.blend_type = 1
  207.       @layout_02.z = 1  
  208.   end  
  209.   
  210.   #--------------------------------------------------------------------------
  211.   # ● create_window_status
  212.   #--------------------------------------------------------------------------  
  213.   def create_window_status
  214.       @window_status = []
  215.       for i in 1...$data_actors.size
  216.           @window_status[i] = Window_Character_Status.new(i)
  217.           @window_status[i].z = 7
  218.       end
  219.       check_active_window
  220.   end  
  221.   
  222.   #--------------------------------------------------------------------------
  223.   # ● create_window_status
  224.   #--------------------------------------------------------------------------  
  225.   def create_char_image   
  226.       @actor_picture = []
  227.       actor_id = []
  228.       for i in 1...$data_actors.size
  229.           actor_id.push($game_actors[i])
  230.           actor = actor_id[i - 1]
  231.           @actor_picture[i] = Sprite.new
  232.           file_name = "Character" + i.to_s
  233.           file_name = "" unless RPG_FileTest.picture_exist?(file_name)
  234.           @actor_picture[i].bitmap = Cache.picture(file_name)
  235.       end   
  236.       check_active_picture
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● check_active_window
  240.   #--------------------------------------------------------------------------   
  241.   def check_active_window
  242.      for i in 1...$data_actors.size
  243.         @pw = @char_index - 1
  244.         @pw = 1 if @pw > @char_max
  245.         @pw_y = 32
  246.         @pw = @char_max if @pw < 1
  247.         @aw = @char_index
  248.         @aw_y = 160
  249.         @nw = @char_index + 1
  250.         @nw = 1 if @nw > @char_max
  251.         @nw = @char_max if @nw < 1
  252.         @nw_y = 288
  253.         case @window_status[i].index
  254.             when @pw,@aw,@nw
  255.                  @window_status[i].visible = true
  256.             else
  257.                  @window_status[i].visible = false
  258.         end
  259.       end  
  260.   end
  261.    
  262.   #--------------------------------------------------------------------------
  263.   # ● check_active_picture  
  264.   #--------------------------------------------------------------------------   
  265.   def check_active_picture  
  266.       for i in 1...$data_actors.size     
  267.         case @window_status[i].index
  268.             when @pw,@aw,@nw
  269.                  @actor_picture[i].visible = true
  270.                  @actor_picture[@pw].z = 4
  271.                  @actor_picture[@aw].z = 6   
  272.                  @actor_picture[@nw].z = 4      
  273.                  @actor_picture[@pw].opacity = 120
  274.                  @actor_picture[@aw].opacity = 255
  275.                  @actor_picture[@nw].opacity = 120            
  276.             else
  277.                  @actor_picture[i].visible = false
  278.         end     
  279.       end
  280.   end      
  281.   
  282.   #--------------------------------------------------------------------------
  283.   # ● terminate
  284.   #--------------------------------------------------------------------------
  285.   def execute_dispose
  286.       RPG::BGM.fade(2500)
  287.       Graphics.fadeout(60)
  288.       Graphics.wait(40)
  289.       RPG::BGM.stop      
  290.       for i in 1...$data_actors.size
  291.           @window_status[i].dispose
  292.           @actor_picture[i].bitmap.dispose
  293.           @actor_picture[i].dispose        
  294.       end   
  295.       @background.bitmap.dispose
  296.       @background.dispose
  297.       @layout_01.bitmap.dispose   
  298.       @layout_01.dispose
  299.       @layout_02.bitmap.dispose   
  300.       @layout_02.dispose   
  301.     end
  302.    
  303.   #--------------------------------------------------------------------------
  304.   # ● update
  305.   #--------------------------------------------------------------------------
  306.   def update
  307.       @background.ox += 1
  308.       update_select
  309.       update_slide_window
  310.       update_slide_image
  311.   end
  312.   
  313.   #--------------------------------------------------------------------------
  314.   # ● update_slide_window
  315.   #--------------------------------------------------------------------------  
  316.   def update_slide_window
  317.       @window_status[@aw].x += 1 if @window_status[@aw].x < 0
  318.       @window_status[@nw].x -= 2 if @window_status[@nw].x > -30
  319.       @window_status[@pw].x -= 2 if @window_status[@pw].x > -30
  320.       slide_window_y(@pw,@pw_y)
  321.       slide_window_y(@aw,@aw_y)
  322.       slide_window_y(@nw,@nw_y)
  323.   end
  324.   
  325.   #--------------------------------------------------------------------------
  326.   # ● update_slide_image   
  327.   #--------------------------------------------------------------------------  
  328.   def update_slide_image   
  329.       slide_picture_x(@pw,@pw_x,15)
  330.       slide_picture_x(@aw,@aw_x,5)
  331.       slide_picture_x(@nw,@nw_x,15)
  332.   end
  333.   
  334.   #--------------------------------------------------------------------------
  335.   # ● slide_picture_x
  336.   #--------------------------------------------------------------------------   
  337.   def slide_picture_x(i,x_pos,speed)
  338.       if @actor_picture[i].x < x_pos
  339.          @actor_picture[i].x += speed
  340.          @actor_picture[i].x = x_pos if @actor_picture[i].x > x_pos
  341.       end  
  342.       if @actor_picture[i].x > x_pos
  343.          @actor_picture[i].x -= speed
  344.          @actor_picture[i].x = x_pos if @actor_picture[i].x < x_pos        
  345.        end            
  346.   end     
  347.   
  348.   #--------------------------------------------------------------------------
  349.   # ● slide_window_y
  350.   #--------------------------------------------------------------------------   
  351.   def slide_window_y(i,y_pos)
  352.       if @window_status[i].y < y_pos
  353.          @window_status[i].y += 15
  354.          @window_status[i].y = y_pos if @window_status[i].y > y_pos
  355.       end  
  356.       if @window_status[i].y > y_pos
  357.          @window_status[i].y -= 15
  358.          @window_status[i].y = y_pos if @window_status[i].y < y_pos        
  359.        end            
  360.   end   
  361.   
  362.   #--------------------------------------------------------------------------
  363.   # ● reset_position
  364.   #--------------------------------------------------------------------------     
  365.   def reset_position(diretion)
  366.       check_active_window
  367.       check_active_picture
  368.       case diretion
  369.          when 0
  370.             @window_status[@pw].y = -64
  371.             @actor_picture[@pw].x = 100
  372.          when 1  
  373.             @window_status[@nw].y = 440
  374.             @actor_picture[@nw].x = 400
  375.       end        
  376.   end  
  377.   
  378.   #--------------------------------------------------------------------------
  379.   # ● update_select
  380.   #--------------------------------------------------------------------------
  381.   def update_select
  382.        if Input.trigger?(Input::DOWN) or Input.trigger?(Input::LEFT)
  383.           Sound.play_cursor
  384.           @char_index += 1
  385.           @char_index = 1 if @char_index > @char_max
  386.           if @char_max < 3         
  387.              reset_position(0)
  388.           else  
  389.              reset_position(1)
  390.           end   
  391.        elsif Input.trigger?(Input::UP) or Input.trigger?(Input::RIGHT)
  392.           Sound.play_cursor
  393.           @char_index -= 1
  394.           @char_index = @char_max if @char_index < 1
  395.           reset_position(0)
  396.         elsif Input.trigger?(Input::C) or Input.trigger?(Input::B)  
  397.          
  398.          
  399.           Sound.play_ok
  400.          
  401.           $game_party.add_actor(@char_index)
  402.          
  403.           SceneManager.return
  404.        end
  405.   end
  406. end  


  407. $mog_rgss3_scene_character_select = true








  408. #==============================================================================
  409. # ■ Window Menu Command
  410. #==============================================================================
  411. class Window_MenuCommand < Window_Command  
  412.   
  413. #------------------------------------------------------------------------------
  414. # ● 加入菜单
  415. #------------------------------------------------------------------------------     
  416.   alias mog_Character_add_main_commands add_main_commands
  417.   def add_main_commands
  418.       mog_Character_add_main_commands
  419.       add_command("另一种人物", :mog_Character, main_commands_enabled)
  420.   end
  421. end   

  422. #==============================================================================
  423. # ■ Scene Menu
  424. #==============================================================================
  425. class Scene_Menu < Scene_MenuBase
  426.   
  427. #------------------------------------------------------------------------------
  428. # ●加入指令窗口
  429. #------------------------------------------------------------------------------      
  430.    alias mog_Character_create_command_window create_command_window
  431.    def create_command_window
  432.        mog_Character_create_command_window
  433.        @command_window.set_handler(:mog_Character,     method(:command_Character_Select))
  434.    end
  435.    
  436. #------------------------------------------------------------------------------
  437. # ●生成窗口
  438. #------------------------------------------------------------------------------        
  439.    def command_Character_Select
  440.       SceneManager.call(Scene_Character_Select)
  441.    end

  442. end   

复制代码



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



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


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

使用道具 举报

梦石
0
星屑
50
在线时间
42 小时
注册时间
2012-5-16
回帖
48
发表于 2012-7-28 17:07:22 | 显示全部楼层
看不見
回复

使用道具 举报

梦石
0
星屑
50
在线时间
228 小时
注册时间
2012-2-27
回帖
25
 楼主| 发表于 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)   
复制代码
可以用图片数字显示角色物理攻击,怎么才能同样的用图片数字显示属性有效度呢?          额,不用了,实验出来了 ,用
  1. draw_picture_number(100,220,(@actor.element_rate(1) * 100).to_i, "Number_char",1)
复制代码
就行了!
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部