Project1

标题: 新人求教一些脚本问题,地图显示变量 [打印本页]

作者: kalinnuo    时间: 2014-11-19 22:29
标题: 新人求教一些脚本问题,地图显示变量
本帖最后由 VIPArcher 于 2014-11-20 11:23 编辑

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

时间是用自带的变量和公共事件设置的↓


大概就是这个样子↓


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

RGSS3 代码复制
  1. class Game_Actor < Game_Battler
  2.   #----------------------------------------------------------------------------
  3.   # * 重命名方法
  4.   #----------------------------------------------------------------------------
  5.   alias ms_refresh refresh
  6.   alias ms_tp tp=
  7.   alias ms_add_state add_state
  8.   #--------------------------------------------------------------------------
  9.   # * 刷新
  10.   #--------------------------------------------------------------------------
  11.   def refresh
  12.     ms_refresh
  13.     $refresh = true
  14.   end
  15.   #----------------------------------------------------------------------------
  16.   # * 更改 TP
  17.   #----------------------------------------------------------------------------
  18.   def tp=(tp)
  19.     ms_tp(tp)
  20.     $refresh = true
  21.   end
  22.   #----------------------------------------------------------------------------
  23.   # * 附加状态
  24.   #----------------------------------------------------------------------------
  25.   def add_state(state_id)
  26.     ms_add_state(state_id)
  27.     $refresh = true
  28.   end
  29. end
  30. class Game_Party
  31.   #----------------------------------------------------------------------------
  32.   # * 重命名方法
  33.   #----------------------------------------------------------------------------
  34.   alias ms_swap_order swap_order
  35.   #----------------------------------------------------------------------------
  36.   # * 交换顺序
  37.   #----------------------------------------------------------------------------
  38.   def swap_order(index1, index2)
  39.     ms_swap_order(index1, index2)
  40.     $refresh = true
  41.   end
  42. end
  43. #==============================================================================
  44. # ** Window_MapStatus
  45. #==============================================================================
  46. class Window_MapStatus < Window_Base
  47.   #----------------------------------------------------------------------------
  48.   # * 初始化
  49.   #----------------------------------------------------------------------------
  50.   def initialize
  51.     super(0, 0, 273, 144)
  52.     self.opacity = 0
  53.     refresh
  54.   end
  55.   #----------------------------------------------------------------------------
  56.   # * 刷新画面
  57.   #----------------------------------------------------------------------------
  58.   def update
  59.     super
  60.     refresh if $refresh
  61.     $refresh = false
  62.     if $game_player.screen_x >= 0 and $game_player.screen_x <= self.width and
  63.        $game_player.screen_y >= 0 and $game_player.screen_y <= self.height
  64.       self.contents_opacity = 75
  65.     else self.contents_opacity = 255
  66.     end
  67.   end
  68.   #----------------------------------------------------------------------------
  69.   # * 更新内容
  70.   #----------------------------------------------------------------------------
  71.   def refresh
  72.     self.contents.clear
  73.     draw_actor_face($game_party.members[0], 0, 0)
  74.     draw_actor_icons($game_party.members[0], 0, 72)
  75.     draw_actor_name($game_party.members[0], 101, 24)
  76.     draw_currency_value($game_party.gold, Vocab::currency_unit, 72, 0, self.contents.width-101)
  77.     draw_actor_nickname($game_party.members[0], 101, 48)
  78.     draw_text(101,72, self.contents.width,24,$game_variables[97])
  79.     draw_text(137,72, self.contents.width,24,"时")
  80.     draw_text(  0,96, self.contents.width,24,$game_variables[100])
  81.     draw_text( 51,96, self.contents.width,24,"年")
  82.     draw_text( 85,96, self.contents.width,24,$game_variables[99])
  83.     draw_text(119,96, self.contents.width,24,"月")
  84.     draw_text(153,96, self.contents.width,24,$game_variables[98])
  85.     draw_text(187,96, self.contents.width,24,"日")
  86.   end
  87. end
  88. class Scene_Map < Scene_Base
  89.   #----------------------------------------------------------------------------
  90.   # * 重命名方法
  91.   #----------------------------------------------------------------------------
  92.   alias ms_sta start
  93.   #----------------------------------------------------------------------------
  94.   # * 开始处理
  95.   #----------------------------------------------------------------------------
  96.   def start
  97.     ms_sta
  98.     @mapstatus_window = Window_MapStatus.new
  99.   end
  100. end


作者: VIPArcher    时间: 2014-11-19 22:55
以前在@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
复制代码
未测试
作者: kalinnuo    时间: 2014-11-19 23:02
VIPArcher 发表于 2014-11-19 22:55
以前在@taroxd 君那里get 的技能。未测试

QAQ!!!射射大大!!!!!




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1