Увидел интересную систему CIGUI, опробовал и захотелось к ней добавить еще кое-что, а именно, информационные окошки на карте, которые не прерывают игру. Например, название карты или сообщение о ходе выполнения какого-либо квеста.
В итоге написал небольшой аддон для Scene_Map к CIGUI, может быть автор переработает и внесет его в основной скрипт. А пока этот скрипт следует поместить после всех файлов с CIGUI, но над Main.
Вызов команд практически тот же, что и в оригинальных скриптах, но вместо
$command надо писать $command_map.
Изменения в Game_Temp лишь для совместимости с окнами из основного CIGUI и вообще, другими сценками типа меню.
class Game_Temp
attr_accessor :old_commands
end
class Scene_Map
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Transition run
Graphics.transition
# Main loop
@windows=[]
@interpreter=Command_Interpreter.new(@windows)
#p $game_temp.old_commands
if $command_map == nil && $game_temp.old_commands != nil
$command_map = $game_temp.old_commands.clone
end
loop do
if $command_map!=nil
if $command_map.is_a?(String)
@interpreter.work($command)
$game_temp.old_commands = $command_map.clone
$command_map=nil
elsif $command_map.is_a?(Array)
for i in 0..$command_map.size-1
@interpreter.work($command_map[i])
end
$game_temp.old_commands = $command_map.clone
$command_map=nil
else
p "#ОШИБКА:НЕПРАВИЛЬНО ЗАДАНА КОМАНДА!#\nЧИТАЙ СПРАВКУ"
end
@windows=@windows|@interpreter.windows
$command_map=nil
end
for i in 0..@windows.size-1
if @windows[i].active
@windows[i].update
end
end
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of sprite set
@spriteset.dispose
# Dispose of message window
@message_window.dispose
# Dispose custom windows
for i in 0..@windows.size-1
@windows[i].dispose
end
@windows=[]
end
def update
# Loop
loop do
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return
end
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
# If B button was pressed
if Input.trigger?(Input::B)
#do nothing
$game_system.se_play($data_system.cancel_se)
end
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
# If player is not moving
unless $game_player.moving?
# Run calling of each screen
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end
В деме можно увидеть его действие, пособирав, к примеру, цветы или попросту обратив внимание на окошечко слева сверху.
yadi.sk/d/new4VXGl6c0U8