Project1
标题:
在战斗中切换对敌人使用或对队友使用
[打印本页]
作者:
feizhaodan
时间:
2011-9-2 23:21
标题:
在战斗中切换对敌人使用或对队友使用
还是先上脚本:
#==============================================================================
# 囧 切换攻击目标
#------------------------------------------------------------------------------
# 制作者:feizhaodan
# 版本号:1.0.0(话说这个需要么?)
#==============================================================================
#=begin
#==============================================================================
# ■ Change_Scope
#------------------------------------------------------------------------------
# 设置内容。
#==============================================================================
module Change_Scope
BOTTON = Input::X
# 把X换成你喜欢的键。
# 详细请看帮助里的 RPG Maker VX -》 游戏操控 -》 基本操控 里的按键
end
#==============================================================================
# ■ RPG::Skill
#------------------------------------------------------------------------------
# 技能类(新定义)
#==============================================================================
module RPG
class Skill < UsableItem
alias cs_initialize initialize
def initialize
cs_initialize
@last_scope = 0
@originila_scope = 0
end
#--------------------------------------------------------------------------
# ● 更改 目标
#--------------------------------------------------------------------------
def change_scope
if self.scope != self.last_scope
self.scope = self.last_scope
else
if self.for_opponent?
if self.for_all?
self.scope = 8
else
self.scope = 7
end
elsif self.for_friend? and not self.for_dead_friend?
if self.for_all?
self.scope = 2
else
self.scope = 1
end
end
end
end
#--------------------------------------------------------------------------
# ● 获取原目标
#--------------------------------------------------------------------------
def get_last_scope
@last_scope = @scope
end
#--------------------------------------------------------------------------
# ● 储存原目标
#--------------------------------------------------------------------------
def set_original_scope
@original_scope = @scope
end
#--------------------------------------------------------------------------
# ● 储存原目标
#--------------------------------------------------------------------------
def reset_scope
@scope = @original_scope
end
attr_accessor :last_scope
end
end
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# □ 更新同伴目标选择(再定义)
#--------------------------------------------------------------------------
def update_target_actor_selection
@target_actor_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_target_actor_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
@active_battler.action.target_index = @target_actor_window.index
end_target_actor_selection
end_skill_selection
end_item_selection
next_actor
elsif Input.trigger?(Change_Scope::BOTTON)
if @selected_skill == false
Sound.play_decision
@active_battler.action.changed = false
start_target_enemy_selection(false, true)
else
if @skill.for_dead_friend? or @skill.scope == 0
Sound.play_buzzer
return
else
Sound.play_decision
@skill.change_scope
determine_skill(2)
end
end
end
end
#--------------------------------------------------------------------------
# □ 更新敌人目标选择(再定义)
#--------------------------------------------------------------------------
def update_target_enemy_selection
@target_enemy_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_target_enemy_selection
elsif Input.trigger?(Input::C)
Sound.play_decision
@active_battler.action.target_index = @target_enemy_window.enemy.index
end_target_enemy_selection
end_skill_selection
end_item_selection
next_actor
elsif Input.trigger?(Change_Scope::BOTTON)
if @selected_skill == false
Sound.play_decision
@active_battler.action.changed = true
start_target_actor_selection(false, true)
else
if @skill.scope == 0
Sound.play_buzzer
return
else
Sound.play_decision
@skill.change_scope
determine_skill(1)
end
end
end
end
#--------------------------------------------------------------------------
# □ 确认技能(再定义)
#--------------------------------------------------------------------------
def determine_skill(before = 0)
@active_battler.action.set_skill(@skill.id)
if before == 0
@skill_window.active = false
end
if before != 0
$game_message.visible = false
@info_viewport.visible = true
if @skill.for_opponent?
start_target_enemy_selection(true, true)
else
start_target_actor_selection(true, true)
end
else
if @skill.need_selection?
if @skill.for_opponent?
start_target_enemy_selection(true)
else
start_target_actor_selection(true)
end
else
end_skill_selection
next_actor
end
end
end
#==============================================================================
# 囧 切换攻击目标
#------------------------------------------------------------------------------
# 制作者:feizhaodan
# 版本号:1.0.0(话说这个需要么?)
#==============================================================================
#--------------------------------------------------------------------------
# □ 更新技能选择(再定义)
#--------------------------------------------------------------------------
def update_skill_selection
@skill_window.active = true
@skill_window.update
@help_window.update
if Input.trigger?(Input::B)
Sound.play_cancel
end_skill_selection
elsif Input.trigger?(Input::C)
@skill = @skill_window.skill
@skill.get_last_scope
if @skill != nil
@active_battler.last_skill_id = @skill.id
end
if @active_battler.skill_can_use?(@skill)
Sound.play_decision
determine_skill
else
Sound.play_buzzer
end
end
end
#--------------------------------------------------------------------------
# ● 开始敌人目标选择
#--------------------------------------------------------------------------
def start_target_enemy_selection(from_skill = false, before = false)
@target_enemy_window = Window_TargetEnemy.new
@selected_skill = from_skill
if before
@info_viewport.rect.x -= @target_actor_window.width
@info_viewport.ox -= @target_actor_window.width
@target_actor_window.active = false
@target_actor_window.visible = false
@target_actor_window = nil
end
@target_enemy_window.y = @info_viewport.rect.y
@info_viewport.rect.x += @target_enemy_window.width
@info_viewport.ox += @target_enemy_window.width
@actor_command_window.active = false
end
#--------------------------------------------------------------------------
# ● 开始同伴目标选择
#--------------------------------------------------------------------------
def start_target_actor_selection( from_skill = false, before = false)
@target_actor_window = Window_BattleStatus.new
@selected_skill = from_skill
if before
@info_viewport.rect.x -= @target_enemy_window.width
@info_viewport.ox -= @target_enemy_window.width
@target_enemy_window.active = false
@target_enemy_window.visible = false
@target_enemy_window = nil
end
@target_actor_window.index = 0
@target_actor_window.active = true
@target_actor_window.y = @info_viewport.rect.y
@info_viewport.rect.x += @target_actor_window.width
@info_viewport.ox += @target_actor_window.width
@actor_command_window.active = false
end
#--------------------------------------------------------------------------
# ● 胜利处理
#--------------------------------------------------------------------------
def process_victory
@info_viewport.visible = false
@message_window.visible = true
RPG::BGM.stop
$game_system.battle_end_me.play
unless $BTEST
$game_temp.map_bgm.play
$game_temp.map_bgs.play
end
display_exp_and_gold
display_drop_items
display_level_up
$game_party.reset_skill_scope
battle_end(0)
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 处理角色的类。本类在 Game_Actors 类 ($game_actors) 的内部使用、
# Game_Party 类请参考 ($game_party) 。
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 学会技能(增加储存元目标处理)
# skill_id : 技能 ID
#--------------------------------------------------------------------------
alias set_ori_scope_learn_skill learn_skill
def learn_skill(skill_id)
unless skill_learn?($data_skills[skill_id])
skill = $data_skills[skill_id]
skill.set_original_scope
set_ori_scope_learn_skill(skill_id)
end
end
end
#==============================================================================
# ■ Game_Party
#------------------------------------------------------------------------------
# 处理同伴的类。包含金钱以及物品的信息。本类的实例请参考 $game_party。
#==============================================================================
class Game_Party < Game_Unit
def reset_skill_scope
for member in members
for skill in member.skills
skill.reset_scope
end
end
end
end
#==============================================================================
# ■ Game_BattleAction
#------------------------------------------------------------------------------
# 处理战斗中的行动的类。这个类在 Game_Battler 类 的内部使用。
#==============================================================================
class Game_BattleAction
#--------------------------------------------------------------------------
# ● 定义实例变量
#--------------------------------------------------------------------------
attr_accessor :changed # 是否切换过
#--------------------------------------------------------------------------
# ● 清除
#--------------------------------------------------------------------------
alias change_scope_clear clear
def clear
change_scope_clear
@changed = false
end
#--------------------------------------------------------------------------
# ● 获取敌人同伴
#--------------------------------------------------------------------------
alias change_scope_opponents_unit opponents_unit
def opponents_unit
if @changed == false
change_scope_opponents_unit
else
if battler.actor?
return $game_party
else
return $game_troop
end
end
end
end
#==============================================================================
# 囧 切换攻击目标
#------------------------------------------------------------------------------
# 制作者:feizhaodan
# 版本号:1.0.0(话说这个需要么?)
#==============================================================================
#=end
复制代码
功能:在游戏中按你指定的键,可以切换目标类型。就是敌人《------》队友 的切换。
目前敌单体多次和敌数体随机只能切换成队友单体,而对死去的队友的技能也没法切换。
这个是我第三个脚本了。希望大家支持支持。
作者:
九夜神尊
时间:
2011-9-2 23:25
DQ某些版本里面有这种系统,这种玩意会用的人不多。不过有用是真的。
作者:
李梦遥
时间:
2011-9-2 23:28
正好有用,抱走 ~
作者:
MSQ
时间:
2011-9-3 19:02
会脚本真是好,来小小的支持一下~~
作者:
summer92
时间:
2011-9-5 22:55
我还以为是 VX 战斗中换人。。。。要不要来一个。。。。
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1