查看: 1830|回复: 1

[已经过期] 发一个修改过的地图显示领队状态的脚本

[复制链接]
梦石
0
星屑
50
在线时间
18 小时
注册时间
2015-12-25
回帖
23
发表于 2016-3-27 16:38:16 | 显示全部楼层 |阅读模式

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

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

×
这是945窗口教程进行修改之后的脚本,增加了按F6打开关闭状态栏的功能。不过我是要请教一下,如何在状态栏开闭渐变过程中,角色依旧可以行走。求高手解答。



  1. #==============================================================================
  2. # ■ Class_Actor
  3. #==============================================================================
  4. class Game_Actor < Game_Battler

  5.   alias moming_refresh refresh
  6.   alias moming_tp tp=
  7.   alias moming_add_state add_state
  8.   #--------------------------------------------------------------------------
  9.   # ● 刷新
  10.   #--------------------------------------------------------------------------
  11.   def refresh
  12.     moming_refresh
  13.     $refresh = true
  14.   end
  15.   #----------------------------------------------------------------------------
  16.   # ● 更改 TP
  17.   #----------------------------------------------------------------------------
  18.   def tp=(tp)
  19.     moming_tp(tp)
  20.     $refresh = true
  21.   end
  22.   #----------------------------------------------------------------------------
  23.   # ● 附加状态
  24.   #----------------------------------------------------------------------------
  25.   def add_state(state_id)
  26.     moming_add_state(state_id)
  27.     $refresh = true
  28.   end
  29. end

  30. #==============================================================================
  31. # ■ Game_Party
  32. #==============================================================================
  33. class Game_Party
  34.   
  35.   alias moming_swap_order swap_order
  36.   #----------------------------------------------------------------------------
  37.   # ● 交换顺序
  38.   #----------------------------------------------------------------------------
  39.   def swap_order(index1, index2)
  40.     moming_swap_order(index1, index2)
  41.     $refresh = true
  42.   end
  43. end
  44. #==============================================================================
  45. # ■ Window_MapStatus
  46. #==============================================================================
  47. class Window_MapStatus < Window_Base
  48.   #----------------------------------------------------------------------------
  49.   # ● 初始化
  50.   #----------------------------------------------------------------------------
  51.    def initialize
  52.     super(0, 0, 273, 144)
  53.     self.opacity = 0
  54.     refresh
  55.   end
  56.   
  57.   #----------------------------------------------------------------------------
  58.   # ● 刷新画面
  59.   #----------------------------------------------------------------------------
  60.   def update
  61.     super
  62.    
  63.     refresh if $refresh
  64.     $refresh = false
  65.     if contents_opacity != 0
  66.       if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and
  67.        $game_player.screen_y >= 0 and $game_player.screen_y <= self.height
  68.       self.contents_opacity = 75
  69.       else self.contents_opacity = 255
  70.       end
  71.     end
  72.   end
  73.   #----------------------------------------------------------------------------
  74.   # ● 更新内容
  75.   #----------------------------------------------------------------------------
  76.   def refresh
  77.     contents.clear
  78.     draw_actor_face($game_party.members[0], 0, 0)
  79.     contents.draw_text(0,0,contents.width,24,$game_party.members[0].name,2)
  80.     draw_actor_level($game_party.members[0], 101, 0)
  81.     draw_actor_icons($game_party.members[0], 0, 72)
  82.     draw_actor_hp($game_party.members[0], 101, 24, self.contents.width - 101)
  83.     draw_actor_mp($game_party.members[0], 101, 48, self.contents.width - 101)
  84.     draw_actor_tp($game_party.members[0], 101, 72, self.contents.width - 101)
  85.     draw_actor_exp($game_party.members[0], 0, 96, self.contents.width)
  86.   end
  87.   #----------------------------------------------------------------------------
  88.   # ● 描绘EXP槽
  89.   #----------------------------------------------------------------------------
  90.   def draw_actor_exp(actor, x, y, width=124)
  91.     rate = actor.exp.to_f / actor.next_level_exp.to_f
  92.     draw_gauge(x, y, width, rate, Color.new(0, 255, 0), Color.new(100, 255, 100))
  93.     self.contents.font.color = text_color(16)
  94.     self.contents.draw_text(x, y, 56, 24, "EXP")
  95.     self.contents.font.color = Color.new(255, 255, 255)
  96.     en = "#{actor.exp}/#{actor.next_level_exp}"
  97.     self.contents.draw_text(x, y, width, 24, en, 2)
  98.   end
  99.   #----------------------------------------------------------------------------
  100.   # ● 描绘值槽
  101.   #----------------------------------------------------------------------------
  102.   def draw_gauge(x, y, width, rate, color1, color2)
  103.     fill_w = (width * rate).to_i
  104.     self.contents.gradient_fill_rect(x, y+12, fill_w, 6, color1, color2, true)
  105.     self.contents.gradient_fill_rect(x, y+18, fill_w, 6, color2, color1, true)
  106.     self.contents.fill_rect(x, y+12, width, 1, Color.new(255, 255, 255))
  107.     self.contents.fill_rect(x, y+22, width, 1, Color.new(255, 255, 255))
  108.     self.contents.fill_rect(x, y+14, 1, 8, Color.new(255, 255, 255))
  109.     self.contents.fill_rect(x+width-2, y+14, 1, 8, Color.new(255, 255, 255))
  110.   end
  111. end

  112. #==============================================================================
  113. # ■ Scene_Map
  114. #==============================================================================


  115. class Scene_Map < Scene_Base
  116.   #----------------------------------------------------------------------------
  117.   # ● 重命名方法
  118.   #----------------------------------------------------------------------------
  119.   alias moming_sta start
  120.   alias moming_update update
  121.   #----------------------------------------------------------------------------
  122.   # ● 开始处理
  123.   #----------------------------------------------------------------------------
  124.   def start
  125.     moming_sta
  126.     @mapstatus_window = Window_MapStatus.new
  127.   end
  128.   #----------------------------------------------------------------------------
  129.   # ● 更新处理
  130.   #----------------------------------------------------------------------------
  131.   def update
  132.     moming_update
  133.     ms_update_input
  134.   end
  135.   #----------------------------------------------------------------------------
  136.   # ● 按键检测
  137.   #----------------------------------------------------------------------------  
  138.   def ms_update_input
  139.     if Input.trigger?(:F6)
  140.       if @mapstatus_window.contents_opacity != 0
  141.         gra_close
  142.       else
  143.         gra_open
  144.       end
  145.     end
  146.   end
  147.   #----------------------------------------------------------------------------
  148.   # ● 定义窗口淡入、淡出
  149.   #----------------------------------------------------------------------------  
  150.   def gra_close
  151.     60.times do |i|
  152.       @mapstatus_window.contents_opacity -= 4.25
  153.       Graphics.update
  154.       
  155.     end
  156.   end
  157.   
  158.   def gra_open
  159.     60.times do |i|
  160.       @mapstatus_window.contents_opacity += 4.25
  161.       Graphics.update
  162.     end
  163.   end
  164.    
  165. end
  166. #转自945窗口脚本教程,并稍作修改。
  167.   
  168.   


  169.    
  170.    
  171.    
  172.    
  173.    
  174.    
  175.    
复制代码
梦石
0
星屑
50
在线时间
18 小时
注册时间
2015-12-25
回帖
23
 楼主| 发表于 2016-3-28 22:01:30 来自手机 | 显示全部楼层
这就沉了?咋没人愿意试试呢?
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部