#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Script_Helper by Nathmatt
# Version: 1.5
# Type: quick commands
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #----------------------------------------------------------------------------
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Do not make any script require this one if you are making a script just add
# what your using to ur script or add this to ur script.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Calls:
#
# $script_helper.wait(frames) waits set frames then returns true
# $script_helper.delay(frames) freezes set frames
# $script_helper.map_name returns the map name
# $script_helper.transfer_player(m,x,y,d=2) takes you to defined location
# $script_helper.save(name,i) saves in the configed folder
# with the definmed name and index
# $script_helper.load(name,i) loads in the configed folder
# with the definmed name and index
# $script_helper.get_facing_terrain_tag return the tag yor facing
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
module Script_Helper
module Config
Save_Path = 'Chapter_Saves'
end
class Processor
def initialize
@map_infos = load_data('Data/MapInfos.rxdata')
@map_infos.keys.each {|key| @map_infos[key] = @map_infos[key].name}
@common_events,@ov_maps,@title_screens = [],[],[]
end
def wait(frames)
sec = frames*40
return Graphics.frame_count % sec == sec - 1
end
def delay(frames)
while !wait(frames)
Graphics.update
Input.update
end
end
def map_name
return @map_infos[$game_map.map_id]
end
def transfer_player(m,x,y,d=2)
$game_temp.player_transferring = true
$game_temp.player_new_map_id = m
$game_temp.player_new_x = x
$game_temp.player_new_y = y
$game_temp.player_new_direction = d
$scene = Scene_map.new
end
def save(name,i)
filename = "#{Config::Save_Path}/#{name}#{i}.rxdata"
file = File.open(filename, "wb")
characters = []
(0...$game_party.actors.size).each{|i|actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])}
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
file.close
end
def load(name,i)
filename = "#{Config::Save_Path}/#{name}#{i}.rxdata"
file = File.open(filename, "rb")
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$Script_Helper = $game_system.script_helper
file.close
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
end
end
def get_facing_terrain_tag
g = $game_player
x,y,d = g.x,g.y,g.d
x += (d == 6 ? 1 : d == 4 ? -1 : 0)
y += (d == 2 ? 1 : d == 8 ? -1 : 0)
return terrain_tag(x,y)
end
end
$script_helper = Script_Helper::Processor.new