查看: 2324|回复: 2

[已经解决] 新人求教一些脚本问题,地图显示变量

[复制链接]
梦石
0
星屑
995
在线时间
6 小时
注册时间
2014-7-26
回帖
1
发表于 2014-11-19 22:29:57 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 VIPArcher 于 2014-11-20 11:23 编辑

因为不懂写脚本,都是在论坛里找一些脚本来改数据
根据@945127391 大大教程里的脚本改了一下来显示时间

时间是用自带的变量和公共事件设置的↓
微博桌面截图_20141119222224.jpg

大概就是这个样子↓
微博桌面截图_20141119221946.jpg

但是触发更改时间和金钱的事件不会马上刷新数据,比如初始金币是0,触发了给金币的事件之后还是显示0,打开一下菜单再关掉才会显示出当前的金钱,时间也是,不会即时刷新。
求教一下要怎么改才能让数据一更改就刷新。

[pre lang="RGSS3" line="1"]class Game_Actor < Game_Battler
  #----------------------------------------------------------------------------
  # * 重命名方法
  #----------------------------------------------------------------------------
  alias ms_refresh refresh
  alias ms_tp tp=
  alias ms_add_state add_state
  #--------------------------------------------------------------------------
  # * 刷新
  #--------------------------------------------------------------------------
  def refresh
    ms_refresh
    $refresh = true
  end
  #----------------------------------------------------------------------------
  # * 更改 TP
  #----------------------------------------------------------------------------
  def tp=(tp)
    ms_tp(tp)
    $refresh = true
  end
  #----------------------------------------------------------------------------
  # * 附加状态
  #----------------------------------------------------------------------------
  def add_state(state_id)
    ms_add_state(state_id)
    $refresh = true
  end
end
class Game_Party
  #----------------------------------------------------------------------------
  # * 重命名方法
  #----------------------------------------------------------------------------
  alias ms_swap_order swap_order
  #----------------------------------------------------------------------------
  # * 交换顺序
  #----------------------------------------------------------------------------
  def swap_order(index1, index2)
    ms_swap_order(index1, index2)
    $refresh = true
  end
end
#==============================================================================
# ** Window_MapStatus
#==============================================================================
class Window_MapStatus < Window_Base
  #----------------------------------------------------------------------------
  # * 初始化
  #----------------------------------------------------------------------------
  def initialize
    super(0, 0, 273, 144)
    self.opacity = 0
    refresh
  end
  #----------------------------------------------------------------------------
  # * 刷新画面
  #----------------------------------------------------------------------------
  def update
    super
    refresh if $refresh
    $refresh = false
    if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and
       $game_player.screen_y >= 0 and $game_player.screen_y <= self.height
      self.contents_opacity = 75
    else self.contents_opacity = 255
    end
  end
  #----------------------------------------------------------------------------
  # * 更新内容
  #----------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_face($game_party.members[0], 0, 0)
    draw_actor_icons($game_party.members[0], 0, 72)
    draw_actor_name($game_party.members[0], 101, 24)
    draw_currency_value($game_party.gold, Vocab::currency_unit, 72, 0, self.contents.width-101)
    draw_actor_nickname($game_party.members[0], 101, 48)
    draw_text(101,72, self.contents.width,24,$game_variables[97])
    draw_text(137,72, self.contents.width,24,"时")
    draw_text(  0,96, self.contents.width,24,$game_variables[100])
    draw_text( 51,96, self.contents.width,24,"年")
    draw_text( 85,96, self.contents.width,24,$game_variables[99])
    draw_text(119,96, self.contents.width,24,"月")
    draw_text(153,96, self.contents.width,24,$game_variables[98])
    draw_text(187,96, self.contents.width,24,"日")
  end
end
class Scene_Map < Scene_Base
  #----------------------------------------------------------------------------
  # * 重命名方法
  #----------------------------------------------------------------------------
  alias ms_sta start
  #----------------------------------------------------------------------------
  # * 开始处理
  #----------------------------------------------------------------------------
  def start
    ms_sta
    @mapstatus_window = Window_MapStatus.new
  end
end[/pre]

点评

头像是仙人模式吗  发表于 2014-11-20 22:54

无限の剣制

梦石
0
星屑
10450
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-11-19 22:55:20 | 显示全部楼层
以前在@taroxd 君那里get 的技能。

  1. #==============================================================================

  2. # ** Window_MapStatus

  3. #==============================================================================

  4. class Window_MapStatus < Window_Base

  5.   #----------------------------------------------------------------------------

  6.   # * 初始化

  7.   #----------------------------------------------------------------------------

  8.   def initialize

  9.     super(0, 0, 273, 144)

  10.     self.opacity = 0

  11.     refresh

  12.   end

  13.   #----------------------------------------------------------------------------

  14.   # * 检查内容变化

  15.   #----------------------------------------------------------------------------
  16.   def map_status_to_draw
  17.     [$game_party.members[0],$game_party.gold,$game_variables[97],$game_variables[98],
  18.     $game_variables[99],$game_variables[100]]
  19.   end
  20.   #----------------------------------------------------------------------------

  21.   # * 刷新画面

  22.   #----------------------------------------------------------------------------

  23.   def update

  24.     super

  25.     refresh if @map_status_to_draw != map_status_to_draw #检查内容变化

  26.   end

  27.   #----------------------------------------------------------------------------

  28.   # * 更新内容

  29.   #----------------------------------------------------------------------------

  30.   def refresh

  31.     self.contents.clear
  32.    
  33.     @map_status_to_draw = map_status_to_draw #设置变化
  34.    
  35.     draw_actor_face($game_party.members[0], 0, 0)

  36.     draw_actor_icons($game_party.members[0], 0, 72)

  37.     draw_actor_name($game_party.members[0], 101, 24)

  38.     draw_currency_value($game_party.gold, Vocab::currency_unit, 72, 0, self.contents.width-101)

  39.     draw_actor_nickname($game_party.members[0], 101, 48)

  40.     draw_text(101,72, self.contents.width,24,$game_variables[97])

  41.     draw_text(137,72, self.contents.width,24,"时")

  42.     draw_text(  0,96, self.contents.width,24,$game_variables[100])

  43.     draw_text( 51,96, self.contents.width,24,"年")

  44.     draw_text( 85,96, self.contents.width,24,$game_variables[99])

  45.     draw_text(119,96, self.contents.width,24,"月")

  46.     draw_text(153,96, self.contents.width,24,$game_variables[98])

  47.     draw_text(187,96, self.contents.width,24,"日")

  48.   end

  49. end

  50. class Scene_Map < Scene_Base

  51.   #----------------------------------------------------------------------------

  52.   # * 重命名方法

  53.   #----------------------------------------------------------------------------

  54.   alias ms_sta start

  55.   #----------------------------------------------------------------------------

  56.   # * 开始处理

  57.   #----------------------------------------------------------------------------

  58.   def start

  59.     ms_sta

  60.     @mapstatus_window = Window_MapStatus.new

  61.   end

  62. end
复制代码
未测试

点评

如果这个不行你就自己试试吧,参考链接http://rm.66rpg.com/thread-369398-1-1.html  发表于 2014-11-19 23:03

评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
995
在线时间
6 小时
注册时间
2014-7-26
回帖
1
 楼主| 发表于 2014-11-19 23:02:04 | 显示全部楼层
VIPArcher 发表于 2014-11-19 22:55
以前在@taroxd 君那里get 的技能。未测试

QAQ!!!射射大大!!!!!
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部