【不是创意的创意】关于图标选项菜单和逃跑选项的整合...
首先按照取消战斗、逃跑的办法取消战斗、逃跑项在Scene_Battle 2选项里面修改
# 有效化同伴指令窗口
@party_command_window.active = false
@party_command_window.visible = false
然后再把第62行后面的
def update_phase 2
后面的东西全部注释掉,留下start_phase3一项,即改成这样:
#--------------------------------------------------------------------------
# ● 刷新画面 (同伴命令回合)
#--------------------------------------------------------------------------
def update_phase2
# 按下 C 键的情况下
#if Input.trigger?(Input::C)
# 同伴指令窗口光标位置分支
#case @party_command_window.index
# when 0# 战斗
# 演奏确定 SE
#$game_system.se_play($data_system.decision_se)
# 开始角色的命令回合
start_phase3
#when 1# 逃跑
# 不能逃跑的情况下
#if $game_temp.battle_can_escape == false
# 演奏冻结 SE
#$game_system.se_play($data_system.buzzer_se)
#return
#end
# 演奏确定 SE
#$game_system.se_play($data_system.decision_se)
# 逃走处理
#update_phase2_escape
#end
#return
#end
end
留下带彩色的一项。
然后在Scene_battle 1 的第30行修改为……
@actor_command_window = Window_Command.new(160, "逃跑"])
@actor_command_window.y = 128
然后在Scene_battle 3里面修改这项
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 基本命令)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 转向前一个角色的指令输入
phase3_prior_actor
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 角色指令窗口光标位置分之
case @actor_command_window.index
when 0# 攻击
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# 开始选择敌人
start_enemy_select
when 1# 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 1
# 开始选择特技
start_skill_select
when 2# 防御
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# 转向下一位角色的指令输入
phase3_next_actor
when 3# 物品
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler.current_action.kind = 2
# 开始选择物品
start_item_select
###########################################################################
when 4# 逃跑
if $game_temp.battle_can_escape == false
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 逃走处理
update_phase2_escape
###########################################################################
end
return
end
end
到这里还不算完,真正的目的在后边。如果你选用了图标选项菜单的话,请用这个脚本替换main前面原来的脚本。#==============================================================================# 本脚本来自www.66RPG.com,使用和转载请保留此信息#============================================================================== module Momo_IconCommand# 图标名称设定ATTACK_ICON_NAME = "001-Weapon01" # 攻撃SKILL_ICON_NAME = "044-Skill01" # 特技GUARD_ICON_NAME = "009-Shield01" # 防御ITEM_ICON_NAME = "032-Item01" # 物品ESCAPE_ICON_NAME = "020-Accessory05"# 逃跑# X坐标修正X_PLUS = -50# Y坐标修正Y_PLUS = -180# 选择时图标的动作# 0:静止 1:放大SELECT_TYPE = 1# 闪烁时光芒的颜色FLASH_COLOR = Color.new(255, 255, 255, 128)# 闪烁时间FLASH_DURATION = 10# 闪烁间隔FLASH_INTERVAL = 20# 是否写出文字的名称COM_NAME_DROW = true# 文字名称是否移动COM_NAME_MOVE = true# 文字内容ATTACK_NAME = "攻击" # 攻击SKILL_NAME = "魔法" # 特技GUARD_NAME = "防御" # 防御ITEM_NAME = "物品" # 物品ESCAPE_NAME = "逃跑" # 逃跑# 文字颜色COM_NAME_COLOR = Color.new(255, 255, 255, 255)# 文字坐标修正COM_NAME_X_PLUS = 0COM_NAME_Y_PLUS = -15endclass Window_CommandIcon < Window_Selectableattr_accessor :last_index#--------------------------------------------------------------------------# ● オブジェクト初期化#--------------------------------------------------------------------------def initialize(x, y, commands) super(x, y, 32, 32) # ウィンドウスキンに空文字列を指定してウィンドウを描画しないようにする self.windowskin = RPG::Cache.windowskin("") @item_max = commands.size @commands = commands @column_max = commands.size @index = 0 @last_index = nil @name_sprite = nil @sprite = [] refreshenddef dispose super for sprite in @sprite sprite.dispose unless sprite.nil? end @name_sprite.dispose unless @name_sprite.nil?end#--------------------------------------------------------------------------# ● リフレッシュ#--------------------------------------------------------------------------def refresh @name_sprite.dispose unless @name_sprite.nil? for sprite in @sprite sprite.dispose unless sprite.nil? end @name_sprite = nil draw_com_name if Momo_IconCommand::COM_NAME_DROW @sprite = [] for i in 0...@item_max draw_item(i) endend#--------------------------------------------------------------------------# ● 項目の描画#--------------------------------------------------------------------------def draw_item(index) @sprite = Sprite_Icon.new(nil, @commands) @sprite.z = self.z + 1enddef draw_com_name @name_sprite = Sprite_Comm_Name.new(nil, get_com_name) end # 更新def update super icon_update com_name_update if Momo_IconCommand::COM_NAME_DROW if move_index? @last_index = self.index endend# アイコンの更新def icon_update for i in @sprite.active = (self.index == i) @sprite.x = self.x + i * 24 @sprite.y = self.y + 0 @sprite.z = (self.index == i) ? self.z + 2 : self.z + 1 @sprite.visible = self.visible @sprite.update endend# コマンドネームの更新def com_name_update if move_index? @name_sprite.name = get_com_name end @name_sprite.x = self.x - 12 + Momo_IconCommand::COM_NAME_X_PLUS @name_sprite.y = self.y - 40 + Momo_IconCommand::COM_NAME_Y_PLUS @name_sprite.z = self.z + 1 @name_sprite.active = self.active @name_sprite.visible = self.visible @name_sprite.updateenddef get_com_name make_name_set if @name_set.nil? name = @name_set name = "" if name.nil? return nameenddef make_name_set @name_set = [] @name_set = Momo_IconCommand::ATTACK_NAME @name_set = Momo_IconCommand::SKILL_NAME @name_set = Momo_IconCommand::GUARD_NAME @name_set = Momo_IconCommand::ITEM_NAME @name_set = Momo_IconCommand::ESCAPE_NAME enddef move_index? return self.index != @last_indexenddef need_reset @name_sprite.need_reset = true if Momo_IconCommand::COM_NAME_DROWendend# アイコン用スプライトclass Sprite_Icon < Spriteattr_accessor :activeattr_accessor :icon_name#--------------------------------------------------------------------------# ● オブジェクト初期化#--------------------------------------------------------------------------def initialize(viewport, icon_name) super(viewport) @icon_name = icon_name @last_icon = @icon_name @count = 0 self.bitmap = RPG::Cache.icon(@icon_name) self.ox = self.bitmap.width / 2 self.oy = self.bitmap.height / 2 @active = falseend#--------------------------------------------------------------------------# ● 解放#--------------------------------------------------------------------------def dispose if self.bitmap != nil self.bitmap.dispose end superend#--------------------------------------------------------------------------# ● フレーム更新#--------------------------------------------------------------------------def update super if @icon_name != @last_icon @last_icon = @icon_name self.bitmap = RPG::Cache.icon(@icon_name) end if @active @count += 1 case Momo_IconCommand::SELECT_TYPE when 0 icon_flash when 1 icon_zoom end @count = 0 if @count == 20 else icon_reset endenddef icon_flash if @count % Momo_IconCommand::FLASH_INTERVAL == 0 or @count == 1 self.flash(Momo_IconCommand::FLASH_COLOR, Momo_IconCommand::FLASH_DURATION) endenddef icon_zoom case @count when 1..10 zoom = 1.0 + @count / 10.0 when 11..20 zoom = 2.0 - (@count - 10) / 10.0 end self.zoom_x = zoom self.zoom_y = zoomenddef icon_reset @count = 0 self.zoom_x = 1.0 self.zoom_y = 1.0endend# コマンドネーム用スプライトclass Sprite_Comm_Name < Spriteattr_accessor :activeattr_accessor :nameattr_accessor :need_reset#--------------------------------------------------------------------------# ● オブジェクト初期化#--------------------------------------------------------------------------def initialize(viewport, name) super(viewport) @name = name @last_name = nil @count = 0 @x_plus = 0 @opa_plus = 0 @need_reset = false @active = false self.bitmap = Bitmap.new(160, 32)end#--------------------------------------------------------------------------# ● 解放#--------------------------------------------------------------------------def dispose if self.bitmap != nil self.bitmap.dispose end superend#--------------------------------------------------------------------------# ● フレーム更新#--------------------------------------------------------------------------def update super if @active if need_reset? @need_reset = false @last_name = @name text_reset end move_text if Momo_IconCommand::COM_NAME_MOVE endenddef move_text @count += 1 @x_plus = [@count * 8, 80].min self.x = self.x - 80 + @x_plus self.opacity = @count * 25enddef text_reset @count = 0 @x_plus = 0 self.bitmap.clear self.bitmap.font.color = Momo_IconCommand::COM_NAME_COLOR self.bitmap.draw_text(0, 0, 160, 32, @name)enddef need_reset? return (@name != @last_name or @need_reset)endendclass Scene_Battle#--------------------------------------------------------------------------# ● プレバトルフェーズ開始#--------------------------------------------------------------------------alias scene_battle_icon_command_start_phase1 start_phase1def start_phase1 com1 = Momo_IconCommand::ATTACK_ICON_NAME com2 = Momo_IconCommand::SKILL_ICON_NAME com3 = Momo_IconCommand::GUARD_ICON_NAME com4 = Momo_IconCommand::ITEM_ICON_NAME com5 = Momo_IconCommand::ESCAPE_ICON_NAME @actor_command_window = Window_CommandIcon.new(0, 0, ) @actor_command_window.y = 160 @actor_command_window.back_opacity = 160 @actor_command_window.active = false @actor_command_window.visible = false @actor_command_window.update scene_battle_icon_command_start_phase1end#--------------------------------------------------------------------------# ● アクターコマンドウィンドウのセットアップ#--------------------------------------------------------------------------alias scene_battle_icon_command_phase3_setup_command_window phase3_setup_command_windowdef phase3_setup_command_window scene_battle_icon_command_phase3_setup_command_window # アクターコマンドウィンドウの位置を設定 @actor_command_window.x = command_window_actor_x(@actor_index) @actor_command_window.y = command_window_actor_y(@actor_index) @actor_command_window.need_resetenddef command_window_actor_x(index) $game_party.actors.screen_x + Momo_IconCommand::X_PLUSenddef command_window_actor_y(index) $game_party.actors.screen_y + Momo_IconCommand::Y_PLUSendend#==============================================================================# 本脚本来自www.66RPG.com,使用和转载请保留此信息#============================================================================== 复制代码最终截图如下:
http://rpg.blue/upload_program/files/20070402-1.JPG
效果很不错吧~
大家不会的话可以下载工程观摩下。
http://rpg.blue/upload_program/files/动态+逃跑.rar
本帖来自P1论坛作者魔剑美神,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=49323若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]