Project1

标题: 请教地图左上角显示文字和变量 [打印本页]

作者: 木许许    时间: 2012-3-2 09:50
标题: 请教地图左上角显示文字和变量
按照地图ID,在相应的地图左上角显示文字和变量,当地图ID为10,左上角显示文字“时间槽:”,然后后面跟一个变量dsu_plus_rewardpost_czw
作者: hys111111    时间: 2012-3-2 13:26
请自行修改

  1. Playerdate_SWITCH = 1 # 当1号开关打开,本脚本才开始工作。
  2. Playerdate_magicdef =19
  3. Yellowkey_itemid=1
  4. Bluekey_itemid=2
  5. Redkey_itemid=3
  6. Greenkey_itemid=41

  7. #==============================================================================
  8. # ■ Window_PlayerDate
  9. #------------------------------------------------------------------------------
  10. #  显示玩家状态的窗口。
  11. #==============================================================================

  12. class Window_PlayerDate < Window_Base
  13.   #--------------------------------------------------------------------------
  14.   # ● 初始化窗口
  15.   #--------------------------------------------------------------------------
  16.   def initialize
  17.     super(0, 0, 160, 480)#395)#192,416
  18.     self.contents = Bitmap.new(width - 32, height - 32)
  19.     self.z =210
  20.     self.opacity=0
  21.     self.back_opacity =255
  22. #    self.contents_opacity = 255
  23.     self.visible = false
  24. #    self.contents.clear
  25.     refresh
  26. #    if $game_switches[XY_SWITCH]
  27. #      self.contents_opacity = 0
  28. #    else
  29. #      self.contents_opacity = 5
  30. #    end
  31.    
  32.   end
  33.   
  34.   
  35.   def refresh
  36.     if $game_switches[50]#进入屏幕右侧状态栏换到左侧
  37.       self.x=0
  38.     else#进入屏幕左侧状态栏换到右侧
  39.       self.x=480
  40.     end

  41.     self.contents.clear
  42.     x=25
  43.     x=30 if !$game_switches[27]
  44.     y=75
  45.     y=40 if !$game_switches[27]
  46.     #actor = $game_party.actors[1]
  47.     draw_actor_graphic($game_party.actors[0], 20, 35)

  48.     self.contents.font.color = system_color
  49.     self.contents.draw_text(40, 11, 25, 20, "第", 0) if $game_switches[36]
  50.     self.contents.draw_text(100, 11, 25, 20, "层", 0)if $game_switches[36]
  51.     self.contents.draw_text(0, 55, 50, 20, "等级", 0)
  52.    
  53.     if $game_switches[42]
  54.       a=$game_variables[1]+81
  55.       if $game_variables[1]==3
  56.         a=116
  57.       end
  58.       if $game_variables[a]!=0
  59.         bitmap = Bitmap.new("Graphics/Pictures/up.png")
  60.         self.contents.blt(40,55 , bitmap, Rect.new(0, 0, 20, 20))
  61.       end
  62.     end

  63.     self.contents.draw_text(4, 65+x, 40, 20, "生命", 0)
  64.     self.contents.draw_text(4, 65+x*2, 40, 20, "攻击", 0)
  65.     self.contents.draw_text(4, 65+x*3, 40, 20,"防御", 0)
  66.     self.contents.draw_text(4, 65+x*4, 40, 20, "魔防", 0) if $game_switches[Playerdate_magicdef]
  67.     self.contents.draw_text(4, 65+x*5, 40, 20, "速度", 0) if $game_switches[27]

  68.     self.contents.draw_text(4, y+x*6, 40, 20, "经验", 0)
  69.     self.contents.draw_text(4, y+x*7, 40, 20, "金币", 0)

  70.     if $game_switches[26]
  71.       bitmap = RPG::Cache.icon("101-01")#黄钥匙)
  72.       self.contents.blt(10, 280, bitmap, Rect.new(0, 0, 32, 32))   
  73.       bitmap = RPG::Cache.icon("101-02")#蓝钥匙)
  74.       self.contents.blt(10, 307, bitmap, Rect.new(0, 0, 32, 32))
  75.       bitmap = RPG::Cache.icon("101-03")#红钥匙)
  76.       self.contents.blt(10, 334, bitmap, Rect.new(0, 0, 32, 32))
  77.       bitmap = RPG::Cache.icon("101-04") if $game_switches[43]#绿钥匙)
  78.       self.contents.blt(10, 361, bitmap, Rect.new(0, 0, 32, 32)) if $game_switches[43]

  79.     else
  80.       self.contents.font.color = text_color(6)   
  81.       self.contents.draw_text(8, 285, 50, 20, "黄钥匙", 0)
  82.       self.contents.font.color = text_color(4)   
  83.       self.contents.draw_text(8, 313, 50, 20, "蓝钥匙", 0)
  84.       self.contents.font.color = text_color(2)   
  85.       self.contents.draw_text(8, 341, 50, 20, "红钥匙", 0)
  86.       self.contents.font.color = text_color(3)   
  87.       self.contents.draw_text(8, 369, 50, 20, "绿钥匙", 0) if $game_switches[43]
  88.     end
  89.    
  90.     @xgraphic=$game_party.actors[0].character_name
  91.     @xfloor=$game_variables[2]
  92.     @xlevel=$game_actors[$game_variables[1]+1].level
  93.     @xlevelup=$game_variables[$game_variables[1]+81] if $game_switches[42]
  94.     @xlife=$game_actors[$game_variables[1]+1].hp
  95.     @xattact=$game_actors[$game_variables[1]+1].str
  96.     @xdefence=$game_actors[$game_variables[1]+1].dex
  97.     @xmagicdef=$game_actors[$game_variables[1]+1].int if $game_switches[Playerdate_magicdef]
  98.     @xspeed=$game_actors[$game_variables[1]+1].agi if $game_switches[27]
  99.     @xexp= $game_actors[$game_variables[1]+1].exp
  100.     @xgold=$game_party.gold
  101.     @xyellowkey=$game_party.item_number(Yellowkey_itemid)
  102.     @xbluekey=$game_party.item_number(Bluekey_itemid)
  103.     @xredkey=$game_party.item_number(Redkey_itemid)
  104.     @xgreenkey=$game_party.item_number(Greenkey_itemid) if $game_switches[43]
  105.     @xpoison=$game_switches[13]
  106.     @xpoor=$game_switches[15]
  107.     @xcurse=$game_switches[16]
  108.     @xslow=$game_switches[12]
  109.     @xchange=$game_switches[50]
  110.    
  111.    
  112.     self.contents.font.color = normal_color
  113.     self.contents.draw_text(32, 0, 60, 45, @xfloor.to_s, 2) if $game_switches[36]
  114.     self.contents.draw_text(40, 0, 80, 45, @xfloor.to_s, 2) if !$game_switches[36]
  115.    
  116.     self.contents.draw_text(50, 50, 65, 30, @xlevel.to_s, 2)
  117.     self.contents.draw_text(50, 50, 20, 35, @xname.to_s, 2)
  118.     self.contents.draw_text(43, 65+x, 72, 20,@xlife .to_s, 2)
  119.     self.contents.draw_text(50, 65+x*2, 65, 20,@xattact .to_s, 2)
  120.     self.contents.draw_text(50, 65+x*3, 65, 20,@xdefence .to_s, 2)
  121.     self.contents.draw_text(50, 65+x*4, 65, 20,@xmagicdef .to_s, 2) if $game_switches[Playerdate_magicdef]
  122.     self.contents.draw_text(50, 65+x*5, 65, 20,@xspeed .to_s, 2) if $game_switches[27]

  123.     self.contents.draw_text(50, y+x*6, 65, 20,@xexp.to_s, 2)
  124.     self.contents.draw_text(50, y+x*7, 65, 20, @xgold.to_s, 2)
  125.    
  126.     self.contents.font.color = text_color(6)
  127.     self.contents.draw_text(75, 285, 25, 20, @xyellowkey.to_s, 2)
  128.     self.contents.font.color = text_color(4)
  129.     self.contents.draw_text(75, 313, 25, 20, @xbluekey .to_s, 2)
  130.     self.contents.font.color = text_color(2)
  131.     self.contents.draw_text(75, 341, 25, 20, @xredkey.to_s, 2)
  132.     self.contents.font.color = text_color(3)
  133.     self.contents.draw_text(75, 369, 25, 20, @xgreenkey.to_s, 2) if $game_switches[43]
  134.    
  135.     self.contents.font.color = text_color(3)
  136.     self.contents.draw_text(8, 390, 30, 30, "毒".to_s, 0) if $game_switches[13]
  137.     self.contents.font.color = text_color(5)
  138.     self.contents.draw_text(36, 390, 30, 30, "衰".to_s, 0) if $game_switches[15]
  139.     self.contents.font.color = text_color(4)
  140.     self.contents.draw_text(64, 390, 30, 30, "咒".to_s, 0) if $game_switches[16]
  141.     self.contents.font.color = Color.new(rand(255),rand(255),rand(255))
  142.     self.contents.draw_text(64, 390, 30, 30, "胡".to_s, 0) if $game_switches[56]
  143.     self.contents.font.color = text_color(1)
  144.     self.contents.draw_text(92, 390, 30, 30, "慢".to_s, 0) if $game_switches[12]
  145.     self.contents.font.color = Color.new(0,255,255)
  146.     self.contents.draw_text(92, 390, 30, 30, "反".to_s, 0) if $game_switches[57]
  147.    
  148.    
  149.    
  150.   end
  151.   
  152.   def judge#用于判断是否数据变更,节约内存
  153.     return true if @xgraphic!=$game_party.actors[0].character_name
  154.     return true if @xfloor!=$game_variables[2]
  155.     return true if @xlevel!=$game_actors[$game_variables[1]+1].level
  156.     return true if @xlevelup!=$game_variables[$game_variables[1]+81] if $game_switches[42]
  157.     return true if @xlife!=$game_actors[$game_variables[1]+1].hp
  158.     return true if @xattact!=$game_actors[$game_variables[1]+1].str
  159.     return true if @xdefence!=$game_actors[$game_variables[1]+1].dex
  160.     return true if @xmagicdef!=$game_actors[$game_variables[1]+1].int if $game_switches[Playerdate_magicdef]
  161.     return true if @xspeed!=$game_actors[$game_variables[1]+1].agi if $game_switches[27]
  162.     return true if @xexp!= $game_actors[$game_variables[1]+1].exp
  163.     return true if @xgold!=$game_party.gold
  164.     return true if @xyellowkey!=$game_party.item_number(Yellowkey_itemid)
  165.     return true if @xbluekey!=$game_party.item_number(Bluekey_itemid)
  166.     return true if @xredkey!=$game_party.item_number(Redkey_itemid)
  167.     return true if @xgreenkey!=$game_party.item_number(Greenkey_itemid) if $game_switches[43]
  168.     return true if @xpoison!=$game_switches[13]
  169.     return true if @xpoor!=$game_switches[15]
  170.     return true if @xcurse!=$game_switches[16]
  171.     return true if @xslow!=$game_switches[12]
  172.     return true if @xchange!=$game_switches[50]
  173.     return false
  174.   end

  175. end

  176. ###########################################################################
  177. #                           下面的东西不需要掌握~                         #
  178. ###########################################################################

  179. class Scene_Map
  180. alias xy_66rpg_main main
  181. def main
  182.    @Playerdate_window = Window_PlayerDate.new
  183.    @Playerdate_window.x = $game_variables[105]
  184. #   @xy_window.y = 480 - 96
  185. #   @xy_window.opacity = 0
  186.    xy_66rpg_main
  187.    @Playerdate_window .dispose
  188. end
  189. #--------------------------------------------------------------------------
  190. # ● 刷新画面
  191. #--------------------------------------------------------------------------
  192. alias xy_66rpg_update update
  193. def update
  194.    xy_66rpg_update
  195.    if $game_switches[Playerdate_SWITCH]
  196.      @Playerdate_window .visible = true     
  197.      @Playerdate_window .refresh if @Playerdate_window.judge
  198.    else
  199.      @Playerdate_window .visible = false
  200.    end
  201. end
  202. end
  203. #==========================================================================
  204. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。别以为加密就可以del哦
  205. #==========================================================================
复制代码

作者: 腐琴琴    时间: 2012-3-2 17:09
显示的话是公共事件——并行处理,
变量=地图ID,条件分歧。

显示文字的话如果字没什么变化的话可以把字做成图片显示。
显示变量的话用主站上的一个脚本试试。
  1. #==========================================================================
  2. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。
  3. #==========================================================================

  4. VAR_SWITCH = 26          # 26号开关打开此脚本才工作,关闭则停止运算,并且透明
  5. VAR_REFRESH_SWITCH = 27  # 27号开关控制强制刷新,使用时机:1、把窗口由透明变为不透明(包括第一次使用时),2、游戏中用脚本更改了$var

  6. $var = []
  7. $var = [[1,0,0],[2,32,32],[3,64,32]] #所有需要显示在地图并且刷新的变量,可在游戏中用脚本更改。格式:[变量编号,x坐标,y坐标]

  8. #==============================================================================
  9. # ■ Window_XY
  10. #------------------------------------------------------------------------------
  11. #  显示坐标的窗口。
  12. #==============================================================================
  13. class Window_Var < Window_Base#注意前面那个window_var是文件名
  14. #--------------------------------------------------------------------------
  15. # ● 初始化窗口
  16. #--------------------------------------------------------------------------
  17. def initialize
  18.   super(-16, -16, 640+32, 480+32)#最后面那个数字是宽要显示多个需要改大,前面一个是长~
  19.   self.contents = Bitmap.new(width - 32, height - 32)
  20.   self.back_opacity = 255  # 这个是背景透明
  21.   self.opacity = 255       # 这个是边框和背景都透明
  22.   self.contents_opacity = 255       # 这个是内容透明
  23.   self.visible = false
  24.   self.z=9999
  25.   @var = $var
  26.   @var_a = []
  27.   for var_draw in $var
  28.     @var_a[var_draw[0]] = $game_variables[var_draw[0]]
  29.   end   
  30.   refresh
  31. end

  32. #--------------------------------------------------------------------------
  33. # ● 刷新
  34. #--------------------------------------------------------------------------
  35. def refresh
  36.   if $game_switches[VAR_SWITCH]
  37.     @var = $var         # 记录现在变量数组结构
  38.     self.contents.clear # 清除以前的东西
  39.     for var_draw in @var
  40.       @var_a[var_draw[0]] = $game_variables[var_draw[0]] # 记录现在的游戏变量
  41.       self.contents.draw_text(var_draw[1],var_draw[2],640,32,@var_a[var_draw[0]].to_s)
  42.     end
  43.   end
  44. end
  45. #--------------------------------------------------------------------------
  46. # ● 判断文字刷新。节约内存用
  47. #--------------------------------------------------------------------------
  48. def judge
  49.   for var_draw in $var
  50.     if @var_a[var_draw[0]] != $game_variables[var_draw[0]] #如果现在记录的变量和游戏变量不同,刷新
  51.       return true
  52.     end
  53.   end
  54.   if $game_switches[VAR_REFRESH_SWITCH]  # 强制刷新的时候,刷新
  55.     $game_switches[VAR_REFRESH_SWITCH] = false
  56.     return true
  57.   end
  58.   return false
  59. end
  60. end

  61. class Scene_Map
  62. alias var_66rpg_main main
  63. def main
  64.   @var_window = Window_Var.new
  65.   @var_window.opacity = 0
  66.   var_66rpg_main
  67.   @var_window.dispose
  68. end
  69. #--------------------------------------------------------------------------
  70. # ● 刷新画面
  71. #--------------------------------------------------------------------------
  72. alias var_66rpg_update update
  73. def update
  74.   var_66rpg_update
  75.   if $game_switches[VAR_SWITCH]
  76.     @var_window.visible = true      
  77.     @var_window.refresh if @var_window.judge
  78.   else
  79.     @var_window.visible = false
  80.   end
  81. end
  82. end
  83. #==========================================================================
  84. # 本脚本来自www.66rpg.com,用于任何游戏请保留此信息。
  85. #==========================================================================
复制代码





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