- 注册时间
- 2004-5-22
- 最后登录
- 2008-3-13
⑥精研
论坛游人
- 积分
- 1659
|
发表于 2006-7-13 11:01:15
|
显示全部楼层
其实我想问的是!!
#更改队伍人数
#收集,修改 BY 玄天
#原作者:MOMOMOMO(日站)。其版权由其原作者拥有,任何人不得非法使用。
#队伍最大人数
ACTORS = 5
#战斗人数
BATTLER_ACTORS = 5
#战斗画面修补
#目标 3人 200, 4人 160, 5人 120
SPRITES_BATTLER = 120
#游戏开始时步行图的显示(1即是角色1的步行图,如此类推)
CHARACTER_GRAPHIC = 1
#========================下面基本不用修改==============================
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
# の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
# ● 取得战斗画面的 X 坐标
#--------------------------------------------------------------------------
def screen_x
# パーティ内の並び順から X 座標を計算して返す
# 返回计算后的队伍 X 坐标的排列顺序
if self.index != nil
return self.index * SPRITES_BATTLER + 80
else
return 0
end
end
end
# ●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# パーティを扱うクラスです。ゴールドやアイテムなどの情報が含まれます。このク
# ラスのインスタンスは $game_party で参照されます。
# 处理同伴的类。包含金钱以及物品的信息。本类的实例
# 请参考 $game_party。
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# ● アクターを加える
# actor_id : アクター ID
# ● 加入同伴
# actor_id : 角色 ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
# アクターを取得
# 获取角色
actor = $game_actors[actor_id]
# パーティ人数が 4 人未満で、このアクターがパーティにいない場合
# 同伴人数未满 4 人、本角色不在队伍中的情况下
if @actors.size < ACTORS and not @actors.include?(actor)
# アクターを追加
# 添加角色
@actors.push(actor)
# プレイヤーをリフレッシュ
# 还原主角
$game_player.refresh
end
end
#--------------------------------------------------------------------------
# ● アクターの配列
# ● 同伴队列
#--------------------------------------------------------------------------
def actors
a = []
if $game_temp.in_battle
for i in 0...[@actors.size, BATTLER_ACTORS].min
a.push(@actors)
end
else
a = @actors
end
return a
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ステータスウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def change_actor(index1, index2)
temp_skill1 = @actors[index1]
temp_skill2 = @actors[index2]
# 実際に入れ替える
@actors[index1] = temp_skill2
@actors[index2] = temp_skill1
end
#--------------------------------------------------------------------------
# ● 全員のアクションクリア
# ● 清除全体的行动
#--------------------------------------------------------------------------
def clear_actions
# パーティ全員のアクションをクリア
# 清除全体同伴的行为
for actor in actors
actor.current_action.clear
end
end
#--------------------------------------------------------------------------
# ● コマンド入力可能判定
# ● 可以输入命令的判定
#--------------------------------------------------------------------------
def inputable?
# 一人でもコマンド入力可能なら true を返す
# 如果一可以输入命令就返回 true
for actor in actors
if actor.inputable?
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ● 対象アクターのランダムな決定
# hp0 : HP 0 のアクターに限る
# ● 对像角色的随机确定
# hp0 : 限制为 HP 0 的角色
#--------------------------------------------------------------------------
def random_target_actor(hp0 = false)
# ルーレットを初期化
# 初始化轮流
roulette = []
# ループ
# 循环
for actor in actors
# 条件に該当する場合
# 符合条件的场合
if (not hp0 and actor.exist?) or (hp0 and actor.hp0?)
# アクターのクラスの [位置] を取得
# 获取角色职业的位置 [位置]
position = $data_classes[actor.class_id].position
# 前衛のとき n = 4、中衛のとき n = 3、後衛のとき n = 2
# 前卫的话 n = 4、中卫的话 n = 3、后卫的话 n = 2
n = 4 - position
# ルーレットにアクターを n 回追加
# 添加角色的轮流 n 回
n.times do
roulette.push(actor)
end
end
end
# ルーレットのサイズが 0 の場合
# 轮流大小为 0 的情况
if roulette.size == 0
return nil
end
# ルーレットを回し、アクターを決定
# 转轮盘赌,决定角色
return roulette[rand(roulette.size)]
end
#--------------------------------------------------------------------------
# ● 全滅判定
#--------------------------------------------------------------------------
def all_dead?
# パーティ人数が 0 人の場合
if $game_party.actors.size == 0
return false
end
# HP 0 以上のアクターがパーティにいる場合
for actor in actors
if actor.hp > 0
return false
end
end
# 全滅
return true
end
#--------------------------------------------------------------------------
# ● 対象アクターのスムーズな決定
# actor_index : アクターインデックス
#--------------------------------------------------------------------------
def smooth_target_actor(actor_index)
# アクターを取得
actor = actors[actor_index]
# アクターが存在する場合
if actor != nil and actor.exist?
return actor
end
# ループ
for actor in actors
# アクターが存在する場合
if actor.exist?
return actor
end
end
end
end
# ●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●
#==============================================================================
# ■ Game_Player
#------------------------------------------------------------------------------
# プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
# 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# パーティ人数が 0 人の場合
if $game_party.actors.size == 0
# キャラクターのファイル名と色相をクリア
@character_name = ""
@character_hue = 0
# メソッド終了
return
end
# アクターを取得
if $game_party.actors.include?($game_actors[CHARACTER_GRAPHIC]) && CHARACTER_GRAPHIC != 0
actor = $game_actors[CHARACTER_GRAPHIC]
else
actor = $game_party.actors[0]
end
# キャラクターのファイル名と色相を設定
@character_name = actor.character_name
@character_hue = actor.character_hue
# 不透明度と合成方法を初期化
@opacity = 255
@blend_type = 0
end
end
# ●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●
#==============================================================================
# ■ Spriteset_Battle
#------------------------------------------------------------------------------
# バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ
# スの内部で使用されます。
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
# ビューポートを作成
@viewport1 = Viewport.new(0, 0, 640, 320)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport4 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 101
@viewport3.z = 200
@viewport4.z = 5000
# バトルバックスプライトを作成
@battleback_sprite = Sprite.new(@viewport1)
# エネミースプライトを作成
@enemy_sprites = []
for enemy in $game_troop.enemies.reverse
@enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
end
# アクタースプライトを作成
@actor_sprites = []
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
@actor_sprites.push(Sprite_Battler.new(@viewport2))
if BATTLER_ACTORS > 4
for i in 4...BATTLER_ACTORS
@actor_sprites.push(Sprite_Battler.new(@viewport2))
end
end
# 天候を作成
@weather = RPG::Weather.new(@viewport1)
# ピクチャスプライトを作成
@picture_sprites = []
for i in 51..100
@picture_sprites.push(Sprite_Picture.new(@viewport3,
$game_screen.pictures))
end
# タイマースプライトを作成
@timer_sprite = Sprite_Timer.new
# フレーム更新
update
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_actor_change update
def update
if BATTLER_ACTORS > 4
for i in 4...BATTLER_ACTORS
@actor_sprites.battler = $game_party.actors
end
end
update_actor_change
end
end
# ●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●
#==============================================================================
# ■ Window_MenuStatus
#------------------------------------------------------------------------------
# メニュー画面でパーティメンバーのステータスを表示するウィンドウです。
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 480, 480)
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item_max = $game_party.actors.size
self.contents = Bitmap.new(width - 32, self.row_max * 116 - 16)
for i in 0...$game_party.actors.size
x = 64
y = i * 116
actor = $game_party.actors
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y)
draw_actor_class(actor, x + 144, y)
draw_actor_level(actor, x, y + 32)
draw_actor_state(actor, x + 90, y + 32)
draw_actor_exp(actor, x, y + 64)
draw_actor_hp(actor, x + 236, y + 32)
draw_actor_sp(actor, x + 236, y + 64)
end
end
#--------------------------------------------------------------------------
# ● カーソル矩形更新
#--------------------------------------------------------------------------
def update_cursor_rect
# カーソル位置が 0 未満の場合
if @index < 0
self.cursor_rect.empty
return
end
# 現在の行を取得
row = @index
# 現在の行が、表示されている先頭の行より前の場合
if row < self.top_row
# 現在の行が先頭になるようにスクロール
self.top_row = row
end
# 現在の行が、表示されている最後尾の行より後ろの場合
if row > self.top_row + (self.page_row_max - 1)
# 現在の行が最後尾になるようにスクロール
self.top_row = row - (self.page_row_max - 1)
end
# カーソルの幅を計算
cursor_width = self.width - 32
# カーソルの座標を計算
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * 116 - self.oy
# カーソルの矩形を更新
self.cursor_rect.set(x, y, self.width - 32, 100)
end
#--------------------------------------------------------------------------
# ● 先頭の行の取得
#--------------------------------------------------------------------------
def top_row
# ウィンドウ内容の転送元 Y 座標を、1 行の高さ 116 で割る
return self.oy / 116
end
#--------------------------------------------------------------------------
# ● 先頭の行の設定
# row : 先頭に表示する行
#--------------------------------------------------------------------------
def top_row=(row)
# row が 0 未満の場合は 0 に修正
if row < 0
row = 0
end
# row が row_max - 1 超の場合は row_max - 1 に修正
if row > row_max - 1
row = row_max - 1
end
# row に 1 行の高さ 116 を掛け、ウィンドウ内容の転送元 Y 座標とする
self.oy = row * 116
end
#--------------------------------------------------------------------------
# ● 1 ページに表示できる行数の取得
#--------------------------------------------------------------------------
def page_row_max
return 4
end
end
# ●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●
#==============================================================================
# ■ Window_BattleStatus
#------------------------------------------------------------------------------
# バトル画面でパーティメンバーのステータスを表示するウィンドウです。
#==============================================================================
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_LargeParty initialize
def initialize
# 元の処理を実行
initialize_KGC_LargeParty
# レベルアップフラグを再作成
@level_up_flags = []
for i in 0...BATTLER_ACTORS
@level_up_flags = false
end
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
# self.contents.font.size = 18
# self.contents.draw_text(0, 32, 24, 32, "HP")
# self.contents.draw_text(0, 64, 24, 32, "MP")
@item_max = $game_party.actors.size
# self.contents.font.size = 20
for i in 0...$game_party.actors.size
actor = $game_party.actors
actor_x = i * SPRITES_BATTLER + 4
draw_actor_name(actor, actor_x, 0)
draw_actor_hp(actor, actor_x, 32, 120)
draw_actor_sp(actor, actor_x, 64, 120)
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end
# ●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●
#==============================================================================
# ■ Scene_Menu
#------------------------------------------------------------------------------
# メニュー画面の処理を行うクラスです。
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# menu_index : コマンドのカーソル初期位置
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
@actor_change = false
@actor_index = nil
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
alias update_command_actor_change update_command
def update_command
# 元の処理を実行
update_command_actor_change
# 方向ボタンの左か右が押された場合
if Input.trigger?(Input: EFT) || Input.trigger?(Input::RIGHT)
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
@actor_change = true
@actor_index = nil
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ステータスウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_status
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# コマンドウィンドウをアクティブにする
@command_window.active = true
@status_window.active = false
@status_window.index = -1
@actor_change = false
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
if @actor_change
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
if @actor_index == nil
@actor_index = @status_window.index
else
$game_party.change_actor(@actor_index, @status_window.index)
@actor_index = nil
@status_window.refresh
if $game_party.actors.include?($game_actors[CHARACTER_GRAPHIC]) == false ||
CHARACTER_GRAPHIC == 0
$game_player.refresh
end
end
return
else
# コマンドウィンドウのカーソル位置で分岐
case @command_window.index
when 1 # スキル
# このアクターの行動制限が 2 以上の場合
if $game_party.actors[@status_window.index].restriction >= 2
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# スキル画面に切り替え
$scene = Scene_Skill.new(@status_window.index)
when 2 # 装備
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 装備画面に切り替え
$scene = Scene_Equip.new(@status_window.index)
when 3 # ステータス
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# ステータス画面に切り替え
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
# ●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●○●
#==============================================================================
# ■ Scene_Battle (分割定義 2)
#------------------------------------------------------------------------------
# バトル画面の処理を行うクラスです。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● アクターコマンドウィンドウのセットアップ
#--------------------------------------------------------------------------
alias phase3_setup_command_window_actor_change phase3_setup_command_window
def phase3_setup_command_window
# 元の処理を実行
phase3_setup_command_window_actor_change
# アクターコマンドウィンドウの位置を設定
@actor_command_window.x = @actor_index * SPRITES_BATTLER
end
end
这是设定队伍人数和参战人数的脚本!里面有很多地方需要修改和增加的样子!!
首先第一项是修改Game_Actor里的内容!
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors)
# の内部で使用され、Game_Party クラス ($game_party) からも参照されます。
# 处理角色的类。本类在 Game_Actors 类 ($game_actors)
# 的内部使用、Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● バトル画面 X 座標の取得
# ● 取得战斗画面的 X 坐标
#--------------------------------------------------------------------------
def screen_x
# パーティ内の並び順から X 座標を計算して返す
# 返回计算后的队伍 X 坐标的排列顺序
if self.index != nil
return self.index * SPRITES_BATTLER + 80
else
return 0
end
end
end
我不明白的地方是,按照上面单独修改相同部分其他不动,还是替换掉项目内全部内容? |
|