设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1785|回复: 5
打印 上一主题 下一主题

[已经过期] 如何设置一个开关,在战斗时打开开关就关闭战斗状态窗口

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
跳转到指定楼层
1
发表于 2015-5-22 16:52:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
请问如何在Window_BattleStatus里设置一个开关,在战斗中有需要的话打开这个开关,然后Window_BattleStatus窗口就关闭,就是不显示了。当需要的时候关闭这个开关又可以显示了,请问该怎么做?

博客:我的博客

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
2
发表于 2015-5-22 17:05:22 | 只看该作者
visible
窗口的可见状态。真为可见。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
226 小时
注册时间
2015-5-8
帖子
329
3
发表于 2015-5-22 19:24:00 | 只看该作者
  1. @status_window.visible = false/true
复制代码
請參見Scene_Battle 1內相關窗口可見性腳本。

点评

我是要用开关呀,不是在游戏里面加关闭选项  发表于 2015-5-22 21:45
我是妖精蕾貝卡,沉默少言,孤獨自卑。完成了一個小遊戲,歡迎試玩。同時也歡迎試玩師傅的遊戲,謝謝。
現正在努力學習事件中,有不明白的地方請各位指教。

回复 支持 反对

使用道具 举报

Lv5.捕梦者 (版主)

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
帖子
11485

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

4
发表于 2015-5-22 23:02:22 | 只看该作者
  1. #==============================================================================
  2. # ■ Window_BattleStatus
  3. #------------------------------------------------------------------------------
  4. #  显示战斗画面同伴状态的窗口。
  5. #==============================================================================

  6. class Window_BattleStatus < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     if $game_switches [1] == true
  12.     super(0, 320, 640, 160)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     self.opacity = 0
  15.     @level_up_flags = [false, false, false, false]
  16.     refresh
  17.     else
  18.     super(0, 320, 640, 160)
  19.     self.contents = Bitmap.new(width - 32, height - 32)
  20.     @level_up_flags = [false, false, false, false]
  21.     refresh
  22.   end
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # ● 释放
  26.   #--------------------------------------------------------------------------
  27.   def dispose
  28.     super
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # ● 设置升级标志
  32.   #     actor_index : 角色索引
  33.   #--------------------------------------------------------------------------
  34.   def level_up(actor_index)
  35.     @level_up_flags[actor_index] = true
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 刷新
  39.   #--------------------------------------------------------------------------
  40.   def refresh
  41.     if $game_switches [1] == true
  42.    
  43.     else
  44.       self.contents.clear
  45.     @item_max = $game_party.actors.size
  46.     for i in 0...$game_party.actors.size
  47.       actor = $game_party.actors[i]
  48.       actor_x = i * 160 + 4
  49.       draw_actor_name(actor, actor_x, 0)
  50.       draw_actor_hp(actor, actor_x, 32, 120)
  51.       draw_actor_sp(actor, actor_x, 64, 120)
  52.       if @level_up_flags[i]
  53.         self.contents.font.color = normal_color
  54.         self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
  55.       else
  56.         draw_actor_state(actor, actor_x, 96)
  57.       end
  58.     end
  59.     end
  60.   end
  61.   #--------------------------------------------------------------------------
  62.   # ● 刷新画面
  63.   #--------------------------------------------------------------------------
  64.   def update
  65.     super
  66.     # 主界面的不透明度下降
  67.     if $game_temp.battle_main_phase
  68.       self.contents_opacity -= 4 if self.contents_opacity > 191
  69.     else
  70.       self.contents_opacity += 4 if self.contents_opacity < 255
  71.     end
  72.   end
  73. end
复制代码
很不给力的修改

评分

参与人数 1星屑 +100 收起 理由
明特·布兰马修 + 100 塞糖

查看全部评分

大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3176
在线时间
1442 小时
注册时间
2009-7-27
帖子
1454
5
 楼主| 发表于 2015-5-23 07:54:27 | 只看该作者
美丽晨露 发表于 2015-5-22 23:02
很不给力的修改

试了一下没有用,是不是因为这个脚本?请帮我看一下怎么回事
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================


  4. # ————————————————————————————————————

  5. # ▼▲▼ XRXS_BP 7. バトルステータス?クリアデザイン ver.1.03 ▼▲▼
  6. # by 桜雅 在土

  7. #==============================================================================
  8. # ■ Window_BattleStatus
  9. #==============================================================================
  10. class Window_BattleStatus < Window_Base
  11.   #--------------------------------------------------------------------------
  12.   # ● 公開インスタンス変数
  13.   #--------------------------------------------------------------------------
  14.   attr_accessor :update_cp_only # CPメーターのみの更新
  15.   #--------------------------------------------------------------------------
  16.   # ● オブジェクト初期化
  17.   #--------------------------------------------------------------------------
  18.   alias xrxs_bp7_initialize initialize
  19.   def initialize
  20.     # 初期化
  21.     @previous_hp = []
  22.     @previous_sp = []
  23.     # 呼び戻す
  24.     xrxs_bp7_initialize
  25.     # ↓Full-Viewの場合は下二行の # を消してください。
  26.     #self.opacity = 0
  27.     #self.back_opacity = 0
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● リフレッシュ
  31.   #--------------------------------------------------------------------------
  32.   alias xrxs_bp7_refresh refresh
  33.   def refresh
  34.     # CPメーターの更新のみ の場合
  35.     if @update_cp_only
  36.       xrxs_bp7_refresh
  37.       return
  38.     end
  39.     # 変更するものがない場合、飛ばす
  40.     @item_max = $game_party.actors.size
  41.     bool = false
  42.     for i in 0...@item_max
  43.       actor = $game_party.actors[i]
  44.       if (@previous_hp[i] != actor.hp) or (@previous_sp[i] != actor.sp)
  45.         bool = true
  46.       end
  47.     end
  48.     return if bool == false
  49.     # 描写を開始
  50.     self.contents.clear
  51.     for i in 0...@item_max
  52.       actor = $game_party.actors[i]
  53.       actor_x = i * 160 + 21
  54.       # 歩行キャラグラフィックの描写
  55.       draw_actor_graphic(actor, actor_x - 0, 0)
  56.       # HP/SPメーターの描写
  57.       draw_actor_hp_meter_line(actor, actor_x, 52, 96, 12)
  58.       draw_actor_sp_meter_line(actor, actor_x, 84, 96, 12)
  59.         if $data_classes[actor.class_id].element_ranks[20]==1
  60.       draw_actor_hs_meter_line(actor, actor_x, 20, 96, 12)
  61.       end
  62.       # HP数値の描写
  63.       self.contents.font.size = 24 # HP/SP数値の文字の大きさ
  64.       self.contents.font.color = Color.new(0,0,0,192)
  65.       self.contents.draw_text(actor_x, 40, 96, 24, actor.hp.to_s, 2)
  66.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  67.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  68.       self.contents.draw_text(actor_x-2, 38, 96, 24, actor.hp.to_s, 2)
  69.       

  70.       # SP数値の描写
  71.       self.contents.font.color = Color.new(0,0,0,192)
  72.       self.contents.draw_text(actor_x, 72, 96, 24, actor.sp.to_s, 2)
  73.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  74.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  75.       self.contents.draw_text(actor_x-2, 70, 96, 24, actor.sp.to_s, 2)
  76.          # EP数値の描写
  77.            if $data_classes[actor.class_id].element_ranks[20]==1
  78.       self.contents.font.color = Color.new(0,0,0,192)
  79.       self.contents.draw_text(actor_x, 8, 96, 24, actor.hp_store.to_s, 2)
  80.       self.contents.font.color = actor.hp_store == 0 ? knockout_color :
  81.       actor.hp_store <= 100 / 4 ? crisis_color : normal_color
  82.       self.contents.draw_text(actor_x-2, 6, 96, 24, actor.hp_store.to_s, 2)
  83.        end



  84.       # 用語「HP」と用語「SP」の描写
  85.       self.contents.font.size = 18 # 用語「HP/SP」の文字の大きさ
  86.       self.contents.font.color = Color.new(0,0,0,192)
  87.       self.contents.draw_text(actor_x+2, 32, 196, 24, $data_system.words.hp)
  88.       self.contents.draw_text(actor_x+2, 64, 196, 24, $data_system.words.sp)
  89.         if $data_classes[actor.class_id].element_ranks[20]==1
  90.       self.contents.draw_text(actor_x+2, 0, 196, 24, "怒气")
  91.       end
  92.       self.contents.font.color = system_color # 用語「HP/SP」の文字の色
  93.       self.contents.draw_text(actor_x, 30, 196, 24, $data_system.words.hp)
  94.       self.contents.draw_text(actor_x, 62, 196, 24, $data_system.words.sp)
  95.         if $data_classes[actor.class_id].element_ranks[20]==1
  96.       self.contents.draw_text(actor_x, -2, 196, 24, "怒气")
  97.       end
  98.       # ステートの描写
  99.       draw_actor_state(actor, actor_x, 100)
  100.       # 値を更新
  101.       @previous_hp[i] = actor.hp
  102.       @previous_hp[i] = actor.hp
  103.     end
  104.   end
  105. end
  106. #==============================================================================
  107. # ■ Window_Base
  108. #==============================================================================
  109. class Window_Base < Window
  110.   #--------------------------------------------------------------------------
  111.   # ● HPメーター の描画
  112.   #--------------------------------------------------------------------------
  113.   def draw_actor_hp_meter_line(actor, x, y, width = 156, height = 4)
  114.     w = width * actor.hp / [actor.maxhp,1].max
  115.     hp_color_1 = Color.new(255, 0, 0, 192)
  116.     hp_color_2 = Color.new(255, 255, 0, 192)
  117.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  118.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  119.     x -= 1
  120.     y += (height/4).floor
  121.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  122.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  123.     x -= 1
  124.     y += (height/4).ceil
  125.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  126.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  127.     x -= 1
  128.     y += (height/4).ceil
  129.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  130.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ● 怒气メーター の描画
  134.   #--------------------------------------------------------------------------
  135.   def draw_actor_hs_meter_line(actor, x, y, width = 156, height = 4)
  136.     w = width * actor.hp_store / [100,1].max
  137.     hp_color_1 = Color.new(104, 34 ,139  , 192)
  138.     hp_color_2 = Color.new(238 ,174 ,238 , 192)
  139.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  140.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  141.     x -= 1
  142.     y += (height/4).floor
  143.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  144.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  145.     x -= 1
  146.     y += (height/4).ceil
  147.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  148.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  149.     x -= 1
  150.     y += (height/4).ceil
  151.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  152.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● SPメーター の描画
  156.   #--------------------------------------------------------------------------
  157.   def draw_actor_sp_meter_line(actor, x, y, width = 156, height = 4)
  158.     w = width * actor.sp / [actor.maxsp,1].max
  159.     hp_color_1 = Color.new( 0, 0, 255, 192)
  160.     hp_color_2 = Color.new( 0, 255, 255, 192)
  161.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  162.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  163.     x -= 1
  164.     y += (height/4).floor
  165.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  166.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  167.     x -= 1
  168.     y += (height/4).ceil
  169.     self.contents.fill_rect(x+8, y+4, width, (height/4).ceil , Color.new(0, 0, 0, 128))
  170.     draw_line(x, y, x + w, y, hp_color_1, (height/4).ceil , hp_color_2)
  171.     x -= 1
  172.     y += (height/4).ceil
  173.     self.contents.fill_rect(x+8, y+4, width, (height/4).floor, Color.new(0, 0, 0, 128))
  174.     draw_line(x, y, x + w, y, hp_color_1, (height/4).floor, hp_color_2)
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 名前の描画
  178.   #--------------------------------------------------------------------------
  179.   alias xrxs_bp7_draw_actor_name draw_actor_name
  180.   def draw_actor_name(actor, x, y)
  181.     xrxs_bp7_draw_actor_name(actor, x, y) if @draw_ban != true
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● ステートの描画
  185.   #--------------------------------------------------------------------------
  186.   alias xrxs_bp7_draw_actor_state draw_actor_state
  187.   def draw_actor_state(actor, x, y, width = 120)
  188.     xrxs_bp7_draw_actor_state(actor, x, y, width) if @draw_ban != true
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● HP の描画
  192.   #--------------------------------------------------------------------------
  193.   alias xrxs_bp7_draw_actor_hp draw_actor_hp
  194.   def draw_actor_hp(actor, x, y, width = 144)
  195.     xrxs_bp7_draw_actor_hp(actor, x, y, width) if @draw_ban != true
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ● SP の描画
  199.   #--------------------------------------------------------------------------
  200.   alias xrxs_bp7_draw_actor_sp draw_actor_sp
  201.   def draw_actor_sp(actor, x, y, width = 144)
  202.     xrxs_bp7_draw_actor_sp(actor, x, y, width) if @draw_ban != true
  203.   end
  204. end
  205. #==============================================================================
  206. # ■ Scene_Battle
  207. #==============================================================================
  208. class Scene_Battle
  209.   #--------------------------------------------------------------------------
  210.   # ● フレーム更新
  211.   #--------------------------------------------------------------------------
  212.   alias xrxs_bp7_update update
  213.   def update
  214.     xrxs_bp7_update
  215.     # メッセージウィンドウ表示中の場合
  216.     if $game_temp.message_window_showing
  217.       @status_window.update_cp_only = true      
  218.     else
  219.       @status_window.update_cp_only = false
  220.     end
  221.   end
  222. end
  223. #==============================================================================
  224. # ◇ 外部ライブラリ
  225. #==============================================================================
  226. class Window_Base
  227.   #--------------------------------------------------------------------------
  228.   # ● ライン描画 軽量版 by 桜雅 在土
  229.   #--------------------------------------------------------------------------
  230.   def draw_lineght(start_x, start_y, end_x, end_y, start_color)
  231.     # 描写距離の計算。大きめに直角時の長さ。
  232.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  233.     # 描写開始
  234.     for i in 1..distance
  235.       x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  236.       y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  237.       self.contents.set_pixel(x, y, start_color)
  238.     end
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● ライン描画 by 桜雅 在土
  242.   #--------------------------------------------------------------------------
  243.   def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  244.     # 描写距離の計算。大きめに直角時の長さ。
  245.     distance = (start_x - end_x).abs + (start_y - end_y).abs
  246.     # 描写開始
  247.     if end_color == start_color
  248.       for i in 1..distance
  249.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  250.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  251.         if width == 1
  252.           self.contents.set_pixel(x, y, start_color)
  253.         else
  254.           self.contents.fill_rect(x, y, width, width, start_color)
  255.         end
  256.       end
  257.     else
  258.       for i in 1..distance
  259.         x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  260.         y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  261.         r = start_color.red * (distance-i)/distance + end_color.red * i/distance
  262.         g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  263.         b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
  264.         a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  265.         if width == 1
  266.           self.contents.set_pixel(x, y, Color.new(r, g, b, a))
  267.         else
  268.           self.contents.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  269.         end
  270.       end
  271.     end
  272.   end
  273. end


  274. #==============================================================================
  275. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  276. #==============================================================================
复制代码

博客:我的博客
回复 支持 反对

使用道具 举报

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9397
在线时间
2748 小时
注册时间
2008-9-5
帖子
3543

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

6
发表于 2015-5-23 11:40:28 | 只看该作者
ctrl+shift+f全局搜一下"class Window_BattleStatus"(不带引号),
如果加了别的战斗系统的话,就选搜索结果列表里最下边的那个打开,
在打开的这个类里面找"def update"如果没有就再全局搜索一下,结果列表里一个一个往上打开,
直到能找到"def update"这个方法,然后在方法结束之前,加上这样一句:

  1. self.visible = !$game_switches[开关id自己填] if self.visible != !$game_switches[开关id自己填]
复制代码

评分

参与人数 1星屑 +200 收起 理由
hys111111 + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-20 14:59

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表