查看: 3191|回复: 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 它的作用是打开一个显示窗口显示角色属性并且选人加入队伍,我觉得那个界面很好看,想请人帮忙修改一下,换成队伍状态窗口,即换成只显示当前队伍成员属性的界面,原脚本是显示数据库中所有角色的信息的,还有就是最后面把按确认和取消后的改成返回菜单界面。




[pre lang="ruby" line="1"]#==============================================================================
# +++ MOG - Scene Character Select V1.0 +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Tela de seleção de personagens.
#==============================================================================
# 1 - Deverão conter as seguintes imagens na pasta GRAPHICS/SYSTEM.
#
# Background
# Char_Layout01
# Char_Layout02
# Char_Status_Layout
# Number_Char
#
# 2 - Imagem de pose. (Opcional)
# Para ativar a imagem de pose dos personagens, basta ter os arquivos de pose
# gravados na pasta (GRAPHICS/PICTURES)
# Você deverá nomear as imagens da seguinte forma.
#
# Character + ID_DO_PERSONAGEM
#
# Exemplo:
#
# Character1.png
#
#==============================================================================
# Para chamar o script use o seguinte comando.
#
# SceneManager.call(Scene_Character_Select)
#
#==============================================================================


#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
  
  #--------------------------------------------------------------------------
  # ● draw_picture_number(x,y,value,file_name,align, space, frame_max ,frame_index)     
  #--------------------------------------------------------------------------
  # X - Posição na horizontal
  # Y - Posição na vertical
  # VALUE - Valor Numérico
  # FILE_NAME - Nome do arquivo
  # ALIGN - Centralizar 0 - Esquerda 1- Centro 2 - Direita  
  # SPACE - Espaço entre os números.
  # FRAME_MAX - Quantidade de quadros(Linhas) que a imagem vai ter.
  # FRAME_INDEX - Definição do quadro a ser utilizado.
  #--------------------------------------------------------------------------  
  def draw_picture_number(x,y,value, file_name,align = 0, space = 0, frame_max = 1,frame_index = 0)     
      number_image = Cache.system(file_name)
      frame_max = 1 if frame_max < 1
      frame_index = frame_max -1 if frame_index > frame_max -1
      align = 2 if align > 2
      cw = number_image.width / 10
      ch = number_image.height / frame_max
      h = ch * frame_index
      number = value.abs.to_s.split(//)
      case align
          when 0
             plus_x = (-cw + space) * number.size
          when 1
             plus_x = (-cw + space) * number.size
             plus_x /= 2
          when 2  
             plus_x = 0
      end
      for r in 0..number.size - 1      
          number_abs = number[r].to_i
          number_rect = Rect.new(cw * number_abs, h, cw, ch)
          self.contents.blt(plus_x + x + ((cw - space) * r), y , number_image, number_rect)        
      end
      number_image.dispose  
   end
  #--------------------------------------------------------------------------
  # ● draw_char_window_status  
  #--------------------------------------------------------------------------  
  def draw_char_window_status(x,y)
      image = Cache.system("Char_Status_Layout")   
      cw = image.width  
      ch = image.height
      src_rect = Rect.new(0, 0, cw, ch)   
      self.contents.blt(x , y , image, src_rect)
      image.dispose
  end     
end  

#===============================================================================
# ■ RPG_FileTest
#===============================================================================
module RPG_FileTest
  
  #--------------------------------------------------------------------------
  # ● RPG_FileTest.system_exist?
  #--------------------------------------------------------------------------
  def RPG_FileTest.system_exist?(filename)
      return Cache.system(filename) rescue return false
  end  
  
  #--------------------------------------------------------------------------
  # ● RPG_FileTest.picture_exist?
  #--------------------------------------------------------------------------
  def RPG_FileTest.picture_exist?(filename)
      return Cache.picture(filename) rescue return false
  end   
  
end

#==============================================================================
# ** Window_Character_Status
#==============================================================================
class Window_Character_Status < Window_Base
  attr_accessor :index
  #--------------------------------------------------------------------------
  # ● initialize
  #--------------------------------------------------------------------------
  def initialize(actor)
      super(0, 0, 400, 130)
      self.opacity = 0
      actor_id = []
      @index = actor
      for i in 1...$data_actors.size
        actor_id.push($game_actors)
      end
      @actor = actor_id[actor -1]
      refresh
  end
  #--------------------------------------------------------------------------
  # ● Refresh
  #--------------------------------------------------------------------------
  def refresh
      self.contents.clear
      self.contents.font.bold = true
      self.contents.font.italic = true
      draw_char_window_status(0, 6)   
      draw_actor_face(@actor, 0, 0)
      draw_actor_name(@actor, 140, -5)
      draw_actor_class(@actor, 60, 70)   
      draw_picture_number(155,20,@actor.mhp, "Number_char",1)   
      draw_picture_number(145,48,@actor.mmp, "Number_char",1)   
      draw_picture_number(228,28,@actor.atk, "Number_char",1)   
      draw_picture_number(297,28,@actor.def, "Number_char",1)  
      draw_picture_number(207,68,@actor.mat, "Number_char",1)  
      draw_picture_number(277,68,@actor.agi, "Number_char",1)  
  end
end


#==============================================================================
# ■ Scene Character Select
#==============================================================================
class Scene_Character_Select
  
#--------------------------------------------------------------------------
# ● Initialize
#--------------------------------------------------------------------------
def initialize
     setup
     create_layout
     create_window_status
     create_char_image
     reset_position(0)      
end
   
#--------------------------------------------------------------------------
# ● Setup
#--------------------------------------------------------------------------
def setup
     @char_index = 1
     @char_max = $data_actors.size - 1
     @pw_x = 300
     @aw_x = 200     
     @nw_x = 100         
end  

#--------------------------------------------------------------------------
# ● Main
#--------------------------------------------------------------------------         
def main
     Graphics.transition
     execute_loop
     execute_dispose
end   

#--------------------------------------------------------------------------
# ● Execute Loop
#--------------------------------------------------------------------------           
def execute_loop
     loop do
          Graphics.update
          Input.update
          update
          if SceneManager.scene != self
              break
          end
     end
end
  
#--------------------------------------------------------------------------
# ● create_background
#--------------------------------------------------------------------------   
def create_layout
      @background = Plane.new  
      @background.bitmap = Cache.system("Background")
      @background.z = 0
      @layout_01 = Sprite.new  
      @layout_01.bitmap = Cache.system("Char_Layout01")
      @layout_01.z = 10      
      @layout_02 = Sprite.new  
      @layout_02.bitmap = Cache.system("Char_Layout02")
      @layout_02.blend_type = 1
      @layout_02.z = 1  
  end  
  
  #--------------------------------------------------------------------------
  # ● create_window_status
  #--------------------------------------------------------------------------  
  def create_window_status
      @window_status = []
      for i in 1...$data_actors.size
          @window_status = Window_Character_Status.new(i)
          @window_status.z = 7
      end
      check_active_window
  end  
  
  #--------------------------------------------------------------------------
  # ● create_window_status
  #--------------------------------------------------------------------------  
  def create_char_image   
      @actor_picture = []
      actor_id = []
      for i in 1...$data_actors.size
          actor_id.push($game_actors)
          actor = actor_id[i - 1]
          @actor_picture = Sprite.new
          file_name = "Character" + i.to_s
          file_name = "" unless RPG_FileTest.picture_exist?(file_name)
          @actor_picture.bitmap = Cache.picture(file_name)
      end   
      check_active_picture
  end
  #--------------------------------------------------------------------------
  # ● check_active_window
  #--------------------------------------------------------------------------   
  def check_active_window
     for i in 1...$data_actors.size
        @pw = @char_index - 1
        @pw = 1 if @pw > @char_max
        @pw_y = 32
        @pw = @char_max if @pw < 1
        @aw = @char_index
        @aw_y = 160
        @nw = @char_index + 1
        @nw = 1 if @nw > @char_max
        @nw = @char_max if @nw < 1
        @nw_y = 288
        case @window_status.index
            when @pw,@aw,@nw
                 @window_status.visible = true
            else
                 @window_status.visible = false
        end
      end  
  end
   
  #--------------------------------------------------------------------------
  # ● check_active_picture  
  #--------------------------------------------------------------------------   
  def check_active_picture  
      for i in 1...$data_actors.size     
        case @window_status.index
            when @pw,@aw,@nw
                 @actor_picture.visible = true
                 @actor_picture[@pw].z = 4
                 @actor_picture[@aw].z = 6   
                 @actor_picture[@nw].z = 4      
                 @actor_picture[@pw].opacity = 120
                 @actor_picture[@aw].opacity = 255
                 @actor_picture[@nw].opacity = 120            
            else
                 @actor_picture.visible = false
        end     
      end
  end      
  
  #--------------------------------------------------------------------------
  # ● terminate
  #--------------------------------------------------------------------------
  def execute_dispose
      RPG::BGM.fade(2500)
      Graphics.fadeout(60)
      Graphics.wait(40)
      RPG::BGM.stop      
      for i in 1...$data_actors.size
          @window_status.dispose
          @actor_picture.bitmap.dispose
          @actor_picture.dispose        
      end   
      @background.bitmap.dispose
      @background.dispose
      @layout_01.bitmap.dispose   
      @layout_01.dispose
      @layout_02.bitmap.dispose   
      @layout_02.dispose   
    end
   
  #--------------------------------------------------------------------------
  # ● update
  #--------------------------------------------------------------------------
  def update
      @background.ox += 1
      update_select
      update_slide_window
      update_slide_image
  end
  
  #--------------------------------------------------------------------------
  # ● update_slide_window
  #--------------------------------------------------------------------------  
  def update_slide_window
      @window_status[@aw].x += 1 if @window_status[@aw].x < 0
      @window_status[@nw].x -= 2 if @window_status[@nw].x > -30
      @window_status[@pw].x -= 2 if @window_status[@pw].x > -30
      slide_window_y(@pw,@pw_y)
      slide_window_y(@aw,@aw_y)
      slide_window_y(@nw,@nw_y)
  end
  
  #--------------------------------------------------------------------------
  # ● update_slide_image   
  #--------------------------------------------------------------------------  
  def update_slide_image   
      slide_picture_x(@pw,@pw_x,15)
      slide_picture_x(@aw,@aw_x,5)
      slide_picture_x(@nw,@nw_x,15)
  end
  
  #--------------------------------------------------------------------------
  # ● slide_picture_x
  #--------------------------------------------------------------------------   
  def slide_picture_x(i,x_pos,speed)
      if @actor_picture.x < x_pos
         @actor_picture.x += speed
         @actor_picture.x = x_pos if @actor_picture.x > x_pos
      end  
      if @actor_picture.x > x_pos
         @actor_picture.x -= speed
         @actor_picture.x = x_pos if @actor_picture.x < x_pos        
       end            
  end     
  
  #--------------------------------------------------------------------------
  # ● slide_window_y
  #--------------------------------------------------------------------------   
  def slide_window_y(i,y_pos)
      if @window_status.y < y_pos
         @window_status.y += 15
         @window_status.y = y_pos if @window_status.y > y_pos
      end  
      if @window_status.y > y_pos
         @window_status.y -= 15
         @window_status.y = y_pos if @window_status.y < y_pos        
       end            
  end   
  
  #--------------------------------------------------------------------------
  # ● reset_position
  #--------------------------------------------------------------------------     
  def reset_position(diretion)
      check_active_window
      check_active_picture
      case diretion
         when 0
            @window_status[@pw].y = -64
            @actor_picture[@pw].x = 100
         when 1  
            @window_status[@nw].y = 440
            @actor_picture[@nw].x = 400
      end        
  end  
  
  #--------------------------------------------------------------------------
  # ● update_select
  #--------------------------------------------------------------------------
  def update_select
       if Input.trigger?(Input::DOWN) or Input.trigger?(Input::LEFT)
          Sound.play_cursor
          @char_index += 1
          @char_index = 1 if @char_index > @char_max
          if @char_max < 3         
             reset_position(0)
          else  
             reset_position(1)
          end   
       elsif Input.trigger?(Input::UP) or Input.trigger?(Input::RIGHT)
          Sound.play_cursor
          @char_index -= 1
          @char_index = @char_max if @char_index < 1
          reset_position(0)
        elsif Input.trigger?(Input::C) or Input.trigger?(Input::B)  
         
         
          Sound.play_ok
         
          $game_party.add_actor(@char_index)
         
          SceneManager.return
       end
  end
end  


$mog_rgss3_scene_character_select = true








#==============================================================================
# ■ Window Menu Command
#==============================================================================
class Window_MenuCommand < Window_Command  
  
#------------------------------------------------------------------------------
# ● 加入菜单
#------------------------------------------------------------------------------     
  alias mog_Character_add_main_commands add_main_commands
  def add_main_commands
      mog_Character_add_main_commands
      add_command("另一种人物", :mog_Character, main_commands_enabled)
  end
end   

#==============================================================================
# ■ Scene Menu
#==============================================================================
class Scene_Menu < Scene_MenuBase
  
#------------------------------------------------------------------------------
# ●加入指令窗口
#------------------------------------------------------------------------------      
   alias mog_Character_create_command_window create_command_window
   def create_command_window
       mog_Character_create_command_window
       @command_window.set_handler(:mog_Character,     method(:command_Character_Select))
   end
   
#------------------------------------------------------------------------------
# ●生成窗口
#------------------------------------------------------------------------------        
   def command_Character_Select
      SceneManager.call(Scene_Character_Select)
   end

end   

[/pre]


 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)   
复制代码
可以用图片数字显示角色物理攻击,怎么才能同样的用图片数字显示属性有效度呢?          额,不用了,实验出来了 ,用 [pre lang="ruby" line="1"]draw_picture_number(100,220,(@actor.element_rate(1) * 100).to_i, "Number_char",1)
[/pre]  就行了!
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部