08-23-2017, 03:32 AM
(This post was last modified: 09-02-2024, 10:21 PM by DerVVulfman.)
LILY'S MEGA DATA!
Version: 1.0
Version: 1.0
Introduction
Are you bummed by the 999 database limit for skills, items, actors and the like? If so, then you may want to make a mega-data database.
This script alters the load_data kernel to recognize key databases used by the RPGMaker engines which use Ruby Scripting, and allows additional database records to be added upon game load.
This script may also generate a txt file (or set of text files) which will list all the items within your mega databases.
Demo
Nope.
Script
MegaData
Code:
#==============================================================================
# ** LILY'S MEGA DATA!
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 08-22-2017 (mm/dd/yyyy)
# RUBY - RGSS / RGSS2 / RGSS3 (RMXP, RMVX & RMVXAce)
#==============================================================================
#
# Introduction:
# =============
#
# Are you bummed by the 999 database limit for skills, items, actors and the
# like? If so, then you may want to make a mega-data database.
#
# This script alters the load_data kernel to recognize key databases used by
# the RPGMaker engines which use Ruby Scripting, and allows additional data-
# base records to be added upon game load.
#
# This script may also generate a txt file (or set of text files) which will
# list all the items within your mega databases.
#
# == * == * ==
#
# The MegaData Module:
# ====================
#
# This module is your configuration section, controlling how the script runs
# and holds the lists of any additional RPGMaker databases which are being
# imported into the project.
#
# The first set of values are the two within the BASIC SETTINGS category and
# are as follows:
#
# * RGSS_SYSTEM: This setting lets you use this system for whichever version
# of RPGMaker you choose, as long as it uses Ruby Scripting.
#
# A value of 0 (by default) informs the script that it is in
# an RPGMaker XP project. Meanwhile, a value of 1 will set
# the system to read and recognize RPGMaker VX data files,and
# a value of 2 informs the script that it is being used in an
# RPGMaker VXAce project.
#
# * LIST_SYSTEM: This is a simple true/false setting that determines if the
# project will generate any database output text files.
#
# Generated output files will be created in your project's
# root folder, and always begin with "MEGA" in its name. The
# file(s) are only generated for those databases that are
# being appended by outside database files.
#
# Remember to turn the feature off for your completed games.
#
# The second set of values are arrays, each meant to hold the filenames of
# additional database being loaded. These extra databases attach themselves
# to your existing ones, never overwriting them.
#
# The List of arrays are as follows:
#
# * ACTOR_LIST - To let you go beyond 999 actors.
# * SKILL_LIST - To let you learn more than 999 skills.
# * ITEM_LIST - To let you have more than 999 items.
# * WEAP_LIST - To let you have more than 999 weapons in your armory.
# * ARMOR_LIST - To let you go beyond 999 pieces of armor.
# * ENEMY_LIST - To let you increase your bestiary beyond 999 foes.
# * ANIM_LIST - To let you go beyond 999 battle animations.
# * TILES_LIST - To let you have more than 999 tilesets (RMXP Only).
#
# When adding a database filename to the list, you only enter the filename
# itself without either the Data pathway or the file's extension. It is made
# this way to let the system work more easily with the multiple RUBY script
# platforms. An example appears in the script by default.
#
# EX: SKILL_LIST = ["Skills2"]
#
# So not only will the project load the default 'Data\Skills.rxdata' file, but
# also an accompanying Skills2.rxdata file within the Data folder. This, assu-
# ming that a Skills2.rxdata file exists, otherwise an error will occur.
#
#
# == * == * ==
#
# USAGE:
# ======
#
# This master script is designed to allow you to increase the size of your
# available data. However, the default RPGMaker editors only work with data
# up to record 999. Ergo, you will need to use script commands and/or addi-
# tional code to mimic typical map event commands like 'Change Actor' or the
# like.
#
# == * == * ==
#
# COMPATIBILITY:
# ==============
#
# This script should be usable for all Ruby-Scripting versions of RPGMaker,
# and it merely attaches code to the 'load_data' method within the Kernel
# module itself.
#
# == * == * ==
#
# CREDITS AND THANKS:
# ===================
#
# Thanks goes to a dear friend who inquired just this past week if one could
# get past the 999 item or skill limit.
#
#==============================================================================
#
# TERMS AND CONDITIONS:
# =====================
#
# Free for use, even in commercial games. Due credit is all that's required.
#
#==============================================================================
module MegaData
# BASIC SETTINGS
# ==============
# Basic control switches determining the Ruby based engine in use, or if the
# system outputs a file containing the whole list of 'records' of a combined
# mega database.
#
RGSS_SYSTEM = 0 # 0 = RGSS/RMXP, 1 = RGSS2/RMVX, 2 = RGSS3/RMVXAce
LIST_SYSTEM = true # If true, outputs a txt file for the combined data
# ADDITIONAL FILES
# ================
# Each is an array containing the filenames of additional database files with
# its records being added into the database for the current project. Only the
# name of the extra file is needed as the script recognizes that each file is
# within the Data folder, and attaches the suitable file extension ( .rxdata,
# .rvdata, rvdata2). The arrays may be set to nil or [] (empty).
#
ACTOR_LIST = nil
SKILL_LIST = ["Skills2"] # <--- example for having 'Data\Skills2.rxdata'
ITEM_LIST = nil
WEAP_LIST = nil
ARMOR_LIST = nil
ENEMY_LIST = nil
ANIM_LIST = nil
TILES_LIST = nil
end
#==============================================================================
# ** Kernel
#------------------------------------------------------------------------------
# The Kernel module is a child of the Object class, allowing all methods and
# values within to be globally accessible unless overridden.
#==============================================================================
module Kernel
#--------------------------------------------------------------------------
# * Alias / Renamed Method Listings with F12 anti-stack support
#--------------------------------------------------------------------------
if @kernel_mega_load_data_stack.nil?
@kernel_mega_load_data_stack = true
alias kernel_mega_load_data load_data
end
#--------------------------------------------------------------------------
# * load data
# filename : name of data file - able to read encrypted game data.
#--------------------------------------------------------------------------
def load_data(filename)
# Acquire position of filename's period
parse_cnt = filename.index(".")
# Crop away file extension for non-biased system test
testname = filename[0,parse_cnt]
# Branch on filename, retrieving data (expanded or otherwise)
case testname
when "Data/Actors"
effective = load_mega("Data/Actors", MegaData::ACTOR_LIST)
when "Data/Skills"
effective = load_mega("Data/Skills", MegaData::SKILL_LIST)
when "Data/Items"
effective = load_mega("Data/Items", MegaData::ITEM_LIST)
when "Data/Weapons"
effective = load_mega("Data/Weapons", MegaData::WEAP_LIST)
when "Data/Armors"
effective = load_mega("Data/Armors", MegaData::ARMOR_LIST)
when "Data/Enemies"
effective = load_mega("Data/Enemies", MegaData::ENEMY_LIST)
when "Data/Animations"
effective = load_mega("Data/Animations", MegaData::ANIM_LIST)
when "Data/Tilesets"
effective = load_mega("Data/Tilesets", MegaData::TILES_LIST)
else
effective = kernel_mega_load_data(filename)
end
# Return database data
return effective
end
#--------------------------------------------------------------------------
# * load mega data
# filename : name of data file - able to read encrypted game data.
# arraylist : list of additional data files added
#--------------------------------------------------------------------------
def load_mega(filename, arraylist)
# Keep old filename for output (minus data folder)
oldfilename = filename[5,filename.length]
# Attach filename extension based on RGSS used
filename = load_mega_extension(filename)
# Acquire records from default datafile
effective = kernel_mega_load_data(filename)
# Set our counter
counter = 0
# Sort through datafile records
for record in effective
# Skip null record
next if record.nil?
# Increase counter for each viable record
counter += 1
end
# Exit with normal data if array list is nil
return effective if arraylist.nil? or arraylist == []
# Generate a list, if enabled
if MegaData::LIST_SYSTEM == true
# Create the new text file for the given data
f = File.new("MEGA " + oldfilename+".txt", "w+")
f.puts "Initial Project Data:"
# Sort through the new data records
for record in effective
# Skip null record
next if record.nil?
# Create a formatted string of the ID and record data name
formatted = "ID: " + (record.id).to_s + " - " + record.name
# Output to the file
f.puts formatted
end
# Add 1 line spacing
f.puts " "
end
# Sort through each filename
for datafile in arraylist
# Apply Data folder prefix to datafile name
renamed_datafile = "Data/" + datafile
# Attach filename extension based on RGSS used
renamed_datafile = load_mega_extension(renamed_datafile)
# Acquire records from acquired filename
tempeffective = kernel_mega_load_data(renamed_datafile)
# Generate file heading for report if enabled
if MegaData::LIST_SYSTEM == true
f.puts "Data from: " + datafile
end
# Sort through datafile records
for record in tempeffective
# Skip null record
next if record.nil?
# Increase counter for viable record
counter += 1
# Redefine current record's ID by counter
record.id = counter
# Add record data to default datafile
effective.push record
# Output record for report if enabled
if MegaData::LIST_SYSTEM == true
# Create a formatted string of the ID and record data name
formatted = "ID: " + (record.id).to_s + " - " + record.name
# Output to the file
f.puts formatted
end
end
# Add 1 line spacing
if MegaData::LIST_SYSTEM == true
f.puts " "
end
end
# Close Report generator if enabled
if MegaData::LIST_SYSTEM == true
f.close
end
# Exit with expanded datafile
return effective
end
#--------------------------------------------------------------------------
# * load mega datafile extension
# filename : name of data file to have the extension attached
#--------------------------------------------------------------------------
def load_mega_extension(filename)
# Attach filename extension based on RGSS used
case MegaData::RGSS_SYSTEM
when 1
effective = filename + ".rvdata"
when 2
effective = filename + ".rxdata2"
else
effective = filename + ".rxdata"
end
return effective
end
end
Instructions
The script itself is only the basis. You need to create extra database files using your RPGMaker and copy the extra database files (be it rxdata, rvdata2...) into your real project's data folder and then add them to the list of arrays in the script.
It does not adapt the 'event commands' in the editor to go beyond the 999 limit. So one needs to have a matching set of script calls to go beyond that limit.
Example Utility Code
The below code is meant for RPGMaker XP users, but shows how one can make routines within the Interpreter class (or Game_Interpreter) so one can use script calls that may go beyond the 999 editor cap.
Example RMXP addon
Code:
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Test Party for an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def mega_actor_test(actor_id)
return true if $game_party.actors.include?(actor)
return false
end
#--------------------------------------------------------------------------
# * Change Actor
# actor_id : actor ID
# remove : (optional: If true, removes actor from party)
#--------------------------------------------------------------------------
def mega_actor_change(actor_id=1, remove=false)
unless remove
$game_party.add_actor(actor_id)
else
$game_party.remove_actor(actor_id)
end
end
#--------------------------------------------------------------------------
# * Change Actor HP Increase
# actor_id : actor ID
# value : Value of HP gain (or loss if negative)
# allow_death : if knockout allows death
#--------------------------------------------------------------------------
def mega_actor_HP(actor_id=1, value=0, allow_death=false)
actor = $game_actors[actor_id]
return if actor.nil?
$game_actors[actor_id].hp += value
if allow_death == false and $game_actors[actor_id].hp == 0
$game_actors[actor_id].hp = 1
end
# Determine game over
$game_temp.gameover = $game_party.all_dead?
end
#--------------------------------------------------------------------------
# * Change Actor SP Increase
# actor_id : actor ID
# value : Value of SP gain (or loss if negative)
#--------------------------------------------------------------------------
def mega_actor_HP(actor_id=1, value=0)
actor = $game_actors[actor_id]
return if actor.nil?
$game_actors[actor_id].sp += value
end
#--------------------------------------------------------------------------
# * Change Enemy HP Increase
# enemy_id : enemy ID
# value : Value of HP gain (or loss if negative)
#--------------------------------------------------------------------------
def mega_actor_HP(enemy_id=1, value=0)
enemy = $game_troop.enemies[enemy_id]
return if enemy.nil?
$game_troop.enemies[enemy_id].hp += value
end
#--------------------------------------------------------------------------
# * ChangeEnemy SP Increase
# enemy_id : enemy ID
# value : Value of SP gain (or loss if negative)
#--------------------------------------------------------------------------
def mega_actor_HP(enemy_id=1, value=0)
enemy = $game_troop.enemies[enemy_id]
return if enemy.nil?
$game_troop.enemies[enemy_id].sp += value
end
#--------------------------------------------------------------------------
# * Test Actor for a Skill
# actor_id : actor ID
# skill_id : skill ID
#--------------------------------------------------------------------------
def mega_skill_test(actor_id=1, skill_id=1)
actor = $game_actors[actor_id]
return false if actor.nil?
return true if actor.skills.include?(skill_id)
return false
end
#--------------------------------------------------------------------------
# * Change Skill
# actor_id : actor ID
# skill_id : skill ID
# remove : (optional: If true, removes skill from actor)
#--------------------------------------------------------------------------
def mega_skill_change(actor_id=1, skill_id=1, remove=false)
actor = $game_actors[actor_id]
return if actor.nil?
unless remove
actor.learn_skill(skill_id)
else
actor.forget_skill(skill_id)
end
end
#--------------------------------------------------------------------------
# * Test Party for an Item
# item_id : item ID
#--------------------------------------------------------------------------
def mega_item_test(item_id=1)
return true if $game_party.items.include?(item_id)
return false
end
#--------------------------------------------------------------------------
# * Change Item
# item_id : item ID
# remove : (optional: If true, removes item from party)
#--------------------------------------------------------------------------
def mega_item_change(item_id=1, qty=1, remove=false)
unless remove
$game_party.gain_item(item_id, qty)
else
$game_party.lose_item(item_id, qty)
end
end
#--------------------------------------------------------------------------
# * Test Party for a Weapon
# weapon_id : item ID
#--------------------------------------------------------------------------
def mega_weapon_test(weapon_id=1)
return true if $game_party.weapons.include?(weapon_id)
return false
end
#--------------------------------------------------------------------------
# * Change Weapon
# weapon_id : weapon ID
# remove : (optional: If true, removes weapon from party)
#--------------------------------------------------------------------------
def mega_weapon_change(weapon_id=1, qty=1, remove=false)
unless remove
$game_party.gain_weapon(weapon_id, qty)
else
$game_party.lose_weapon(weapon_id, qty)
end
end
#--------------------------------------------------------------------------
# * Test Party for a Armor
# armor_id : armor ID
#--------------------------------------------------------------------------
def mega_armor_test(armor_id=1)
return true if $game_party.armors.include?(armor_id)
return false
end
#--------------------------------------------------------------------------
# * Change Armor
# armor_id : armor ID
# remove : (optional: If true, removes armor from party)
#--------------------------------------------------------------------------
def mega_armor_change(armor_id=1, qty=1, remove=false)
unless remove
$game_party.gain_armor(armor_id, qty)
else
$game_party.lose_armor(armor_id, qty)
end
end
#--------------------------------------------------------------------------
# * Show Animation
# anim_id : animation ID
# event_id : event ID (-1 = player, 0 = this event, 1+ identified on map)
#--------------------------------------------------------------------------
def mega_animation_event(anim_id, event_id=0)
# Get character
character = get_character(event_id)
# If no character exists
if character == nil
# Continue
return true
end
# Set animation ID
character.animation_id = anim_id
# Continue
return true
end
end
Compatibility
This script should be usable for all Ruby-Scripting versions of RPGMaker, and it merely attaches code to the 'load_data' method within the Kernel module itself.
Credits and Thanks
Thanks goes to a dear friend who inquired just this past week if one could get past the 999 item or skill limit.
Terms and Conditions
Free for use, even in commercial games. Due credit is all that's required.
Up is down, left is right and sideways is straight ahead. - Cord "Circle of Iron", 1978 (written by Bruce Lee and James Coburn... really...)
Above are clickable links