#◆◇◆◇◆ ☆ A・C・A・システム ver 1.01 ◇◆◇◆◇ # - アニメ・セルリンク・アクション・システム - # ☆ マスタースクリプト ver 2.00 以降専用 # サポート掲示板 http://www2.ezbbs.net/21/minto-aaa/ # by みんと =begin 更新履歴 ver 1.01 画面アニメの座標のずれを修正 導入場所の注意 特にありませんが、 出来れば下の方に導入するのが好ましいです。 説明 旧バトラーアクション・アニメセルリンクと キャラアクション・アニメセルリンクの統合版です。 処理を大幅に軽量化し、汎用性も大きく向上しています。 旧素材との同時使用は出来ません。 アニメ表示中に指定したセルの拡大率等のデータと、 対象バトラーやマップキャラの拡大率等をリンクさせます。 例えば、1フレームで拡大率200なら、 対象も同じフレームで2倍拡大。 ただし、拡大だけは 合成方法が通常でXズームのみ、 加算でX・Yズーム、 減算でYズームのみとなっています。 設定には アニメ名 半角のスペース ac値です。 例 技発動 ac1 ↑の例だとno1のセルとリンク なお、セルの表示自体はされるので、 パターンを100などのありえない値にしてください。 また、リンク可能なデータは パターンと合成方法以外です。 リンクセルは2つまで可能です。 =end #============================================================================== # ☆ MINTO #------------------------------------------------------------------------------ # 様々なフラグを扱うメインモジュールです。 #============================================================================== module MINTO # A・C・A・システムを有効化 ( true で有効 / false で無効 ) RGSS["A・C・A・システム"] = true end if MINTO::RGSS["A・C・A・システム"] #============================================================================== # ■ RPG::Animation #============================================================================== module RPG class Animation def name name = @name.split(/ /)[0] return name != nil ? name : '' end def action_cell_id name = @name.split(/ac/)[1].to_i return name != 0 ? name : 0 end def action_cell_id2 name = @name.split(/ac/)[2].to_i return name != 0 ? name : 0 end end end #=========================================================================== # ■ RPG::Sprite #=========================================================================== module RPG class Sprite < ::Sprite #----------------------------------------------------------------------- # ● セルリンクセット #----------------------------------------------------------------------- def cell_link_set(id, cell_data) # セルリンクを更新 cell_link_update(id, cell_data, 0) cell_link_update(id, cell_data, 1) cell_link_update(id, cell_data, 2) cell_link_update(id, cell_data, 3) cell_link_update(id, cell_data, 4) cell_link_update(id, cell_data, 5) cell_link_update(id, cell_data, 6) cell_link_update(id, cell_data, 7) cell_link_update(id, cell_data, 8) cell_link_update(id, cell_data, 9) cell_link_update(id, cell_data, 10) cell_link_update(id, cell_data, 11) cell_link_update(id, cell_data, 12) cell_link_update(id, cell_data, 13) cell_link_update(id, cell_data, 14) cell_link_update(id, cell_data, 15) end #----------------------------------------------------------------------- # ● セルリンクセット #----------------------------------------------------------------------- def cell_link_set2(id, cell_data) # セルリンクを更新 cell_link_update2(id, cell_data, 0) cell_link_update2(id, cell_data, 1) cell_link_update2(id, cell_data, 2) cell_link_update2(id, cell_data, 3) cell_link_update2(id, cell_data, 4) cell_link_update2(id, cell_data, 5) cell_link_update2(id, cell_data, 6) cell_link_update2(id, cell_data, 7) cell_link_update2(id, cell_data, 8) cell_link_update2(id, cell_data, 9) cell_link_update2(id, cell_data, 10) cell_link_update2(id, cell_data, 11) cell_link_update2(id, cell_data, 12) cell_link_update2(id, cell_data, 13) cell_link_update2(id, cell_data, 14) cell_link_update2(id, cell_data, 15) end #----------------------------------------------------------------------- # ● アニメーション・セットスプライト #----------------------------------------------------------------------- def animation_set_sprites(sprites, cell_data, position) # 各アニメをセット animation_set(sprites, cell_data, position, 0) animation_set(sprites, cell_data, position, 1) animation_set(sprites, cell_data, position, 2) animation_set(sprites, cell_data, position, 3) animation_set(sprites, cell_data, position, 4) animation_set(sprites, cell_data, position, 5) animation_set(sprites, cell_data, position, 6) animation_set(sprites, cell_data, position, 7) animation_set(sprites, cell_data, position, 8) animation_set(sprites, cell_data, position, 9) animation_set(sprites, cell_data, position, 10) animation_set(sprites, cell_data, position, 11) animation_set(sprites, cell_data, position, 12) animation_set(sprites, cell_data, position, 13) animation_set(sprites, cell_data, position, 14) animation_set(sprites, cell_data, position, 15) end #----------------------------------------------------------------------- # ● アニメーション・セット #----------------------------------------------------------------------- def animation_set(sprites, cell_data, position, i) sprite = sprites[i] pattern = cell_data[i, 0] if sprite == nil or pattern == nil or pattern == -1 sprite.visible = false if sprite != nil return end sprite.visible = true sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192) if position == 3 if self.viewport != nil sprite.x = self.viewport.rect.width / 2 sprite.y = self.viewport.rect.height - 160 else sprite.x = 320 sprite.y = 240 end else sprite.x = self.x - self.ox + self.src_rect.width / 2 sprite.y = self.y - self.oy + self.src_rect.height / 2 sprite.y -= self.src_rect.height / 4 if position == 0 sprite.y += self.src_rect.height / 4 if position == 2 end sprite.x += cell_data[i, 1] sprite.y += cell_data[i, 2] sprite.z = 2000 sprite.ox = 96 sprite.oy = 96 sprite.zoom_x = cell_data[i, 3] / 100.0 sprite.zoom_y = cell_data[i, 3] / 100.0 sprite.angle = cell_data[i, 4] sprite.mirror = (cell_data[i, 5] == 1) sprite.opacity = cell_data[i, 6] * self.opacity / 255.0 sprite.blend_type = cell_data[i, 7] end end end #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :now_animation # アニメ表示中フラグ attr_accessor :animation_id # アニメID end #============================================================================== # ■ Sprite_Character #------------------------------------------------------------------------------ #  キャラクター表示用のスプライトです。Game_Character クラスのインスタンスを # 監視し、スプライトの状態を自動的に変化させます。 #============================================================================== class Sprite_Character < RPG::Sprite #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :animation_now # アニメ実行中フラグ #-------------------------------------------------------------------------- # ● X座標の変更 #-------------------------------------------------------------------------- def x=(n) # アニメ表示中の場合は処理をスキップする if self.animation_now and n == @character.screen_x return else # スーパークラスを実行 super(n) end end #-------------------------------------------------------------------------- # ● Y座標の変更 #-------------------------------------------------------------------------- def y=(n) # アニメ表示中の場合は処理をスキップする if self.animation_now and n == @character.screen_y return else # スーパークラスを実行 super(n) end end #-------------------------------------------------------------------------- # ● アニメーションの表示 #-------------------------------------------------------------------------- def animation(animation, hit) # アニメのIDを保存 $game_temp.animation_id = @character.animation_id # アニメ表示フラグをオンにする self.animation_now = true # スーパークラスを実行 super(animation, hit) end #-------------------------------------------------------------------------- # ● フレーム更新(アニメーション) #-------------------------------------------------------------------------- def update_animation # アニメ更新フレームが0の場合 if @_animation_duration == 0 # スーパークラスを実行 super $game_temp.animation_id = 0 $game_temp.now_animation = false self.animation_now = false # メソッドを返す return end frame_index = @_animation.frame_max - @_animation_duration cell_data = @_animation.frames[frame_index].cell_data id = @_animation.id # セルリンクをセット cell_link_set(id, cell_data) cell_link_set2(id, cell_data) # スーパークラスを実行 super end #-------------------------------------------------------------------------- # ● アニメーション解放 #-------------------------------------------------------------------------- def dispose_animation # スーパークラスを実行 super # 各データを初期化 self.zoom_x = 1 self.zoom_y = 1 self.angle = 0 self.opacity = 255 end #-------------------------------------------------------------------------- # ● セルリンク更新 #-------------------------------------------------------------------------- def cell_link_update(id, cell_data, i = 0) if id > 0 if i == Data_Animations.data[id].action_cell_id - 1 $game_temp.now_animation = true if $scene.is_a?(Scene_Map) if cell_data[i, 1] self.x = @character.screen_x + cell_data[i, 1] end if cell_data[i, 2] self.y = @character.screen_y + cell_data[i, 2] end else if cell_data[i, 1] self.x = @battler.screen_x + cell_data[i, 1] end if cell_data[i, 2] self.y = @battler.screen_y + cell_data[i, 2] end end case cell_data[i, 7] when 0 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 end when 1 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 self.zoom_y = cell_data[i, 3] / 100.0 end when 2 if cell_data[i, 3] self.zoom_y = cell_data[i, 3] / 100.0 end end if cell_data[i, 4] self.angle = cell_data[i, 4] end if cell_data[i, 6] self.opacity = cell_data[i, 6] end self.mirror = (cell_data[i, 5] == 1) end end end #-------------------------------------------------------------------------- # ● セルリンク更新 #-------------------------------------------------------------------------- def cell_link_update2(id, cell_data, i = 0) if id > 0 if i == Data_Animations.data[id].action_cell_id2 - 1 $game_temp.now_animation = true if cell_data[i, 1] self.x = @character.screen_x + cell_data[i, 1] end if cell_data[i, 2] self.y = @character.screen_y + cell_data[i, 2] end case cell_data[i, 7] when 0 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 end when 1 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 self.zoom_y = cell_data[i, 3] / 100.0 end when 2 if cell_data[i, 3] self.zoom_y = cell_data[i, 3] / 100.0 end end if cell_data[i, 4] self.angle = cell_data[i, 4] end if cell_data[i, 6] self.opacity = cell_data[i, 6] end self.mirror = (cell_data[i, 5] == 1) end end end end #============================================================================== # ■ Sprite_Battler #------------------------------------------------------------------------------ #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、 # スプライトの状態を自動的に変化させます。 #============================================================================== class Sprite_Battler < RPG::Sprite #-------------------------------------------------------------------------- # ● X座標の変更 #-------------------------------------------------------------------------- def x=(n) # アニメ表示中の場合は処理をスキップする if $game_temp.now_animation and n == @battler.screen_x return else # スーパークラスを実行 super(n) end end #-------------------------------------------------------------------------- # ● Y座標の変更 #-------------------------------------------------------------------------- def y=(n) # アニメ表示中の場合は処理をスキップする if $game_temp.now_animation and n == @battler.screen_y return else # スーパークラスを実行 super(n) end end #-------------------------------------------------------------------------- # ● アニメーションの表示 #-------------------------------------------------------------------------- def animation(animation, hit) # アニメのIDを保存 $game_temp.animation_id = @battler.animation_id # アニメ表示フラグをオンにする $game_temp.now_animation = true # スーパークラスを実行 super(animation, hit) end #-------------------------------------------------------------------------- # ● フレーム更新(アニメーション) #-------------------------------------------------------------------------- def update_animation # アニメ更新フレームが0の場合 if @_animation_duration == 0 # スーパークラスを実行 super $game_temp.animation_id = 0 $game_temp.now_animation = false # メソッドを返す return end frame_index = @_animation.frame_max - @_animation_duration cell_data = @_animation.frames[frame_index].cell_data id = $game_temp.animation_id # セルリンクをセット cell_link_set(id, cell_data) cell_link_set2(id, cell_data) # スーパークラスを実行 super end #-------------------------------------------------------------------------- # ● アニメーション解放 #-------------------------------------------------------------------------- def dispose_animation # スーパークラスを実行 super # 各データを初期化 self.zoom_x = 1 self.zoom_y = 1 self.angle = 0 self.opacity = 255 end #-------------------------------------------------------------------------- # ● セルリンク更新 #-------------------------------------------------------------------------- def cell_link_update(id, cell_data, i = 0) if @battler.animation_hit && id > 0 if i == Data_Animations.data[id].action_cell_id - 1 $game_temp.now_animation = true if $scene.is_a?(Scene_Map) if cell_data[i, 1] self.x = @character.screen_x + cell_data[i, 1] end if cell_data[i, 2] self.y = @character.screen_y + cell_data[i, 2] end else if cell_data[i, 1] self.x = @battler.screen_x + cell_data[i, 1] end if cell_data[i, 2] self.y = @battler.screen_y + cell_data[i, 2] end end case cell_data[i, 7] when 0 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 end when 1 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 self.zoom_y = cell_data[i, 3] / 100.0 end when 2 if cell_data[i, 3] self.zoom_y = cell_data[i, 3] / 100.0 end end if cell_data[i, 4] self.angle = cell_data[i, 4] end if cell_data[i, 6] self.opacity = cell_data[i, 6] end self.mirror = (cell_data[i, 5] == 1) end end end #-------------------------------------------------------------------------- # ● セルリンク更新 #-------------------------------------------------------------------------- def cell_link_update2(id, cell_data, i = 0) if @battler.animation_hit && id > 0 if i == Data_Animations.data[id].action_cell_id2 - 1 $game_temp.now_animation = true if cell_data[i, 1] self.x = @battler.screen_x + cell_data[i, 1] end if cell_data[i, 2] self.y = @battler.screen_y + cell_data[i, 2] end case cell_data[i, 7] when 0 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 end when 1 if cell_data[i, 3] self.zoom_x = cell_data[i, 3] / 100.0 self.zoom_y = cell_data[i, 3] / 100.0 end when 2 if cell_data[i, 3] self.zoom_y = cell_data[i, 3] / 100.0 end end if cell_data[i, 4] self.angle = cell_data[i, 4] end if cell_data[i, 6] self.opacity = cell_data[i, 6] end self.mirror = (cell_data[i, 5] == 1) end end end end end