查看: 2815|回复: 3

[已经解决] 如何显示变量

[复制链接]
梦石
0
星屑
50
在线时间
55 小时
注册时间
2012-10-25
回帖
105
发表于 2013-3-20 13:06:43 | 显示全部楼层 |阅读模式

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

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

×
RT,就是比如说我设置了一个声望变量,可以让玩家看到
这是个好地方!这里
梦石
0
星屑
143
在线时间
347 小时
注册时间
2010-7-7
回帖
96
发表于 2013-3-20 13:20:31 | 显示全部楼层
本帖最后由 yjl494356020 于 2013-3-20 13:21 编辑

这个是地图信息的脚本,可以参照一下在你想要的地方加入“声望”的变量值。
[pre lang="ruby" line="1"]#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
#  处理玩家人物的类。拥有事件启动的判定、地图的卷动等功能。
#   本类的实例请参考 $game_player 。
#==============================================================================

class Game_Player < Game_Character
  
  def getX
    @x
  end
  
  def getY
    @y
  end
  
end

#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
#  菜单画面
#==============================================================================

class Scene_Menu < Scene_MenuBase

  #--------------------------------------------------------------------------
  # ● 生成窗口
  #--------------------------------------------------------------------------
  def create_gold_window
    @gold_window = Window_Gold.new
    @gold_window.x = 0
    @gold_window.y = Graphics.height - @gold_window.height
    # 生成地图信息窗口
    @mapinfos_window = Window_MapInfo.new
    @mapinfos_window.x = 0
    @mapinfos_window.y = Graphics.height - @mapinfos_window.height - @gold_window.height
   
  end
  
end

#==============================================================================
# ■ Window_MapInfo
#------------------------------------------------------------------------------
#  显示当前信息的窗口。 By SkyZH
#==============================================================================

class Window_MapInfo < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, window_width, 120)
    self.opacity = 255
    refresh
  end
  #--------------------------------------------------------------------------
  # ● 获取窗口的宽度
  #--------------------------------------------------------------------------
  def window_width
    return 160
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    @a=$game_map.width
    @b=$game_map.height
    draw_text(0, 0,             window_width-24, line_height,"地图 " + $game_map.display_name)   
    draw_text(0, line_height,   window_width-24, line_height,"坐标 " + "X" + $game_player.getX.to_s + "," + "Y" + $game_player.getY.to_s)
    draw_text(0, line_height*2, window_width-24, line_height,"时间 " + $game_system.playtime_s)
    draw_text(0, line_height*3, window_width-24, line_height,"声望 " + $game_variables[6].to_s)
  end
end

class Spriteset_Map
  #--------------------------------------------------------------------------
  # ● 初始化对象
  #--------------------------------------------------------------------------
  def initialize
    create_viewports
    create_tilemap
    create_parallax
    create_characters
    create_shadow
    create_weather
    create_pictures
    create_timer
    @MapInfoWin=Window_MapInfo.new
    update
  end
  
  def dispose
    dispose_tilemap
    dispose_parallax
    dispose_characters
    dispose_shadow
    dispose_weather
    dispose_pictures
    dispose_timer
    dispose_viewports
    @MapInfoWin.dispose
  end
  
  def update
    update_tileset
    update_tilemap
    update_parallax
    update_characters
    update_shadow
    update_weather
    update_pictures
    update_timer
    update_viewports
    if $game_switches[40]==false then #通过40号开关控制信息窗口是否显示
      @MapInfoWin.visible=false
    else
      @MapInfoWin.visible=true
    end
    @MapInfoWin.refresh
  end

end[/pre]
111111.jpg
其中draw_text(0, line_height*3, window_width-24, line_height,"声望 " + $game_variables[6].to_s)
的$game_variables[6].to_s就是6号变量
回复

使用道具 举报

梦石
0
星屑
50
在线时间
55 小时
注册时间
2012-10-25
回帖
105
 楼主| 发表于 2013-3-20 18:09:50 | 显示全部楼层
yjl494356020 发表于 2013-3-20 13:20
这个是地图信息的脚本,可以参照一下在你想要的地方加入“声望”的变量值。
#============================ ...

我是脚本盲。。。能不能发范例
这是个好地方!这里
回复

使用道具 举报

梦石
0
星屑
143
在线时间
347 小时
注册时间
2010-7-7
回帖
96
发表于 2013-3-20 19:31:43 | 显示全部楼层
冰动南瓜 发表于 2013-3-20 18:09
我是脚本盲。。。能不能发范例

999K限制,自己放RGSS吧。。。
Project001.rar (300.76 KB, 下载次数: 96)

点评

谢谢  发表于 2013-3-21 12:57
其實有安裝VA的RGSS3.dll會自己裝.. (xp跟vx不管怎麼都要裝)  发表于 2013-3-21 09:01

评分

参与人数 1星屑 +100 梦石 +1 收起 理由
Mic_洛洛 + 100 + 1 认可答案

查看全部评分

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部