08-16-2011, 03:49 AM (This post was last modified: 09-03-2024, 01:38 AM by DerVVulfman.)
Edit & Play 2.1 by .:Fênix:.
Description
Let you edit and play your game at the same time
Compability
RPG Maker XP and RPG Maker VX
Script
Edit and Play
Code:
#===============================================================================
# * Edit & Play
#-------------------------------------------------------------------------------
# - Version: 2.1
# - Date : 14 / 08 / 2011
# - Author : .:Fênix:.
# - MSN : bmotamer@hotmail.com
#-------------------------------------------------------------------------------
# - Description:
# Let you edit and play your game at the same time
#-------------------------------------------------------------------------------
# - Compability:
# RPG Maker XP and RPG Maker VX
#===============================================================================
module Edit_and_Play
# Activate the script? (true / false)
Activate = true
# Key which updates the game
Update_Key = Input::ALT
# Data files that won't be reloaded
File_Exclude = []
# Scripts that won't be reloaded
Scripts_Exclude = ["Edit & Play", "Main"]
end
$VX ||= defined?(Graphics.wait)
if ((Edit_and_Play::Activate) && !(File.file?("Game.rgss#{$VX ? '2a' : 'ad'}")))
if ($TEST || $DEBUG)
File.rename(old_file, new_file) if ($BTEST)
Thread.new {system("Game.exe")}
exit
else
$TEST = $DEBUG = true
if (File.file?(new_file))
File.rename(new_file, old_file)
$BTEST = true
end
end
unless ($VX)
class Scene_Battle
alias :edit_and_play_1 :main unless ($@)
def main
edit_and_play_1
$scene = Scene_Battle.new if ($BTEST)
end
end
end
class << Input
alias :edit_and_play_2 :update unless ($@)
def update
if (trigger?(Edit_and_Play::Update_Key))
for file in (Dir.entries("Data") - [".", "..", *Edit_and_Play::File_Exclude])
next if (file.include?("Map"))
basename = File.basename(file, ".*").downcase!
if (basename == "scripts")
($VX ? Cache : RPG::Cache).clear
for data in load_data("Data/#{file}")
next if (Edit_and_Play::Scripts_Exclude.include?(data[1]))
eval(Zlib::Inflate.inflate(data[2]))
end
$game_map.setup($game_map.map_id) if ($game_map != nil && $game_map.map_id != 0)
$scene = $scene.class.new
else
eval("$data_#{basename} = load_data('Data/#{file}')")
end
end
end
edit_and_play_2
end
end
end
Instructions
Put the script above Main, with the title: Edit & Play
The rest of the instructions are inside of the code.
Note from poster
Posting permission was granted by Fênix of HBGames.