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

Project1

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

[已经解决] [已解决]20...24开关坏掉了

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7474
在线时间
1302 小时
注册时间
2015-8-15
帖子
742
跳转到指定楼层
1
发表于 2024-6-27 11:09:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 金芒芒 于 2024-7-2 08:20 编辑

为什么 class Scene_chuzhan中的 $game_switches[21] = false  
但是class Scene_zhenwei 中的还是$game_switches[21] = true

    when 0  # 队组1出生点
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到物品画面
      # $game_switches[队伍1] = true #/ false
       $game_switches[20] = true
       $game_switches[21] = false
       $game_switches[22] = false
       $game_switches[23] = false
       $game_switches[24] = false
       $scene = Scene_zhenwei.new



     when 0  # 队组1出生点
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到物品画面
        $出战1=[]
       if $game_switches[20] = true
         $出战1=[9.13]
       end
        if $game_switches[21] = true
         $出战2=[9.113]
       end
       if $game_switches[20] = true
       p $出战1
     end
     if $game_switches[21] = true
       p $出战2
       end
       p @chuzhan_index
        $scene = Scene_zhenwei.new(1)



RUBY 代码复制
  1. #==============================================================================
  2. # ■ Scene_chuzhan
  3. #------------------------------------------------------------------------------
  4. #  处理菜单画面的类。
  5. #==============================================================================
  6.  
  7. class Scene_chuzhan
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     chuzhan_index : 命令光标的初期位置
  11.   #--------------------------------------------------------------------------
  12.   def initialize(chuzhan_index = 0)
  13.     @chuzhan_index = chuzhan_index
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 主处理
  17.   #--------------------------------------------------------------------------
  18.   def main
  19.  
  20.     # 生成命令窗口
  21.     s1 = "出战1"
  22.     s2 = "出战2"
  23.     s3 = "出战3"
  24.     s4 = "出战4"
  25.     s5 = "出战5"
  26.     @command1_window = Window_Chuzhan_Command.new(300, [s1, s2, s3, s4, s5])
  27.     @command1_window.index = @chuzhan_index
  28.     # 禁止存档的情况下
  29.     if $game_system.save_disabled
  30.       # 存档无效
  31.       @command1_window.disable_item(4)
  32.     end
  33.     # 执行过渡
  34.     Graphics.transition
  35.     # 主循环
  36.     loop do
  37.       # 刷新游戏画面
  38.       Graphics.update
  39.       # 刷新输入信息
  40.       Input.update
  41.       # 刷新画面
  42.       update
  43.       # 如果切换画面就中断循环
  44.       if $scene != self
  45.         break
  46.       end
  47.     end
  48.     # 准备过渡
  49.     Graphics.freeze
  50.     # 释放窗口
  51.     @command1_window.dispose
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● 刷新画面
  55.   #--------------------------------------------------------------------------
  56.   def update
  57.  
  58.     # 刷新窗口
  59.     @command1_window.update
  60.     # 命令窗口被激活的情况下: 调用 update_command
  61.     if @command1_window.active
  62.       update_command
  63.       return
  64.     end
  65. end
  66.   #--------------------------------------------------------------------------
  67.   # ● 刷新画面 (命令窗口被激活的情况下)
  68.   #--------------------------------------------------------------------------
  69.   def update_command
  70.     # 按下 B 键的情况下
  71.     if Input.trigger?(Input::B)
  72.       # 演奏取消 SE
  73.       $game_system.se_play($data_system.cancel_se)
  74.       # 切换的地图画面
  75.       $scene = Scene_Map.new
  76.       return
  77.     end
  78.     # 按下 C 键的情况下
  79.     if Input.trigger?(Input::C)
  80.       # 命令窗口的光标位置分支
  81.       case @command1_window.index
  82.       when 0  # 队组1出生点
  83.         # 演奏确定 SE
  84.         $game_system.se_play($data_system.decision_se)
  85.         # 切换到物品画面
  86.       # $game_switches[队伍1] = true #/ false
  87.        $game_switches[20] = true
  88.        $game_switches[21] = false
  89.        $game_switches[22] = false
  90.        $game_switches[23] = false
  91.        $game_switches[24] = false
  92.        $scene = Scene_zhenwei.new
  93.       when 1  # 队组2出生点
  94.         # 演奏确定 SE
  95.         $game_system.se_play($data_system.decision_se)
  96.         # 激活状态窗口
  97.        $game_switches[20] = false
  98.        $game_switches[21] = true
  99.        $game_switches[22] = false
  100.        $game_switches[23] = false
  101.        $game_switches[24] = false
  102.        $scene = Scene_zhenwei.new
  103.       when 2  # 队组3出生点
  104.         # 演奏确定 SE
  105.         $game_system.se_play($data_system.decision_se)
  106.         # 激活状态窗口
  107.        $game_switches[20] = false
  108.        $game_switches[21] = false
  109.        $game_switches[22] = true
  110.        $game_switches[23] = false
  111.        $game_switches[24] = false
  112.       $scene = Scene_zhenwei.new
  113.       when 3  # 队组4出生点
  114.         # 演奏确定 SE
  115.         $game_system.se_play($data_system.decision_se)
  116.        $game_switches[20] = false
  117.        $game_switches[21] = false
  118.        $game_switches[22] = false
  119.        $game_switches[23] = true
  120.        $game_switches[24] = false
  121.        $scene = Scene_zhenwei.new
  122.  
  123.       when 4  # 队组5出生点
  124.         # 演奏确定 SE
  125.        $game_system.se_play($data_system.decision_se)
  126.        $game_switches[20] = false
  127.        $game_switches[21] = false
  128.        $game_switches[22] = false
  129.        $game_switches[23] = false
  130.        $game_switches[24] = true
  131.        $scene = Scene_zhenwei.new
  132.  
  133.       end
  134.       return
  135.     end
  136.   end
  137. end

RUBY 代码复制
  1. #==============================================================================
  2. # ■ Scene_zhenwei
  3. #------------------------------------------------------------------------------
  4. #  处理菜单画面的类。
  5. #==============================================================================
  6.  
  7. class Scene_zhenwei
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #     zhenwei_index : 命令光标的初期位置
  11.   #--------------------------------------------------------------------------
  12.   def initialize(zhenwei_index = 0)
  13.     @zhenwei_index = zhenwei_index
  14.   end
  15.   #--------------------------------------------------------------------------
  16.   # ● 主处理
  17.   #--------------------------------------------------------------------------
  18.   def main
  19.  
  20.     # 生成命令窗口
  21.     s1 = "阵位1"
  22.     s2 = "阵位2"
  23.     s3 = "阵位3"
  24.     s4 = "阵位4"
  25.     s5 = "阵位5"
  26.     s6 = "阵位6"
  27.     s7 = "阵位7"
  28.     s8 = "阵位8"
  29.     s9 = "阵位9"
  30.     s10 = "阵位10"
  31.     @command_window = Window_Zhenwei_Command.new(300, [s1, s2, s3, s4, s5,s6,s7,s8,s9,s10])
  32.     @command_window.index = @zhenwei_index
  33.     # 禁止存档的情况下
  34.     if $game_system.save_disabled
  35.       # 存档无效
  36.       @command_window.disable_item(4)
  37.     end
  38.    p @chuzhan_index
  39. #     @command1_window.visible=true
  40. #   @playtime_window = Window_Chuzhan_Command.new
  41. #    @playtime_window = Window_PlayTime.new
  42. #    @playtime_window.x = 0
  43. #    @playtime_window.y = 280
  44. #   @playtime_window.opacity = 0
  45.     # 执行过渡
  46.     Graphics.transition
  47.     # 主循环
  48.     loop do
  49.       # 刷新游戏画面
  50.       Graphics.update
  51.       # 刷新输入信息
  52.       Input.update
  53.       # 刷新画面
  54.       update
  55.       # 如果切换画面就中断循环
  56.       if $scene != self
  57.         break
  58.       end
  59.     end
  60.     # 准备过渡
  61.     Graphics.freeze
  62.     # 释放窗口
  63.     @command_window.dispose
  64. #   @playtime_window.dispose
  65.   end
  66.  
  67.   #--------------------------------------------------------------------------
  68.   # ● 刷新画面
  69.   #--------------------------------------------------------------------------
  70.   def update
  71.     # 刷新窗口
  72.     @command_window.update
  73. #    @playtime_window.update
  74.     # 命令窗口被激活的情况下: 调用 update_command
  75.     if @command_window.active
  76.       update_command
  77.       return
  78.     end
  79.     # 状态窗口被激活的情况下: 调用 update_status
  80.     if @status_window.active
  81.       update_status
  82.       return
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 刷新画面 (命令窗口被激活的情况下)
  87.   #--------------------------------------------------------------------------
  88.   def update_command
  89.     # 按下 B 键的情况下
  90.     if Input.trigger?(Input::B)
  91.       # 演奏取消 SE
  92.       $game_system.se_play($data_system.cancel_se)
  93.       # 切换的地图画面
  94.       $scene = Scene_Map.new
  95.       return
  96.     end
  97.     # 按下 C 键的情况下
  98.     if Input.trigger?(Input::C)
  99.       # 命令窗口的光标位置分支
  100.       case @command_window.index
  101.       when 0  # 队组1出生点
  102.         # 演奏确定 SE
  103.         $game_system.se_play($data_system.decision_se)
  104.         # 切换到物品画面
  105.         $出战1=[]
  106.        if $game_switches[20] = true
  107.          $出战1=[9.13]
  108.        end
  109.         if $game_switches[21] = true
  110.          $出战2=[9.113]
  111.        end
  112.        if $game_switches[20] = true
  113.        p $出战1
  114.      end
  115.      if $game_switches[21] = true
  116.        p $出战2
  117.        end
  118.        p @chuzhan_index
  119.         $scene = Scene_zhenwei.new(1)
  120.       when 1  # 队组2出生点
  121.         # 演奏确定 SE
  122.         $game_system.se_play($data_system.decision_se)
  123.         # 激活状态窗口
  124.         $出战2=[]
  125.        $scene = Scene_zhenwei.new(2)
  126.       when 2  # 队组3出生点
  127.         # 演奏确定 SE
  128.         $game_system.se_play($data_system.decision_se)
  129.         # 激活状态窗口
  130.        $出战3=[]
  131.      $scene = Scene_zhenwei.new(3)
  132.       when 3  # 队组4出生点
  133.         # 演奏确定 SE
  134.         $game_system.se_play($data_system.decision_se)
  135.        $出战4=[]
  136.         # 激活状态窗口
  137.      $scene = Scene_zhenwei.new(4)
  138.  
  139.       when 4  # 队组5出生点
  140.         # 演奏确定 SE
  141.         $game_system.se_play($data_system.decision_se)
  142.        $出战5=[]
  143.         # 队组4出生点
  144.       $scene = Scene_zhenwei.new(5)
  145.       when 5  
  146.         $game_system.se_play($data_system.decision_se)
  147.        $出战=[]
  148.       $scene = Scene_zhenwei.new(6)
  149.       when 6  
  150.         $game_system.se_play($data_system.decision_se)
  151.        $出战=[]
  152.       $scene = Scene_zhenwei.new(7)
  153.       when 7  
  154.         $game_system.se_play($data_system.decision_se)
  155.        $出战=[]
  156.       $scene = Scene_zhenwei.new(8)
  157.       when 8  
  158.         $game_system.se_play($data_system.decision_se)
  159.        $出战=[]
  160.       $scene = Scene_zhenwei.new(9)
  161.       when 9  
  162.         $game_system.se_play($data_system.decision_se)
  163.        $出战=[]
  164.        $scene = Scene_zhenwei.new(0)
  165.  
  166.  
  167.       end
  168.       return
  169.     end
  170.   end
  171.  
  172. end

Lv3.寻梦者

梦石
0
星屑
4721
在线时间
387 小时
注册时间
2012-11-8
帖子
276
2
发表于 2024-7-1 11:19:16 | 只看该作者
when 0  # 队组1出生点
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到物品画面
        $出战1=[]
       if $game_switches[20] = true
         $出战1=[9.13]
       end
        if $game_switches[21] = true
         $出战2=[9.113]
       end
       if $game_switches[20] = true
       p $出战1
     end
     if $game_switches[21] = true
       p $出战2
       end
       p @chuzhan_index
        $scene = Scene_zhenwei.new(1)

if判断相等用==,而=是赋值

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7474
在线时间
1302 小时
注册时间
2015-8-15
帖子
742
3
 楼主| 发表于 2024-7-2 07:42:06 | 只看该作者
qq634488405 发表于 2024-7-1 11:19
when 0  # 队组1出生点
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)

开关能正常使用了谢谢
  if Input.trigger?(Input::C)
      # 命令窗口的光标位置分支
      case @command1_window.index
      when 0  # 队组1出生点
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到物品画面
      # $game_switches[队伍1] = true #/ false
       $game_switches[20] = true
       $game_switches[21] = false
       $game_switches[22] = false
       $game_switches[23] = false
       $game_switches[24] = false
      case @command_window.index
      when 0  # 队组1出生点
        # 演奏确定 SE
        $game_system.se_play($data_system.decision_se)
        # 切换到物品画面
       # $出战1=[]
       if $game_switches[20] == true
         $出战1=[9.13]
        p $出战1
       end
        if $game_switches[21] == true
         $出战2=[9.113]
        p $出战2
       end
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-8 10:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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