구이벤트 커멘드 (VX 전용)
구트크르(주로200x)의 이벤트 커멘드풍의 기능을 재현합니다.
현재, 다음의 기능을 사용할 수 있습니다.
- 재생중의 BGM 의 기억/복귀
- 지정 위치의 이벤트ID의 취득
- 임의의 타이밍에 트란지션을 실행
- 전투 개시 트란지션, 윈도우 스킨등의 고정 그래픽의 변경
자세한 것은 「사용법」을 참조해 주세요.
↓스크립트#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ 구이벤트 커멘드 - KGC_OldEventCommands ◆ VX ◆
#_/ ◇ Last update : 2008/01/26 ◇
#_/----------------------------------------------------------------------------
#_/ 구트크르의 이벤트 커멘드풍의 기능을 재현합니다.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
$imported = {} if $imported == nil
$imported["OldEventCommands"] = true
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ KGC::Commands
#==============================================================================
module KGC::Commands
module_function
#--------------------------------------------------------------------------
# ○ 현재의 BGM (을)를 기억
#--------------------------------------------------------------------------
def remember_bgm
$game_system.remembered_bgm = RPG::BGM.last
end
#--------------------------------------------------------------------------
# ○ 기억했다 BGM (을)를 연주
#--------------------------------------------------------------------------
def play_remembered_bgm
if $game_system.remembered_bgm != nil
$game_system.remembered_bgm.play
end
end
#--------------------------------------------------------------------------
# ○ 지정 위치의 이벤트 ID 취득
# x : 맵의 X 좌표
# y : 맵의 Y 좌표
# variable_id : 취득한 이벤트 ID (을)를 대입하는 변수의 ID
#-------------------------------------------------------------------------
def get_event_id(x, y, variable_id = 0)
event_id = 0
# 해당하는 이벤트를 검색
$game_map.events.values.each { |e|
if e.x == x && e.y == y
event_id = e.id
break
end
}
# 변수에 대입
if variable_id > 0
$game_variables[variable_id] = event_id
end
return event_id
end
#--------------------------------------------------------------------------
# ○ 트란지션 준비
#--------------------------------------------------------------------------
def prepare_transition
$game_temp.transition_preparing = true
end
#--------------------------------------------------------------------------
# ○ 트란지션 설정
# duration : 트란지션에 걸치는 프레임수
# filename : 트란지션 화상의 파일명
# vague : 경계의 애매함
#--------------------------------------------------------------------------
def set_transition(duration = 30, filename = "", vague = 40)
return if $game_temp.transition_processing # 트란지션 처리중
$game_temp.transition_set = true
$game_temp.transition_name = filename
$game_temp.transition_duration = duration
$game_temp.transition_vague = vague
end
#--------------------------------------------------------------------------
# ○ 트란지션 설정 해제
#-------------------------------------------------------------------------
def unset_transition
$game_temp.transition_preparing = false
$game_temp.transition_set = false
$game_temp.transition_processing = false
$game_temp.transition_name = ""
$game_temp.transition_duration = 0
$game_temp.transition_vague = 0
end
#--------------------------------------------------------------------------
# ○ 머위 국물 아이콘의 변경
# filename : 트란지션 화상의 파일명
#--------------------------------------------------------------------------
def change_balloon_icon(filename = nil)
$game_system.balloon_icon = filename
end
#--------------------------------------------------------------------------
# ○ メッセージ背景の変更
# filename : トランジション画像のファイル名
#--------------------------------------------------------------------------
def change_message_back(filename = nil)
$game_system.message_back = filename
end
#--------------------------------------------------------------------------
# ○ 戦闘時トランジションの変更
# filename : トランジション画像のファイル名
#--------------------------------------------------------------------------
def change_battle_transition(filename = nil)
$game_system.battle_transition = filename
end
#--------------------------------------------------------------------------
# ○ 戦闘画面床の変更
# filename : トランジション画像のファイル名
#--------------------------------------------------------------------------
def change_battlefloor(filename = nil)
$game_system.battlefloor = filename
end
#--------------------------------------------------------------------------
# ○ 飛行船の影の変更
# filename : トランジション画像のファイル名
#--------------------------------------------------------------------------
def change_vehicle_shadow(filename = nil)
$game_system.vehicle_shadow = filename
end
#--------------------------------------------------------------------------
# ○ ウィンドウスキンの変更
# filename : トランジション画像のファイル名
#--------------------------------------------------------------------------
def change_windowskin(filename = nil)
$game_system.windowskin = filename
end
#--------------------------------------------------------------------------
# ○ ゲームオーバー画面の変更
# filename : トランジション画像のファイル名
#--------------------------------------------------------------------------
def change_gameover_graphic(filename = nil)
$game_system.gameover_graphic = filename
end
end
class Game_Interpreter
include KGC::Commands
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :transition_preparing # トランジション準備中フラグ
attr_accessor :transition_set # トランジション設定済みフラグ
attr_accessor :transition_processing # トランジション処理中フラグ
attr_accessor :transition_name # トランジションファイル名
attr_accessor :transition_duration # トランジションのフレーム数
attr_accessor :transition_vague # トランジションのあいまいさ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_OldEventCommands initialize
def initialize
initialize_KGC_OldEventCommands
@transition_preparing = false
@transition_set = false
@transition_processing = false
@transition_name = ""
@transition_duration = 0
@transition_vague = 0
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :remembered_bgm # 記憶した BGM
attr_accessor :balloon_icon # フキダシアイコン
attr_accessor :message_back # メッセージ背景
attr_accessor :battle_transition # 戦闘用トランジション
attr_accessor :battlefloor # 戦闘画面床
attr_accessor :vehicle_shadow # 飛行船の影
attr_accessor :windowskin # ウィンドウスキン
attr_accessor :gameover_graphic # ゲームオーバー画面
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_OldEventCommands initialize
def initialize
initialize_KGC_OldEventCommands
@remembered_bgm = nil
@balloon_icon = nil
@message_back = nil
@battle_transition = nil
@battlefloor = nil
@vehicle_shadow = nil
@windowskin = nil
@gameover_graphic = nil
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 画面のフェードアウト
#--------------------------------------------------------------------------
alias command_221_KGC_OldEventCommands command_221
def command_221
if $game_temp.transition_preparing # トランジション準備中の場合
return false if $game_message.visible # メッセージ表示中
$game_temp.transition_preparing = false # 準備中フラグをクリア
Graphics.freeze # 画面停止
return true
else
return command_221_KGC_OldEventCommands
end
end
#--------------------------------------------------------------------------
# ● 画面のフェードイン
#--------------------------------------------------------------------------
alias command_222_KGC_OldEventCommands command_222
def command_222
if $game_temp.transition_set # トランジション設定済みの場合
return false if $game_message.visible # メッセージ表示中
$game_temp.transition_set = false # 設定済みフラグをクリア
$game_temp.transition_processing = true # 実行中フラグをセット
@wait_count = $game_temp.transition_duration
return true
else
return command_222_KGC_OldEventCommands
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
#--------------------------------------------------------------------------
# ● フキダシアイコン表示の開始
#--------------------------------------------------------------------------
alias start_balloon_KGC_OldEventCommands start_balloon
def start_balloon
start_balloon_KGC_OldEventCommands
if $game_system.balloon_icon != nil
@balloon_sprite.bitmap = Cache.system($game_system.balloon_icon)
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# ● 飛行船の影スプライトの作成
#--------------------------------------------------------------------------
alias create_shadow_KGC_OldEventCommands create_shadow
def create_shadow
create_shadow_KGC_OldEventCommands
@vehicle_shadow_name = nil
apply_vehicle_shadow
end
#--------------------------------------------------------------------------
# ○ 飛行船の影の変更を適用
#--------------------------------------------------------------------------
def apply_vehicle_shadow
if @vehicle_shadow_name != $game_system.vehicle_shadow
@vehicle_shadow_name = $game_system.vehicle_shadow
filename = (@vehicle_shadow_name != nil ?
@vehicle_shadow_name : "Shadow")
@shadow_sprite.bitmap = Cache.system(file)
end
end
#--------------------------------------------------------------------------
# ● 飛行船の影スプライトの更新
#--------------------------------------------------------------------------
alias update_shadow_KGC_OldEventCommands update_shadow
def update_shadow
apply_vehicle_shadow
update_shadow_KGC_OldEventCommands
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Spriteset_Battle
#==============================================================================
class Spriteset_Battle
#--------------------------------------------------------------------------
# ● バトルフロアスプライトの作成
#--------------------------------------------------------------------------
alias create_battlefloor_KGC_OldEventCommands create_battlefloor
def create_battlefloor
create_battlefloor_KGC_OldEventCommands
@battlefloor_name = nil
apply_battlefloor
end
#--------------------------------------------------------------------------
# ○ バトルフロアの変更を適用
#--------------------------------------------------------------------------
def apply_battlefloor
if @battlefloor_name != $game_system.battlefloor
@battlefloor_name = $game_system.battlefloor
filename = (@battlefloor_name != nil ?
@battlefloor_name : "BattleFloor")
@battlefloor_sprite.bitmap = Cache.system(filename)
end
end
#--------------------------------------------------------------------------
# ● バトルフロアの更新
#--------------------------------------------------------------------------
alias update_battlefloor_KGC_OldEventCommands update_battlefloor
def update_battlefloor
apply_battlefloor
update_battlefloor_KGC_OldEventCommands
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_Base
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_OldEventCommands initialize
def initialize(x, y, width, height)
initialize_KGC_OldEventCommands(x, y, width, height)
@windowskin_name = nil
apply_windowskin
end
#--------------------------------------------------------------------------
# ○ ウィンドウスキンの変更を適用
#--------------------------------------------------------------------------
def apply_windowskin
if $game_system != nil && @windowskin_name != $game_system.windowskin
@windowskin_name = $game_system.windowskin
filename = (@windowskin_name != nil ?
@windowskin_name : "Window")
self.windowskin = Cache.system(filename)
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_KGC_OldEventCommands update
def update
apply_windowskin
update_KGC_OldEventCommands
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_Message
#==============================================================================
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# ● 背景スプライトの更新
#--------------------------------------------------------------------------
alias update_back_sprite_KGC_OldEventCommands update_back_sprite
def update_back_sprite
apply_message_back
update_back_sprite_KGC_OldEventCommands
end
#--------------------------------------------------------------------------
# ● 背景スプライトの作成
#--------------------------------------------------------------------------
alias create_back_sprite_KGC_OldEventCommands create_back_sprite
def create_back_sprite
create_back_sprite_KGC_OldEventCommands
@message_back_name = nil
apply_message_back
end
#--------------------------------------------------------------------------
# ○ 背景の変更を適用
#--------------------------------------------------------------------------
def apply_message_back
if @message_back_name != $game_system.message_back
@message_back_name = $game_system.message_back
filename = (@message_back_name != nil ?
@message_back_name : "MessageBack")
@back_sprite.bitmap = Cache.system(filename)
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_KGC_OldEventCommands update
def update
update_KGC_OldEventCommands
# トランジション処理中の場合
if $game_temp.transition_processing
process_transition
end
end
#--------------------------------------------------------------------------
# ○ トランジション処理
#--------------------------------------------------------------------------
def process_transition
$game_temp.transition_processing = false
# トランジション実行
if $game_temp.transition_name == "" || $game_temp.transition_name == nil
Graphics.transition(15)
else
Graphics.transition(
$game_temp.transition_duration,
"Graphics/System/#{$game_temp.transition_name}",
$game_temp.transition_vague)
end
end
#--------------------------------------------------------------------------
# ● 戦闘前トランジション実行
#--------------------------------------------------------------------------
def perform_battle_transition
if $game_system.battle_transition != nil
filename = $game_system.battle_transition
else
filename = "BattleStart"
end
Graphics.transition(80, "Graphics/System/#{filename}", 80)
Graphics.freeze
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Gameover
#==============================================================================
class Scene_Gameover < Scene_Base
#--------------------------------------------------------------------------
# ● ゲームオーバーグラフィックの作成
#--------------------------------------------------------------------------
alias create_gameover_graphic_KGC_OldEventCommands create_gameover_graphic
def create_gameover_graphic
create_gameover_graphic_KGC_OldEventCommands
if $game_system.gameover_graphic != nil
@sprite.bitmap = Cache.system($game_system.gameover_graphic)
end
end
end
사용법
- 각 커멘드는 이벤트 커멘드 「스크립트」에 기술해 사용합니다.
remember_bgm
- 현재 재생중의 BGM (을)를 기억합니다.
get_event_id(x, y[, variable_id])
현재의 맵의 지정 좌표(x, y)에 있는 이벤트의 ID (을)를 variable_id그리고 지정한 변수에 저장.
지정 좌표에 이벤트가 없는 경우는, 변수에는0이 들어갑니다.
실행 후, 지정 변수에 대입한 값을 반환값으로서 돌려줍니다.
variable_id(을)를 생략 했을 경우, 변수에의 대입은 실시하지 않습니다.
예)ㅁㄴㅇ
# 좌표 10,20 에 있는 이벤트ID(을)를 7번 편수에 저장.
n = get_event_id(10, 20, 7)
# 실행 후,n (와)과 $game_variables[7] (은)는 같은 값이 된다.
# 반환값이 필요 없을 때
get_event_id(10, 20, 7)
# $game_variables (을)를 사용하지 않을 때
n = get_event_id(10, 20)
- prepare_transition
- 트란지션 실행을 위한 준비(화면의 묘화 정지)를 실시합니다.
이 커멘드를 「스크립트」로 실행한 후, 「화면의 페이드아웃」을 실행해 주세요. - set_transition([duration[, filename[, vague]]])
-
다음에 실행하는 트란지션을 설정합니다.
이 커멘드를 「스크립트」로 실행한 후, 「화면의 용명」을 실행해 주세요.
한 번 「화면의 용명」을 실행하면, 설정은 해제됩니다.
duration에는, 트란지션에 걸치는 프레임수를 지정합니다.
생략시는30입니다.filename에는, 트란지션 화상의 파일명을 지정합니다.
트란지션 화상에는,"Graphics/System" 폴더내의 파일을 지정합니다.
생략시는, 트란지션 화상을 사용하지 않습니다(크로스페이드가 됩니다).vague에는, 트란지션의 경계의 애매함을 지정합니다.
생략시는40입니다. - unset_transition
- set_transition그리고 설정한, 실행 대기중의 트란지션을 해제합니다.
「화면의 용명」을 실행한 다음(트란지션 실행중)은, 해제할 수 없습니다. - change_balloon_icon(filename)
- 머위 국물 아이콘으로서 사용하는 화상을filename(으)로 변경합니다.
filename에는,"Graphics/System" 폴더내의 파일을 지정합니다.
filename에nil(을)를 지정하는지, 인수를 생략 하면, 디폴트의 화상을 사용합니다.# "Graphics/System/NazoBalloon.png" (을)를 송풍으로서 사용
이 지정 방법은, 이하의 커멘드에서도 같습니다.
change_balloon_icon("NazoBalloon")
# 디폴트에 되돌린다 (어디라도 같다)
change_balloon_icon(nil)
change_balloon_icon - change_message_back(filename)
- 이벤트 커멘드 「문장의 표시」로 「배경을 어둡게 한다」를 선택했을 경우의 메세지 배경을filename(으)로 변경합니다.
- change_battle_transition(filename)
- 전투 개시시의 트란지션(전투 개시시 효과)을filename(으)로 변경합니다.
- change_battlefloor(filename)
- 전투 화면의 마루를filename(으)로 변경합니다.
- change_vehicle_shadow(filename)
- 비행선의 그림자를filename(으)로 변경합니다.
- change_windowskin(filename)
- 윈도우 스킨을filename(으)로 변경합니다.
- change_gameover_graphic(filename)
- 게임 오버 화면의 화상을filename(으)로 변경합니다.
원본 주소 : http://f44.aaa.livedoor.jp/~ytomy/tkool/rpgtech/php/tech.php?tool=VX&cat=tech_vx/base_function&tech=old_event_commands
'게임이야기. > RPG 만들기 VX' 카테고리의 다른 글
vx 맵 배치 강좌 [외국 사이트에서 퍼온 ㅎㅎ] (0) | 2008.02.01 |
---|---|
vx 배경매뉴에 효과 주기 ^^ (0) | 2008.02.01 |
vx 글자 한자한자 뜰때 소리 나도록 하는 스크립트 (1) | 2008.02.01 |
rpg 만들기 vx 전투 승리시 ME의 재생 시간조절 (0) | 2008.02.01 |
RPG 만들기 VX 전투중 메시지 속도 조절 (0) | 2008.02.01 |
RPG 만들기 VX (설치버전 10) (2) | 2008.01.31 |
점프를 제한 하는 스크립트 (0) | 2008.01.31 |