Quote from: game_guy on May 20, 2011, 08:39:44 pm
Its completely possible. It involves creating a new instance of RPG::Map. Adding the map to the MapInfos data. It would be a complicated process but it can be done. Thats if I'm understanding you right. You basically want to create a map once the game has started right?
I figured it might be something like that, since I had to do something similar for my Chant system (create external executable with new data file then import data file with modifications above my main). I was thinking of a map's features as a sort of array, and then by having stock features.
Maybe there's a kind of Vishnu Code that can be created?
1. you activate your 'create map' effect.
2. your sprite appears in a blank screen with a single tile.
3. wherever they step they expand the tile map (or the tile map boundary)
4. their steps can be set like a paint brush for a tile.
This system is crude and has pros and cons, but I think there's some useful aspects to it. The idea that when you create the new pocket dimension, you start off with 1 square, and then the map and its details are modified accordingly. I think the limits would really be things like buildings, household goods, and man made stuff, with naturally occurring things like trees, monoliths, and rivers would be more intuitive.
If maps were broken into Technology levels, you could set up what maps are available to your Uber being based on something like an intelligence stat. You could alternatively set up different map terrain based on domains or spheres of influence, like wind, earth, nature, and fire.
I think a system like this could be either very simple, or very complex, depending on what you wanted to achieve, but at the end of the day, it would have the following features:
1. you create a map with a single blank tile. Actor sprite optional.
2. you select how big the map is by some means. Either preset maps (24x24,64x64,128x128,etc.) or 'carving out' terrain.
3. you pull your terrain options from generic maps.
4. more maps means more work, but more options.
5. events would have to be pre-made and imported, possibly from a drop list or a 'dummy map', using something like Nightrunner's clone event script:
#==============================================================================
# ** Night_Runner's Transporting Events.
#------------------------------------------------------------------------------
# History:
# Date Created: 24/May/2010
# Created for: shintashi
# @> http://www.rpgrevolution.com/forums/index.php?showtopic=41999
#
# Description:
# This script is designed to allow a programmer to import an event from
# another map using the 'Script' command in the events command list.
#
# Installation:
# Copy this script, go to your game and go to Tools >> Script Editor.
# Scroll down the bottom and right click on main, select 'Insert', and
# paste this in the window on the right.
#
# How to Use:
# Have an event run the code:
# $game_map.import_event(
# original_map_id, desired_events_id, new_x, new_y
# )
# Where the original_map_id is substituded with the map that the event
# you want is originally on, desired_events_id is the ID for the event
# that you want (on it's original map), and the new_x and new_y is the
# x and y for the event on the new map respectively.
# For example, if you wanted to have event #6 from map #1 transferred to
# the current map's x = 2, y = 3, have an event run the code:
=begin
#
$game_map.import_event(
1, 6, 2, 3
)
#
=end
# I've included 1 extra function, to temporarily import an event, ater the
# 3 in the last example, include a ', false', so: 1, 6, 2, 3, false
# shin says in other words to make permanent, get rid of the ', false'
#==============================================================================
#==============================================================================
# ** Game_Temp
#------------------------------------------------------------------------------
# Edited to have a flag indicating if an event has been imported.
#==============================================================================
class Game_Temp
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :imported_event
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_importEvent_initialize initialize unless $@
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
@imported_event = false
# Run the original initialize
return nr_importEvent_initialize(*args)
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# Edited to keep track of imported events
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :transferred_events
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_importEvent_initialize initialize unless $@
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
# Keep track of the imported events
@transferred_events = {}
# Run the original initialize
return nr_importEvent_initialize(*args)
end
end
#==============================================================================
# ** Game_SelfSwitches
#------------------------------------------------------------------------------
# Edited to look the the original event (if the event is imported).
#==============================================================================
class Game_SelfSwitches
#--------------------------------------------------------------------------
# * Get Self Switch
# key : key
#--------------------------------------------------------------------------
def [](key)
# If the self-switch is for an imported event
if $game_map.events[key[1]] != nil
if $game_map.events[key[1]].original_map_id != nil
# Change the key to look at the orginal event
key[0] = $game_map.events[key[1]].original_map_id
key[1] = $game_map.events[key[1]].original_id
end
end
# Run the original []
return @data[key] == true ? true : false
end
#--------------------------------------------------------------------------
# * Set Self Switch
# key : key
# value : ON (true) / OFF (false)
#--------------------------------------------------------------------------
def []=(key, value)
# If the self-switch is for an imported events
if $game_map.events[key[1]] != nil
if $game_map.events[key[1]].original_map_id != nil
# Change the key to look at the orginal event
key[0] = $game_map.events[key[1]].original_map_id
key[1] = $game_map.events[key[1]].original_id
end
end
# Run the original []=
return @data[key] = value
end
end
#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# Edited to include the import_event method.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
alias nr_importEvent_setup setup unless $@
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :events # Needed to read the existing events
#--------------------------------------------------------------------------
# * setup
#--------------------------------------------------------------------------
def setup(map_id)
# Run original setup
nr_importEvent_setup(map_id)
$game_system.transferred_events ||= {}
$game_system.transferred_events[map_id] ||= []
for event in $game_system.transferred_events[map_id]
import_event(event[0], event[1], event[2], event[3])
end
end
#--------------------------------------------------------------------------
# * Import Event
# orig_map_id : The ID of the Map to look in for the event
# event_id : The ID of the event to import
# new_x : The new x coordinate for the event
# new_y : The new y coordinate for the event
#--------------------------------------------------------------------------
def import_event(orig_map_id, event_id, new_x, new_y, permanent_trans = true)
# Load the map
map = load_data(sprintf("Data/Map%03d.rxdata", orig_map_id))
# Get the event
id = @events.size + 1
@events[id] = Game_Event.new(orig_map_id, map.events[event_id])
@events[id].original_map_id = orig_map_id
@events[id].original_id = event_id
@events[id].moveto(new_x, new_y)
@events[id].id = id
# Set the spriteset_map to update
$game_temp.imported_event = true
# Refresh the Game_Map
refresh
# Backup the event (if desired)
return if not permanent_trans
# Save the imported event to Game_System
$game_system.transferred_events ||= {}
$game_system.transferred_events[@map_id] ||= []
new_event_data = [orig_map_id, event_id, new_x, new_y]
unless $game_system.transferred_events[@map_id].include?(new_event_data)
$game_system.transferred_events[@map_id].push(new_event_data)
end
end
end
#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# Edited to access the ID, and make a variable that references the
# events original map.
#==============================================================================
class Game_Event
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :original_map_id # The map the event is originally on
attr_accessor :original_id # The original ID of the event
attr_accessor :id # The ID of this event
end
#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# Edited to update for imported events.
#==============================================================================
class Spriteset_Map
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias nr_importEvent_update update unless $@
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update(*args)
# If an event has been imported from another page
if $game_temp.imported_event
# Go through every event
for i in $game_map.events.keys.sort
# If the event is already loaded, do nothing
index = index.nil? ? 0 : index + 1
next if @character_sprites[index + 1] != nil
# Otherwise, create a sprite for the event
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
end
# Run the original update
return nr_importEvent_update(*args)
end
end
#==============================================================================
# End of Script.
#==============================================================================