Project1

标题: 这位大神,帮忙修改一下 [打印本页]

作者: shanlong闪龙    时间: 2014-3-18 20:56
标题: 这位大神,帮忙修改一下
本帖最后由 shanlong闪龙 于 2014-3-21 21:33 编辑

@Demon丶旋律 上次你帮我写的那个脚本……帮忙改下……谢谢
作者: shanlong闪龙    时间: 2014-3-18 20:56
class Window_Jike < Window_Base

   JIKE_X = 380      # 窗口X坐标
     JIKE_Y = 20       # 窗口Y坐标
     JIKE_W = 220      # 窗口宽
     JIKE_H = 95       # 窗口高
     TEXT_COLOR = Color.new(255, 255, 255, 255) #字体颜色
    def initialize
       super(JIKE_X , JIKE_Y, JIKE_W, JIKE_H)   
      self.opacity = 255  #边框透明度
       self.back_opacity = 155  #底色透明度
       self.contents_opacity = 200  #字透明度体
       self.contents = Bitmap.new(width - 32, height - 32)
   end


   def setname   
       #这里可以改框内显示的文字和变量ID.  ↓这是变量ID..        ↓这也是..
         ji_ke = "饱食度:"+"#{$game_variables[1]}/#{$game_variables[2]}"

        #这里用法和上面是一样的.
         kou_ke = "口渴度:"+"#{$game_variables[3]}/#{$game_variables[4]}"

        self.contents.clear
         self.contents.font.color = TEXT_COLOR
        self.contents.draw_text(4, 0 ,width - 40, 32, ji_ke, 1)
       self.contents.draw_text(4, 0 ,width - 40, 96, kou_ke, 1)
     end
     end

class Scene_Map
    alias smn_main main
     def main
       @mapname = Window_Jike.new
       smn_main
       @mapname.dispose
     end
     
    alias smn_update update
     def update
       @mapname.setname
       smn_update
     end
   end
   # by: Demon丶旋律

作者: shanlong闪龙    时间: 2014-3-18 20:57
就是……我想在右上角饱食度和口渴度下面再加一个精神度,左上角再加一个存活天数。
作者: 天地有正气    时间: 2014-3-18 20:57
本帖最后由 天地有正气 于 2014-3-18 21:02 编辑



善用编辑,不要连贴,谢谢。


建议楼主多少学习一些关于窗口的脚本知识,自己动手,丰衣足食嘛。

我很想帮你,但iPad打字不方便。。。


作者: shanlong闪龙    时间: 2014-3-18 21:00
精神当前值的变量是0007,精神最大值的变量0008,存活天数的变量是0009
如果可以的话……帮忙把“饱食度”弄成黄色,“口渴度”是淡蓝色,“精神度”是粉色,
存活天数是淡绿色……谢谢。后面的数字还是白色,只要文字变颜色
作者: batfjtn    时间: 2014-3-19 02:23
前言:

随便帮你加了下~!!

自己看看代码以后这样的可以自己修改~!

存活天数我没有给你分开~!!

分开无非也就是再写一个同样的代码然后再修改窗口坐标~!!

你可以自己去试着修改下~~!!!
  1. class Window_Jike < Window_Base
  2.   JIKE_X = 380      # 窗口X坐标
  3.   JIKE_Y = 20       # 窗口Y坐标
  4.   JIKE_W = 220      # 窗口宽
  5.   JIKE_H = 160       # 窗口高
  6.   TEXT_COLOR = Color.new(255, 255, 255, 255) #字体颜色
  7.   def initialize
  8.     super(JIKE_X , JIKE_Y, JIKE_W, JIKE_H)
  9.     self.opacity = 255  #边框透明度
  10.     self.back_opacity = 155  #底色透明度
  11.     self.contents_opacity = 200  #字透明度体
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.   end
  14.   def setname
  15.     #这里可以改框内显示的文字和变量ID.  ↓这是变量ID..        ↓这也是..
  16.     ji_ke = "#{$game_variables[1]}/#{$game_variables[2]}"
  17.     kou_ke = "#{$game_variables[3]}/#{$game_variables[4]}"
  18.     jing_shen = "#{$game_variables[7]}/#{$game_variables[8]}"
  19.     cun_huo = "#{$game_variables[9]}"
  20.     self.contents.clear
  21.     self.contents.font.color = Color.new(255, 165, 0, 255)
  22.     self.contents.draw_text(4, 0 ,128, 32, "饱食度:", 1)
  23.     self.contents.font.color = Color.new(255, 255, 255, 255)
  24.     self.contents.draw_text(4, 0 ,240, 32, ji_ke, 1)
  25.     self.contents.font.color = Color.new(0, 191, 255, 255)
  26.     self.contents.draw_text(4, 0 ,128, 96, "口渴度:", 1)
  27.     self.contents.font.color = TEXT_COLOR
  28.     self.contents.draw_text(4, 0 ,240, 96, kou_ke, 1)
  29.     self.contents.font.color = Color.new(255, 0, 255, 255)
  30.     self.contents.draw_text(4, 0 ,128, 160, "精神度:", 1)
  31.     self.contents.font.color = TEXT_COLOR
  32.     self.contents.draw_text(4, 0 ,240, 160, jing_shen, 1)
  33.     self.contents.font.color = Color.new(0, 255, 0, 255)
  34.     self.contents.draw_text(4, 0 ,150, 224, "存活天数:", 1)
  35.     self.contents.font.color = TEXT_COLOR
  36.     self.contents.draw_text(4, 0 ,265, 224, cun_huo, 1)
  37.   end
  38. end

  39. class Scene_Map
  40.   alias smn_main main
  41.   def main
  42.     @mapname = Window_Jike.new
  43.     smn_main
  44.     @mapname.dispose
  45.   end
  46.   alias smn_update update
  47.   def update
  48.     @mapname.setname
  49.     smn_update
  50.   end
  51. end
  52. # by: Demon丶旋律
复制代码

作者: shanlong闪龙    时间: 2014-3-19 20:02
天地有正气 发表于 2014-3-18 20:57
善用编辑,不要连贴,谢谢。

脚本的一个都看不懂OTZ{:2_277:}
作者: shanlong闪龙    时间: 2014-3-19 20:06
batfjtn 发表于 2014-3-19 02:23
前言:

随便帮你加了下~!!

我不会脚本OTZ{:2_277:}……
作者: batfjtn    时间: 2014-3-20 01:31
shanlong闪龙 发表于 2014-3-19 20:06
我不会脚本OTZ……

自己去改坐标吧~~!!
  1. class Window_Jike < Window_Base
  2.   JIKE_X = 380      # 窗口X坐标
  3.   JIKE_Y = 20       # 窗口Y坐标
  4.   JIKE_W = 220      # 窗口宽
  5.   JIKE_H = 128       # 窗口高
  6.   TEXT_COLOR = Color.new(255, 255, 255, 255) #字体颜色
  7.   def initialize
  8.     super(JIKE_X , JIKE_Y, JIKE_W, JIKE_H)
  9.     self.opacity = 255  #边框透明度
  10.     self.back_opacity = 155  #底色透明度
  11.     self.contents_opacity = 200  #字透明度体
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.   end
  14.   def setname
  15.     #这里可以改框内显示的文字和变量ID.  ↓这是变量ID..        ↓这也是..
  16.     ji_ke = "#{$game_variables[1]}/#{$game_variables[2]}"
  17.     kou_ke = "#{$game_variables[3]}/#{$game_variables[4]}"
  18.     jing_shen = "#{$game_variables[7]}/#{$game_variables[8]}"
  19.     self.contents.clear
  20.     self.contents.font.color = Color.new(255, 165, 0, 255)
  21.     self.contents.draw_text(4, 0 ,128, 32, "饱食度:", 1)
  22.     self.contents.font.color = Color.new(255, 255, 255, 255)
  23.     self.contents.draw_text(4, 0 ,240, 32, ji_ke, 1)
  24.     self.contents.font.color = Color.new(0, 191, 255, 255)
  25.     self.contents.draw_text(4, 0 ,128, 96, "口渴度:", 1)
  26.     self.contents.font.color = TEXT_COLOR
  27.     self.contents.draw_text(4, 0 ,240, 96, kou_ke, 1)
  28.     self.contents.font.color = Color.new(255, 0, 255, 255)
  29.     self.contents.draw_text(4, 0 ,128, 160, "精神度:", 1)
  30.     self.contents.font.color = TEXT_COLOR
  31.     self.contents.draw_text(4, 0 ,240, 160, jing_shen, 1)
  32.   end
  33. end

  34. class Window_Cunhuo < Window_Base
  35.   def initialize
  36.     super( 20, 20, 160, 64)
  37.     self.opacity = 255  #边框透明度
  38.     self.back_opacity = 155  #底色透明度
  39.     self.contents_opacity = 200  #字透明度体
  40.     self.contents = Bitmap.new(width - 32, height - 32)
  41.   end
  42.   def setname
  43.     cun_huo = "#{$game_variables[9]}"
  44.     self.contents.clear
  45.     self.contents.font.color = Color.new(0, 255, 0, 255)
  46.     self.contents.draw_text(4, 0 ,80, 32, "存活天数:", 1)
  47.     self.contents.font.color = Color.new(255, 255, 255, 255)
  48.     self.contents.draw_text(4, 0 ,165, 32, cun_huo, 1)
  49.   end
  50. end
  51. class Scene_Map
  52.   alias smn_main main
  53.   def main
  54.     @mapname = Window_Jike.new
  55.     @mapname1 = Window_Cunhuo.new
  56.     smn_main
  57.     @mapname.dispose
  58.     @mapname1.dispose
  59.   end
  60.   alias smn_update update
  61.   def update
  62.     @mapname.setname
  63.     @mapname1.setname
  64.     smn_update
  65.   end
  66. end
  67. # by: Demon丶旋律
复制代码
可以结贴了~~!!
作者: 凤龙飞    时间: 2014-3-20 06:49
shanlong闪龙 发表于 2014-3-19 20:06
我不会脚本OTZ……

不会太难的,我刚看了啊兴的新手翻译标题感觉蛮简单的,脚本一点一点的学比较好简单易懂。
作者: shanlong闪龙    时间: 2014-3-20 19:45
batfjtn 发表于 2014-3-20 01:31
自己去改坐标吧~~!!可以结贴了~~!!

用后“饱食度”,“口渴度”,“精神度”都和后面的数字的一部分重叠在一起……这个怎么改
作者: 凤龙飞    时间: 2014-3-20 21:40
修改坐标
作者: batfjtn    时间: 2014-3-21 01:30
知道你伸手习惯了~!!

给你改好了~!!

自己研究下看看修改了什么~~!!
  1. class Window_Jike < Window_Base
  2.   JIKE_X = 380      # 窗口X坐标
  3.   JIKE_Y = 20       # 窗口Y坐标
  4.   JIKE_W = 220      # 窗口宽
  5.   JIKE_H = 128       # 窗口高
  6.   TEXT_COLOR = Color.new(255, 255, 255, 255) #字体颜色
  7.   def initialize
  8.     super(JIKE_X , JIKE_Y, JIKE_W, JIKE_H)
  9.     self.opacity = 255  #边框透明度
  10.     self.back_opacity = 155  #底色透明度
  11.     self.contents_opacity = 200  #字透明度体
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.   end
  14.   def setname
  15.     #这里可以改框内显示的文字和变量ID.  ↓这是变量ID..        ↓这也是..
  16.     ji_ke = "#{$game_variables[1]}/#{$game_variables[2]}"
  17.     kou_ke = "#{$game_variables[3]}/#{$game_variables[4]}"
  18.     jing_shen = "#{$game_variables[7]}/#{$game_variables[8]}"
  19.     self.contents.clear
  20.     self.contents.font.color = Color.new(255, 165, 0, 255)
  21.     self.contents.draw_text(4, 0 ,128, 32, "饱食度:", 1)
  22.     self.contents.font.color = Color.new(255, 255, 255, 255)
  23.     self.contents.draw_text(80, 0 ,128, 32, ji_ke, 1)
  24.     self.contents.font.color = Color.new(0, 191, 255, 255)
  25.     self.contents.draw_text(4, 0 ,128, 96, "口渴度:", 1)
  26.     self.contents.font.color = TEXT_COLOR
  27.     self.contents.draw_text(80, 0 ,128, 96, kou_ke, 1)
  28.     self.contents.font.color = Color.new(255, 0, 255, 255)
  29.     self.contents.draw_text(4, 0 ,128, 160, "精神度:", 1)
  30.     self.contents.font.color = TEXT_COLOR
  31.     self.contents.draw_text(80, 0 ,128, 160, jing_shen, 1)
  32.   end
  33. end

  34. class Window_Cunhuo < Window_Base
  35.   def initialize
  36.     super( 20, 20, 160, 64)
  37.     self.opacity = 255  #边框透明度
  38.     self.back_opacity = 155  #底色透明度
  39.     self.contents_opacity = 200  #字透明度体
  40.     self.contents = Bitmap.new(width - 32, height - 32)
  41.   end
  42.   def setname
  43.     cun_huo = "#{$game_variables[9]}"
  44.     self.contents.clear
  45.     self.contents.font.color = Color.new(0, 255, 0, 255)
  46.     self.contents.draw_text(4, 0 ,80, 32, "存活天数:", 1)
  47.     self.contents.font.color = Color.new(255, 255, 255, 255)
  48.     self.contents.draw_text(80, 0 ,32, 32, cun_huo, 1)
  49.   end
  50. end
  51. class Scene_Map
  52.   alias smn_main main
  53.   def main
  54.     @mapname = Window_Jike.new
  55.     @mapname1 = Window_Cunhuo.new
  56.     smn_main
  57.     @mapname.dispose
  58.     @mapname1.dispose
  59.   end
  60.   alias smn_update update
  61.   def update
  62.     @mapname.setname
  63.     @mapname1.setname
  64.     smn_update
  65.   end
  66. end
  67. # by: Demon丶旋律
复制代码
顺便给你讲解下这句self.contents.draw_text(80, 0 ,32, 32, cun_huo, 1)

self.contents.draw_text(X坐标, Y坐标 ,宽, 高, "表达方式", 1)

需要引号~!

最后一个1我不知道如何解释~!

我自己知道如何用就对了~!!
作者: shanlong闪龙    时间: 2014-3-21 20:38
batfjtn 发表于 2014-3-21 01:30
知道你伸手习惯了~!!

给你改好了~!!

额……其实我本来想招一位脚本党的结果一直没消息{:2_258:}……对不起……
作者: 天地有正气    时间: 2014-3-21 21:02
batfjtn 发表于 2014-3-21 01:30
知道你伸手习惯了~!!

给你改好了~!!

那个“1”是对齐方式,参考F1Bitmap类
作者: shanlong闪龙    时间: 2014-3-21 21:36
batfjtn 发表于 2014-3-21 01:30
知道你伸手习惯了~!!

给你改好了~!!

对不起我错了




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