幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1422|回复: 1

[求助]有關於行動圖戰鬥系統腳本的問題!

[复制链接]

1

主题

1

帖子

24

积分

②入门

积分
24
发表于 2006-5-14 08:49:12 | 显示全部楼层 |阅读模式
各位好:
在網路上看到了一個行動圖戰鬥的腳本,覺得還蠻方便的,但是他只可以在主角使用,若想要把怪也用行動圖的話,要在哪裡修改呢!麻煩各位大大幫幫忙!謝了!以下就是這個腳本,請幫看看。

#==============================================================================
# ++ サイドビューバトル(歩行グラフィック版) ver. 1.13 ++
#  Script by パラ犬
# http://rpg.para.s3p.net/
#  修改,整理,汉化:玄天
# 战斗横版,行走图显示
#==============================================================================

module SDVA

#-----------------------------總括設置--------------------------------------
X_LINE = 550 # 橫位置座標
Y_LINE = 200 # 縱位置左邊
X_SPACE = 15 # 橫位置間隔
Y_SPACE = 40 # 縱位置間隔
X_POSITION = 0 # 隊列[前衛・中衛・後衛]的橫間隔
Y_POSITION = 0 # 隊列[前衛・中衛・後衛]的縱間隔

ATTACK_MOVE = true # 攻擊時是否向前進一步( true / false )
SKILL_MOVE = true # 使用技能時是否向前進一步( true / false )
ITEM_MOVE = false # 使用物品時是否向前進一步( true / false )
MOVE_STEP = 20 # 前進的步數
MOVE_PIXEL = 15# 每一步的象素數

PARTY_POS = 1 # 初始人物面向( 0:下 / 1:左 / 2:右 / 3:上 )

WINDOWPOS_CHANGE = true # 在人物旁邊顯示指令視窗嗎?( true / false )

end
#-------------------------下面不用修改-------------------------------------

#==============================================================================
# ■ Game_Actor
#==============================================================================

class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 戰鬥畫面X座標取得
#--------------------------------------------------------------------------
def screen_x
if self.index != nil
# 佇列取得
pos = $data_classes[self.class_id].position
x_pos = pos * SDVA::X_POSITION
scr_x = self.index * SDVA::X_SPACE + SDVA::X_LINE + x_pos
# 移動時候動作
if self.current_action.move_action == true
# 橫移動
scr_x += @shift_x
end
return scr_x
else
return 0
end
end
#--------------------------------------------------------------------------
# ● 戰鬥畫面Y取得
#--------------------------------------------------------------------------
def screen_y
if self.index != nil
# 佇列取得
pos = $data_classes[self.class_id].position
y_pos = pos * SDVA::Y_POSITION
scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos
# 移動時候動作
if self.current_action.move_action == true
# 縱移動
scr_y += @shift_y
end
return scr_y
else
return 0
end
end
#--------------------------------------------------------------------------
# ● 戰鬥畫面Z座標取得
#--------------------------------------------------------------------------
def screen_z
if self.index != nil
return self.index
else
return 0
end
end
end

#==============================================================================
# ■ Game_Battler (分割定義 1)
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# ● 公開變數
#--------------------------------------------------------------------------
attr_reader :pattern # 步行圖
attr_reader :trans_x # X方向移動距離
attr_reader :moving # 移動中標誌
#--------------------------------------------------------------------------
# ● 全局初期化
#--------------------------------------------------------------------------
alias initialize_sdva initialize
def initialize
initialize_sdva
move_reset
end
#--------------------------------------------------------------------------
# ○ 移動數
#--------------------------------------------------------------------------
def move
@moving = 1
if @step < SDVA::MOVE_STEP
# 滿足移動步數
@pattern = (@pattern + 1) % 4
@step += 1
move_step
else
# 移動終了
@pattern = 1
@moving = 2
end
end
#--------------------------------------------------------------------------
# ○ 移動處理
#--------------------------------------------------------------------------
def move_step
# 根據設定的方向改變移動座標
case SDVA:ARTY_POS
when 0
@shift_y = @step * SDVA::MOVE_PIXEL
when 1
@shift_x = -(@step * SDVA::MOVE_PIXEL)
when 2
@shift_x = @step * SDVA::MOVE_PIXEL
when 3
@shift_y = -(@step * SDVA::MOVE_PIXEL)
end
end
#--------------------------------------------------------------------------
# ○ 移動復位
#--------------------------------------------------------------------------
def move_reset
@moving = 0
@pattern = 0
@step = 0
@shift_x = 0
@shift_y = 0
end
end

#==============================================================================
# ■ Game_BattleAction
#==============================================================================

class Game_BattleAction
#--------------------------------------------------------------------------
# ● 公開變數
#--------------------------------------------------------------------------
attr_accessor :move_action # 移動的動作
#--------------------------------------------------------------------------
# ● クリア
#--------------------------------------------------------------------------
alias clear_sdva clear
def clear
clear_sdva
@move_action = false
end
end

#==============================================================================
# ■ Sprite_Battler
#==============================================================================

class Sprite_Battler < RPG::Sprite
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias update_sdva update
def update
super
# 戰鬥角色在的時候
if @battler.is_a?(Game_Actor)
# 如果檔案名或者角色與現在的不同
# 行動中の場合
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue or
@battler.current_action.basic == 0 or
@battler.current_action.kind != 3
# 取得點陣圖,設定
@character_name = @battler.character_name
@character_hue = @battler.character_hue
# 描繪步行圖
self.bitmap = RPG::Cache.character(@character_name, @character_hue)
cw = self.bitmap.width / 4
ch = self.bitmap.height / 4
@width = cw
@height = ch
if @battler.current_action.move_action == true
# 使之行動
@battler.move
else
@battler.move_reset
end
# 転送元の矩形を設定(機器:設定轉送原來的矩形.我理解不能)
sx = @battler.pattern * cw
sy = SDVA:ARTY_POS * ch
self.src_rect.set(sx, sy, cw, ch)
self.ox = @width / 2
self.oy = @height
# 隠れ狀態なら不透明度を 0 にする(機器:要是隱藏狀態把不透明度做為0)
# 本人理解不能...
if @battler.hidden
self.opacity = 0
end
end
end
update_sdva
end
end

#==============================================================================
# ■ Scene_Battle 下面我就不翻譯了,翻譯不了..可惡
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_sdva phase3_setup_command_window
def phase3_setup_command_window
phase3_setup_command_window_sdva
if SDVA::WINDOWPOS_CHANGE
# アクターコマンドウィンドウの位置を設定
case SDVA:ARTY_POS
when 0
x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
y_pos = @active_battler.screen_y
when 1
x_pos = @active_battler.screen_x - @actor_command_window.width - 16
y_pos = @active_battler.screen_y - @actor_command_window.height
when 2
x_pos = @active_battler.screen_x + 16
y_pos = @active_battler.screen_y - @actor_command_window.height
when 3
x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
y_pos = @active_battler.screen_y - @actor_command_window.height - 48
end
@actor_command_window.x = x_pos >= 0 ? x_pos : 0
@actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
@actor_command_window.y = y_pos >= 0 ? y_pos : 0
@actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
# ステータスウインドウに隠れないように
@actor_command_window.z = 9999
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
#--------------------------------------------------------------------------
alias update_phase4_step3_sdva update_phase4_step3
def update_phase4_step3
if SDVA::ATTACK_MOVE
if @active_battler.current_action.basic == 0
@active_battler.current_action.move_action = true
end
end
if SDVA::SKILL_MOVE
if @active_battler.current_action.kind == 1
@active_battler.current_action.move_action = true
end
end
if SDVA::ITEM_MOVE
if @active_battler.current_action.kind == 2
@active_battler.current_action.move_action = true
end
end
# バトラーがアクターに含まれ、移動アクション中
if @active_battler.is_a?(Game_Actor) and
@active_battler.current_action.move_action
# 移動終了時
if @active_battler.moving == 2
update_phase4_step3_sdva
end
else
if @active_battler.moving == 0
update_phase4_step3_sdva
end
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
#--------------------------------------------------------------------------
alias update_phase4_step6_sdva update_phase4_step6
def update_phase4_step6
@active_battler.current_action.move_action = false
@active_battler.move_reset
update_phase4_step6_sdva
end
end

#==============================================================================
# ■ Spriteset_Battle
#==============================================================================

class Spriteset_Battle
#--------------------------------------------------------------------------
# ● 全局初期化
#--------------------------------------------------------------------------
alias initialize_sdva initialize
def initialize
initialize_sdva
@viewport2.z = 1
end
end

#==============================================================================
# ■ Arrow_Actor
#==============================================================================

class Arrow_Actor < Arrow_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias update_sdva update
def update
update_sdva
# 游標下
if Input.repeat?(Input:OWN)
$game_system.se_play($data_system.cursor_se)
@index += 1
@index %= $game_party.actors.size
end
# 游標上
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
@index += $game_party.actors.size - 1
@index %= $game_party.actors.size
end
end
end

#==============================================================================
# ■ Arrow_Enemy
#==============================================================================

class Arrow_Enemy < Arrow_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
alias update_sdva update
def update
update_sdva
# 游標下
if Input.repeat?(Input:OWN)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
# 游標上
if Input.repeat?(Input::UP)
$game_system.se_play($data_system.cursor_se)
$game_troop.enemies.size.times do
@index += $game_troop.enemies.size - 1
@index %= $game_troop.enemies.size
break if self.enemy.exist?
end
end
end
end
回复

使用道具 举报

0

主题

1

帖子

13

积分

②入门

积分
13
发表于 2006-5-30 13:16:49 | 显示全部楼层
推推~我也想知道
有大大知道該怎麼改嗎?
謝謝~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2026-6-22 00:13 , Processed in 0.012742 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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