查看: 2230|回复: 7

[已经解决] 如何把角色的经验变成条并且显示在地图上

[复制链接]
梦石
5
星屑
1843
在线时间
340 小时
注册时间
2014-4-1
回帖
211
发表于 2017-7-23 20:13:35 | 显示全部楼层 |阅读模式

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

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

×
如题,想做一个ARPG(XAS系统),但是xas系统的hud没有显示经验条的,所以我想请教有没有办法把角色的经验变成条状然后显示在地图上,我使用过"地图显示血条魔条"这个脚本进行改造,但是发现这个脚本只能显示一个角色的经验,而且不能同步,大概就是在地图上有一个事件,对话能加经验,但是在那个脚本加上的经验不能显示出来,需要打开菜单再关闭才能同步,脚本如下,经验变成条的脚本[pre lang="ruby"]#  ●設定區域
#===================================

module WD
module Exp_Gauge
  #EXP條COLOR,請修改成TEXT文字
  EXP_GAUGE_COLOR1 = 6
  EXP_GAUGE_COLOR2 = 14
  
#EXP條文字顯示設定,true為打開,false為關閉
   EXP_TEXT_DISPLAY = true
end
end

#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  ゲーム中の全てのウィンドウのスーパークラスです。
#==============================================================================

class Window_Base < Window
  include WD::Exp_Gauge

  def exp_gauge_color1;   text_color(EXP_GAUGE_COLOR1);  end;    # EXP ゲージ 1
  def exp_gauge_color2;   text_color(EXP_GAUGE_COLOR2);  end;    # EXP ゲージ 2

  #--------------------------------------------------------------------------
  # ● シンプルなステータスの描画
  #--------------------------------------------------------------------------
  def draw_actor_simple_status(actor, x, y)
    draw_actor_name(actor, x, y + line_height * 0.5)
    draw_actor_level(actor, x, y - line_height * 0.5)
    draw_actor_icons(actor, x, y + line_height * 1.5)
    draw_actor_class(actor, x + 120, y - line_height * 0.5)
    draw_actor_hp(actor, x + 120, y + line_height * 0.5)
    draw_actor_mp(actor, x + 120, y + line_height * 1.5)
    draw_actor_exp(actor, x, y + line_height * 2.5, EXP_TEXT_DISPLAY)
  end
  #--------------------------------------------------------------------------
  # ● EXP の描画
  #--------------------------------------------------------------------------
  def draw_actor_exp(actor, x, y, display = true, width = 244)
    this_level = actor.exp - actor.past_level_exp
    next_level = actor.next_level_exp - actor.past_level_exp
    draw_gauge(x, y, width, actor.exp_rate, exp_gauge_color1, exp_gauge_color2)
    change_color(system_color)
    if display
      draw_text(x, y, 30, line_height, "EXP")
      draw_current_and_max_values(x, y, width, this_level, next_level, mp_color(actor), normal_color)
    end
  end
end

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● EXP の割合を取得
  #--------------------------------------------------------------------------
  def exp_rate
    this_level = exp - past_level_exp
    next_level = next_level_exp - past_level_exp
    next_level > 0 ? this_level.to_f / next_level : 0
  end
  #--------------------------------------------------------------------------
  # ● 前のレベルの経験値を取得
  #--------------------------------------------------------------------------
  def past_level_exp
    @level > 1 ? exp_for_level(@level - 1) : 0
  end
end
[/pre]
地图显示经验条的脚本[pre lang="ruby"]#============================================================================
#  〇 地图显示血条魔条
#                   ——By.冰舞蝶恋
#----------------------------------------------------------------------------
#     说明:显示的文字可自由更动来达到游戏需要的效果。
#----------------------------------------------------------------------------
#     以下是作者的白痴留言,尽管无视吧!
#     啊哈哈!这可是咱第一个独立完成的脚本吖!!
#     一时无聊做的……兴许可以用在ARPG之类的地方吧。偶然看到有不少人在拿RM做
#     ARPG,又发现似乎没有(除了邪恶的fux2字眼的那个- -||b),做了个比较完善
#     的……排版不是很好看,坐标可以自己调整。
#============================================================================
#   ○ACE移植
#                   ——By.米酒獭酱
#只是把这个脚本移植到了ACE上,因为找不到ACE代表魔攻魔防的系统变量所以舍去了,
#若大家找到了也可以加上~
#总之这个脚本就是集显示图片显示头像显示变量显示金钱什么的为一体的脚本~
#(话说本人也是第一次弄脚本竟然就移植成功了)
# 坐标可以自由调整+1~
$LBA = 20  # 当这个开挂开启时,地图状态才显示。
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
#  处理地图画面的类。
#==============================================================================
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● 開始処理
  #--------------------------------------------------------------------------
  alias map_windpwz_start start
  def start
    map_windpwz_start
    @mapz_window = Window_MapZ.new(0, 0)
    @mapz_window.refresh
    @mapz_window.hide
  end
  alias map_windpwz_update update
  def update
    map_windpwz_update
    @mapz_window.visible = $game_switches[$LBA]
  end
end
class Window_MapZ < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize(x,y)
    super(-12, -12, 544+16,416+16)
    self.opacity = 0
    update
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
   self.contents.clear
#~    draw_actor_face($game_actors[1],0 ,0 )
   #$game_map.screen.pictures[1].show("你要显示的图片名", 0, 0, 0, 100, 100, 255, 0) #若要使用请取消注释
#~    draw_actor_hp($game_actors[1], 80+12, 0, 160)
#~    draw_actor_mp($game_actors[1], 80+12, 32, 160)
   draw_actor_exp($game_actors[1], 10, 300, 160)
   self.contents.font.color = normal_color
#~    self.contents.draw_text(84+12, 52+8, 544, 24, "#{$game_actors[1].name}  Lv.#{$game_actors[1].level}")
   self.contents.font.color = system_color
#~    self.contents.draw_text(0+96+120+40, 0-4, 544, 24, "攻:")
#~    self.contents.draw_text(0+96+120+40, 22-4, 544, 24, "防:")
#~    self.contents.draw_text(0+96+120+96+40, 0-4, 544, 24, "所持金钱:")
#~    self.contents.draw_text(-18, 22-4, 544, 24, "G", 2)
   self.contents.font.color = normal_color
#~    self.contents.draw_text(-456+96+120+40, 0-4, 544, 24, $game_actors[1].atk, 2)
#~    self.contents.draw_text(-456+96+120+40, 22-4, 544, 24, $game_actors[1].def, 2)
#~    self.contents.draw_text(-36, 22-4, 544, 24, $game_party.gold, 2)   
   self.contents.font.color = text_color(5)#改颜色什么的~
#~    self.contents.draw_text(0,380 , 534, 24, "显示变量的名字:#{ $game_variables[13]}")
  end
end[/pre]
谢谢大神们
梦石
0
星屑
50
在线时间
7 小时
注册时间
2017-7-8
回帖
19
发表于 2017-7-23 20:50:20 | 显示全部楼层
弄一个并行处理的事件来指向它试试?

点评

请问指向什么意思  发表于 2017-7-23 20:59
回复

使用道具 举报

梦石
0
星屑
7230
在线时间
1685 小时
注册时间
2017-4-28
回帖
84

开拓者

发表于 2017-7-23 21:17:43 | 显示全部楼层
本帖最后由 gforce 于 2017-7-23 21:21 编辑

XAS的hud有顯示經驗條
如果你用的是66rpg上的XAS漢化版
把XAS脚本中   -> Active HUD 的部分
第267行及699行的
  1. rate = @actor.now_exp.to_f / @actor.next_exp
复制代码

改為
  1. rate = (@actor.exp - @actor.now_exp.to_f) / (@actor.next_exp - @actor.now_exp.to_f)
复制代码

你就可以看見那精美的粉紅色的經驗條。

点评

这个可行!  发表于 2017-7-23 21:36
请问这个经验条有没有办法改得长一点粗一点呢  发表于 2017-7-23 21:27

评分

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

查看全部评分

回复

使用道具 举报

梦石
5
星屑
1843
在线时间
340 小时
注册时间
2014-4-1
回帖
211
 楼主| 发表于 2017-7-23 21:37:14 | 显示全部楼层
gforce 发表于 2017-7-23 21:17
XAS的hud有顯示經驗條
如果你用的是66rpg上的XAS漢化版
把XAS脚本中   -> Active HUD 的部分

请问有没有办法把经验条改得长一点粗一点

点评

你可以試試修改"Hud_Layout"及"Hud_Exp_Meter"兩張圖片,"Hud_Exp_Meter"圖片大小直接影響经验条的大小  发表于 2017-7-23 21:45
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部