Project1

标题: 轮盘系统选择逃跑问题 [打印本页]

作者: Password    时间: 2012-11-28 16:34
标题: 轮盘系统选择逃跑问题
本帖最后由 Password 于 2012-12-1 07:16 编辑

自己用了一个轮盘战斗系统(P叔那个不能兼容),但是现在选择逃跑会很奇怪……

直接转到“逃跑”的图标点下去不会有反应,但是要选择逃跑的话就要先摁Esc,然后键盘右键,再摁空格(默认式选择逃跑方法),如何做到转到逃跑那里点下就直接执行逃跑?

下面是脚本(取自魂之轮回)
RUBY 代码复制
  1. =begin ========================================================================
  2. * ziifee's Spin Command for RPG Tankentai Sideview Battle System
  3.   By ziifee ( [url]http://neomemo.web.fc2.com/[/url] )
  4.    <SBS Only>
  5.     -This script is only for the Tankentai SBS WITHOUT the ATB installed.
  6.    <Image Required>
  7.      Spin40 : Spin40.png is required in the Graphics/System folder.
  8. =end # ========================================================================
  9.  
  10. #==============================================================================
  11. # ■ Ziifee
  12. #==============================================================================
  13.  
  14. module Zii
  15.   # ▼ Spin Command/Icon Index Number
  16.   FIGHT = 132                        # Fight
  17.   ESCAPE = 9                         # Escape
  18.   ATTACK = 1                         # Attack (Default)
  19.   GUARD = 7                          # Guard
  20.   SKILL = 6                          # Skill
  21.   ITEM = 8                           # Item
  22.  
  23.   # ▼ Spin Command/Direction of Rotation ( "normal" or "reverse" )
  24.   #   Determines how Spin Command rotates according to left/right key press.
  25.   TURN = "normal"
  26.  
  27.   # ▼ Face Graphics (true: Use battle face graphic / false: don't use faces)
  28.   STATUS_FACE = true
  29.  
  30.   # ▼ Actor Names (true: Show actor names / false: Don't show )
  31.   STATUS_LINE = true
  32.  
  33.   # ▼ Actor Name Text Size ( VX default size: 20 )
  34.   LINE_SIZE = 14
  35.  
  36.   #--------------------------------------------------------------------------
  37.   # ● 通常回転 の判定
  38.   #--------------------------------------------------------------------------
  39.   def self.turn_normal?
  40.     return false if TURN == "reverse"
  41.     return true  if TURN == "normal"
  42.     return true
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● バトルオプション [顔グラフィック] の判定
  46.   #--------------------------------------------------------------------------
  47.   def self.battle_face?
  48.     return true if STATUS_FACE
  49.     return false
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # ● バトルステートオプション [名前] の判定
  53.   #--------------------------------------------------------------------------
  54.   def self.line_name?
  55.     return true if STATUS_LINE
  56.     return false
  57.   end
  58. end
  59.  
  60. #==============================================================================
  61. # ¡ Window_Base
  62. #==============================================================================
  63.  
  64. class Window_Base
  65.   #--------------------------------------------------------------------------
  66.   # ● 描绘脸谱
  67.   #     face_name  : 脸谱图像文件名
  68.   #     face_index : 脸谱图像索引
  69.   #     x          : 描绘目标 X 坐标
  70.   #     y          : 描绘目标 Y 坐标
  71.   #     size       : 显示大小
  72.   #     opacity    :不透明度
  73.   #--------------------------------------------------------------------------
  74.   def draw_face(face_name, face_index, x, y, size = 96, opacity = 255)
  75.     bitmap = Cache.face(face_name)
  76.     rect = Rect.new(0, 0, 0, 0)
  77.     rect.x = face_index % 4 * 96 + (96 - size) / 2
  78.     rect.y = face_index / 4 * 96 + (96 - size) / 2
  79.     rect.width = size
  80.     rect.height = size
  81.     self.contents.blt(x, y, bitmap, rect, opacity)
  82.     bitmap.dispose
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 描绘角色脸谱
  86.   #--------------------------------------------------------------------------
  87.   def draw_actor_face(actor, x, y, size = 96, opacity = 255)
  88.     draw_face(actor.face_name, actor.face_index, x, y, size, opacity)
  89.   end
  90. end
  91.  
  92. # ▼ 回転コマンド
  93. #==============================================================================
  94. # ■ Window_SpinCommand
  95. #------------------------------------------------------------------------------
  96. #  回転用コマンド選択を行うウィンドウです。
  97. #==============================================================================
  98.  
  99. class Window_SpinCommand < Window_Base
  100.   #--------------------------------------------------------------------------
  101.   # ● 公開インスタンス変数
  102.   #--------------------------------------------------------------------------
  103.   attr_reader   :index                    # カーソル位置
  104.   attr_reader   :help_window              # ヘルプウィンドウ
  105.   #--------------------------------------------------------------------------
  106.   # ● オブジェクト初期化
  107.   #     cx / cy  : 中心の X座標 / Y座標
  108.   #     commands : コマンド配列 (内容 は [name, kind, pull, enabled?])
  109.   #     setting  : 設定ハッシュ ("R"=>半径 "S"=>速さ "G"=>背景 "L"=>文字)
  110.   #--------------------------------------------------------------------------
  111.   def initialize(cx, cy, commands, setting = {})
  112.     @radius    = setting.has_key?("R") ? setting["R"] : 40  # 描画半径
  113.     @speed     = setting.has_key?("S") ? setting["S"] : 36  # 回転速さ
  114.     @spin_back = setting.has_key?("G") ? setting["G"] : ""  # 背景画像
  115.     @spin_line = setting.has_key?("L") ? setting["L"] : nil # 文字位置
  116.     x, y = cx - @radius - 28 , cy - @radius - 28
  117.     #width = height = @radius * 2 + 56
  118.     height = 210   #210  这个是那五个转轮内容的坐标
  119.     width = 210    #210
  120.     super(x, y, width, height)
  121.     self.opacity = 0
  122.     @index = 0
  123.     @commands = commands                                    # コマンド
  124.     @spin_right = true
  125.     @spin_count = 0
  126.     update_cursor
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # ▽ スピン画像を描画する (描画内容 強化用)
  130.   #     i  : インデックス
  131.   #     cx : 表示 中心位置 X座標
  132.   #     cy : 表示 中心位置 Y座標
  133.   #--------------------------------------------------------------------------
  134.   def draw_spin_graphic(i, cx, cy)
  135.     case command_kind(i)
  136.     when "icon"
  137.       draw_icon(command_pull(i), cx - 12, cy - 12, command_enabled?(i))
  138.     end
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ★ リフレッシュ バグ回避用
  142.   #--------------------------------------------------------------------------
  143.   def refresh
  144.     set_spin
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # ★ 項目の描画 バグ回避用
  148.   #--------------------------------------------------------------------------
  149.   def draw_item(index, enabled = true)
  150.     @commands[index][3] = enabled
  151.     set_spin
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 現在のコマンド名を取得する
  155.   #--------------------------------------------------------------------------
  156.   def command_name(index = @index)
  157.     return "" if index < 0
  158.     name = @commands[index][0]
  159.     return name != nil ? name : ""
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ● コマンドの種類を取得
  163.   #--------------------------------------------------------------------------
  164.   def command_kind(index)
  165.     result = @commands[index][1]
  166.     return result != nil ? result : ""
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # ● コマンドの引数 を取得
  170.   #--------------------------------------------------------------------------
  171.   def command_pull(index)
  172.     result = @commands[index][2]
  173.     return result != nil ? result : ""
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● コマンドの有効フラグを取得
  177.   #--------------------------------------------------------------------------
  178.   def command_enabled?(index)
  179.     result = @commands[index][3]
  180.     return result != nil ? result : true
  181.   end
  182.   #--------------------------------------------------------------------------
  183.   # ● 名前の位置に index を設定する
  184.   #--------------------------------------------------------------------------
  185.   def set_index(name)
  186.     n = -1
  187.     for i in [email]0...@commands.size[/email]
  188.       n = i if @commands[i][0] == name
  189.     end
  190.     @index = n if n >= 0
  191.     update_cursor
  192.     call_update_help
  193.     set_spin
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● カーソル位置の設定
  197.   #     index : 新しいカーソル位置
  198.   #--------------------------------------------------------------------------
  199.   def index=(index)
  200.     @index = index
  201.     update_cursor
  202.     call_update_help
  203.     set_spin
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 中心のX座標を取得
  207.   #--------------------------------------------------------------------------
  208.   def center_x
  209.     return contents.width / 2
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● 中心のY座標を取得
  213.   #--------------------------------------------------------------------------
  214.   def center_y
  215.     return contents.height / 2
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 項目数の取得
  219.   #--------------------------------------------------------------------------
  220.   def item_max
  221.     return @commands.size
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ● 背景の設定 (再定義 向き)
  225.   #--------------------------------------------------------------------------
  226.   def set_background
  227.     return if @spin_back == ""
  228.     bitmap = Cache.system(@spin_back)
  229.     rect = Rect.new(-34, 0-10, 210, 250)
  230.     self.contents.blt(12-4, 12+10, bitmap, rect)
  231.   end
  232.  
  233.   #--------------------------------------------------------------------------
  234.   # ● 文章の設定 (再定義 向き)
  235.   #--------------------------------------------------------------------------
  236.   def set_text
  237.     return if @spin_line == nil
  238.     y = center_y - WLH / 2 + @spin_line
  239.     self.contents.draw_text(center_x - 48, y, 96, WLH, command_name, 1)
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● スピンアイコンの角度の差を取得する
  243.   #--------------------------------------------------------------------------
  244.   def angle_size
  245.     return (Math::PI * 2 / item_max)
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● スピンアイコン回転時のカウント を設定する
  249.   #--------------------------------------------------------------------------
  250.   def set_spin_count
  251.     @spin_count = angle_size * 360 / @speed
  252.     set_spin(true)
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● スピン設定 の実行
  256.   #     spin : 回転フラグ (true の時回転中)
  257.   #--------------------------------------------------------------------------
  258.   def set_spin(spin = false)
  259.     self.contents.clear
  260.     set_background
  261.     angle = spin ? @speed * @spin_count / 360 : 0
  262.     angle = @spin_right ? angle : -angle
  263.     for i in 0...item_max
  264.       n = (i - @index) * angle_size + angle
  265.       cx = @radius * Math.sin(n) + center_x
  266.       cy = - @radius * Math.cos(n) + center_y
  267.       draw_spin_graphic(i, cx, cy)
  268.     end
  269.     set_text
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● フレーム更新
  273.   #--------------------------------------------------------------------------
  274.   def update
  275.     super
  276.     update_cursor
  277.     if @spin_count > 0
  278.       @spin_count -= 1
  279.       set_spin(@spin_count >= 1)
  280.       return
  281.     end
  282.     update_command
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● コマンドの移動可能判定
  286.   #--------------------------------------------------------------------------
  287.   def command_movable?
  288.     return false if @spin_count > 0
  289.     return false if (not visible or not active)
  290.     return false if (index < 0 or index > item_max or item_max == 0)
  291.     return false if (@opening or @closing)
  292.     return true
  293.   end
  294.   #--------------------------------------------------------------------------
  295.   # ● コマンドを右に移動
  296.   #--------------------------------------------------------------------------
  297.   def command_right
  298.     @index = (@index + 1) % item_max
  299.     @spin_right = true
  300.     set_spin_count
  301.   end
  302.   #--------------------------------------------------------------------------
  303.   # ● コマンドを左に移動
  304.   #--------------------------------------------------------------------------
  305.   def command_left
  306.     @index = (@index - 1 + item_max) % item_max
  307.     @spin_right = false
  308.     set_spin_count
  309.   end
  310.   #--------------------------------------------------------------------------
  311.   # ● コマンド選択の更新
  312.   #--------------------------------------------------------------------------
  313.   def update_command
  314.     if command_movable?
  315.       if Input.press?(Input::RIGHT)
  316.         Sound.play_cursor
  317.         Zii.turn_normal? ? command_right : command_left
  318.       end
  319.       if Input.press?(Input::LEFT)
  320.         Sound.play_cursor
  321.         Zii.turn_normal? ? command_left : command_right
  322.       end
  323.     end
  324.     call_update_help
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● カーソルの更新
  328.   #--------------------------------------------------------------------------
  329.   def update_cursor
  330.     if @index < 0
  331.       self.cursor_rect.empty
  332.     else
  333.       rect = Rect.new(0, 0, 24, 24)
  334.       rect.x = center_x - rect.width / 2
  335.       rect.y = center_y - rect.height / 2 - @radius
  336.       self.cursor_rect = rect
  337.       self.z = 200
  338.     end
  339.   end
  340.   #--------------------------------------------------------------------------
  341.   # ● ヘルプウィンドウの設定
  342.   #     help_window : 新しいヘルプウィンドウ
  343.   #--------------------------------------------------------------------------
  344.   def help_window=(help_window)
  345.     @help_window = help_window
  346.     call_update_help
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● ヘルプウィンドウ更新メソッドの呼び出し
  350.   #--------------------------------------------------------------------------
  351.   def call_update_help
  352.     if self.active and @help_window != nil
  353.        update_help
  354.     end
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # ● ヘルプウィンドウの更新 (内容は継承先で定義する)
  358.   #--------------------------------------------------------------------------
  359.   def update_help
  360.   end
  361. end
  362.  
  363. #==============================================================================
  364. # ¡ Window_LineHelp
  365. #------------------------------------------------------------------------------
  366. # @ƒXƒLƒ‹‚âƒAƒCƒeƒ€‚Ìà–¾AƒAƒNƒ^[‚̃Xƒe[ƒ^ƒX‚È‚Ç‚ð•\Ž¦‚·‚éƒEƒBƒ“ƒhƒE‚Å‚·B
  367. #==============================================================================
  368.  
  369. class Window_LineHelp < Window_Base
  370.   #--------------------------------------------------------------------------
  371.   # œ ƒIƒuƒWƒFƒNƒg‰Šú‰»  -16, 0,
  372.   #--------------------------------------------------------------------------
  373.   def initialize
  374.     super(-16, 0, 576, WLH + 32)
  375.     self.opacity = 0
  376.   end
  377.   #--------------------------------------------------------------------------
  378.   # œ ƒeƒLƒXƒgÝ’è
  379.   #     text  : ƒEƒBƒ“ƒhƒE‚É•\Ž¦‚·‚镶Žš—ñ
  380.   #     align : ƒAƒ‰ƒCƒ“ƒƒ“ƒg (0..¶‘µ‚¦A1..’†‰›‘µ‚¦A2..‰E‘µ‚¦)
  381.   #--------------------------------------------------------------------------
  382.   def set_text(text, align = 0)
  383.     if text != @text or align != @align
  384.       self.contents.clear
  385.       back_color = Color.new(0, 0, 0, 80)
  386.       self.contents.fill_rect(0, y = 12, contents.width, WLH - y, back_color)
  387.       self.contents.font.color = normal_color
  388.       self.contents.draw_text(20, 0, self.width - 72, WLH, text, align)
  389.       @text = text
  390.       @align = align
  391.     end
  392.   end
  393. end
  394.  
  395. #==============================================================================
  396. # ■ Window_ActorCommand
  397. #==============================================================================
  398.  
  399. class Window_ActorCommand < Window_SpinCommand
  400.   #--------------------------------------------------------------------------
  401.   # ● オブジェクト初期化  
  402.   #--------------------------------------------------------------------------
  403.   def initialize
  404.     s1 = [Vocab::attack, "icon", Zii::ATTACK, true]
  405.     s2 = [Vocab::skill,  "icon", Zii::SKILL,  true]
  406.     s3 = [Vocab::guard,  "icon", Zii::GUARD,  true]
  407.     s4 = [Vocab::item,   "icon", Zii::ITEM,   true]
  408.     s5 = [Vocab::escape, "icon", Zii::ESCAPE, $game_troop.can_escape]
  409.     setting = {"R"=>40, "S"=>52, "G"=>"Spin40", "L"=>-12}
  410.     super(72, 356, [s1, s2, s3, s4, s5], setting)#72,356
  411.     self.active = false
  412.     set_spin
  413.   end
  414.   #--------------------------------------------------------------------------
  415.   # ● セットアップ
  416.   #     actor : アクター
  417.   #--------------------------------------------------------------------------
  418.   def setup(actor)
  419.     @commands[0][2] = Zii::ATTACK
  420.     @commands[1][0] = Vocab::skill
  421.     if actor.weapons[0] != nil
  422.       n = actor.weapons[0].icon_index
  423.       @commands[0][2] = n if n > 0
  424.     end
  425.     @commands[1][0] = actor.class.skill_name if actor.class.skill_name_valid
  426.     self.index = 0
  427.     set_spin
  428.   end
  429. end
  430.  
  431. #==============================================================================
  432. # ■ Window_PartyCommand
  433. #==============================================================================
  434.  
  435. class Window_PartyCommand < Window_SpinCommand
  436.   #--------------------------------------------------------------------------
  437.   # ● オブジェクト初期化
  438.   #--------------------------------------------------------------------------
  439.   def initialize
  440.     s1 = [Vocab::fight,  "icon", Zii::FIGHT,  true]
  441.     s2 = [Vocab::escape, "icon", Zii::ESCAPE, $game_troop.can_escape]
  442.     setting = {"R"=>40, "S"=>52, "G"=>"Spin40", "L"=>-12}
  443.     super(72, 356, [s1, s2], setting)
  444.     self.active = false
  445.     set_spin
  446.   end
  447. end
  448.  
  449.  
  450. #==============================================================================
  451. # ¡ Window_BattleStatus
  452. #==============================================================================
  453.  
  454. class Window_BattleStatus < Window_Selectable
  455.   #--------------------------------------------------------------------------
  456.   # œ ƒIƒuƒWƒFƒNƒg‰Šú‰» ‰ü
  457.   #--------------------------------------------------------------------------
  458.   def initialize
  459.     super(0, 230, 710, 240)
  460.     @column_max = 1
  461.     refresh
  462.     self.active = false
  463.     self.opacity = 0
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # œ ƒXƒe[ƒg‚̍XV ‚̉º’n•`‰æ
  467.   #--------------------------------------------------------------------------
  468.   def draw_neomemo7_back
  469.     @neomemo7_clear = false
  470.     for index in 0...@item_max
  471.       x = index * 96
  472.       self.contents.clear_rect(x + 72, WLH * 3, 24, 24)
  473.       next unless Zii.battle_face?
  474.       actor = $game_party.members[index]
  475.       next if actor.hp <= 0
  476.       bitmap = Cache.face(actor.face_name)
  477.       rect = Rect.new(0, 0, 22, 22)
  478.       rect.x = actor.face_index % 4 * 96 + 72
  479.       rect.y = actor.face_index / 4 * 96 + 72
  480.       self.contents.blt(x + 72, WLH * 3, bitmap, rect, 192)
  481.     end
  482.   end
  483.   #--------------------------------------------------------------------------
  484.   # œ €–Ú‚Ì•`‰æ ‰ü
  485.   #--------------------------------------------------------------------------
  486.   def draw_item(index)
  487.     x = index * 144 + 20
  488.     x2 = 20
  489.     y = 15
  490.     rect = Rect.new(x, 0, 96, 96)
  491.     self.contents.clear_rect(rect)
  492.     self.contents.font.color = normal_color
  493.     self.contents.font.size = 12
  494.     actor = $game_party.members[index]
  495.     draw_actor_state2(actor, x + 72 + 40, WLH)
  496.     x = index * 144
  497.     x3 = 25
  498.     draw_actor_hp(actor, x + x2 + x3 + 6, WLH * 2 + 63, 95)
  499.     draw_actor_mp(actor, x + x2 + x3 + 18, WLH * 3 + 52, 95)
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # œ ƒJ[ƒ\ƒ‹‚̍XV
  503.   #--------------------------------------------------------------------------
  504.   def update_cursor
  505.     y = 15
  506.     if @index < 0                   # ƒJ[ƒ\ƒ‹ˆÊ’u‚ª 0 –¢–ž‚̏ꍇ
  507.       self.cursor_rect.empty        # ƒJ[ƒ\ƒ‹‚𖳌ø‚Æ‚·‚é
  508.     else                            # ƒJ[ƒ\ƒ‹ˆÊ’u‚ª 0 ˆÈã‚̏ꍇ
  509.       #rect = Rect.new(index * 161 - 12, 45, 137, 115)
  510.       #self.cursor_rect = rect
  511.     end
  512.   end
  513. end
  514.  
  515.  
  516. #==============================================================================
  517. # ¡ Scene_Battle
  518. #------------------------------------------------------------------------------
  519. # @ƒoƒgƒ‹‰æ–ʂ̏ˆ—‚ðs‚¤ƒNƒ‰ƒX‚Å‚·B
  520. #==============================================================================
  521.  
  522. class Scene_Battle < Scene_Base
  523.   #--------------------------------------------------------------------------
  524.   # œ î•ñ•\Ž¦ƒrƒ…[ƒ|[ƒg‚̍XV
  525.   #--------------------------------------------------------------------------
  526.   alias :neomemo13_update_info_viewport :update_info_viewport
  527.   def update_info_viewport
  528.     ox = @info_viewport.ox
  529.     neomemo13_update_info_viewport
  530.     @info_viewport.ox = ox
  531.     @status_window.update
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒh‘I‘ð‚ÌŠJŽn
  535.   #--------------------------------------------------------------------------
  536.   alias :neomemo13_start_actor_command_selection :start_actor_command_selection
  537.   def start_actor_command_selection
  538.     neomemo13_start_actor_command_selection
  539.     @actor_command_window.visible = true
  540.   end
  541.   #--------------------------------------------------------------------------
  542.   # œ ƒAƒNƒ^[ƒRƒ}ƒ“ƒh‘I‘ð‚̍XV
  543.   #--------------------------------------------------------------------------
  544.   alias :neomemo13_update_actor_command_selection :update_actor_command_selection
  545.   def update_actor_command_selection
  546.     return unless @actor_command_window.command_movable?
  547.     neomemo13_update_actor_command_selection
  548.   end
  549.  
  550.   #--------------------------------------------------------------------------
  551.   # œ ƒAƒCƒeƒ€‘I‘ð‚ÌŠJŽn
  552.   #--------------------------------------------------------------------------
  553.   alias :neomemo13_start_item_selection :start_item_selection
  554.   def start_item_selection
  555.     neomemo13_start_item_selection
  556.     @item_window.dispose if @item_window != nil
  557.     @help_window.dispose if @help_window != nil
  558.     @help_window = Window_LineHelp.new
  559.     @item_window = Window_Item.new(60, 70, 320, 232)
  560.     @item_window.help_window = @help_window
  561.     @item_window.opacity = 0
  562.   end
  563. end



目前问题已解决




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