Well, seeing as the RMXP community has been destroyed, again, for the third time, I am going to put up some scripts, between 20 and 25 to be exact, to facilitate some recreation.
Near Fantastica's Anti Lag Script:
Instructions:
Nearââ¬â¢s Anti-lag script. If you have any other custom scripts, put this one above all of them in a class named Anti-Lag. If your using the shadow and sun effects scripts by Rataime, you will need this.
Anti Lag Script
#======================================
# ? Anti Event Lag Script
#======================================
# ?By: Near Fantastica
# Date: 12.06.05
# Version: 3
#======================================
class Spriteset_Map
#--------------------------------------------------------------------------
def in_range?(object)
screne_x = $game_map.display_x
screne_x -= 256
screne_y = $game_map.display_y
screne_y -= 256
screne_width = $game_map.display_x
screne_width += 2816
screne_height = $game_map.display_y
screne_height += 2176
return false if object.real_x <= screne_x
return false if object.real_x >= screne_width
return false if object.real_y <= screne_y
return false if object.real_y >= screne_height
return true
end
#--------------------------------------------------------------------------
def update
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
i=0
for sprite in @character_sprites
if sprite.character.is_a?(Game_Event)
if in_range?(sprite.character) or sprite.character.trigger == 3 or sprite.character.trigger == 4
sprite.update
i+=1
end
else
sprite.update
i+=1
end
end
#p i
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
for sprite in @picture_sprites
sprite.update
end
@timer_sprite.update
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
@viewport3.color = $game_screen.flash_color
@viewport1.update
@viewport3.update
end
end
Ccoa's Faces in Messages:
Instructions:
Installation:
This script has several things in different places, so bear with me. First of all there is no need to make a new class for this. Now, go to the 'Window_Message' class and press ctrl + a then come back to here, select all of the code below then press ctrl + c. Go back to you Window_Message and make sure all of it is selected and press ctrl + v. This will replace your 'Window_Message' with the one below (the spoilered script).
Then go to you 'Main' class and add this just after the begin command:
Quote: #Are we showing a face this time?
$face_showing = nil
$showm = Win32API.new 'user32', 'keybd_event', %w(l l l l), ''
and the adding of the script is done. Now, to be able to use this is tricky. First, find a picture, i'd say 128x128 pixils at the most, and import it into the 'Pictures' folder in the Resource Manager. Remember the name of that picture!
Usage:
Now in an event, to show the picture, put this in a call script function just before the message:
Quote:
$face_showing = "name of picture"
replace "name of picture" with what ever the picture that you imported's name was and press ok. Now. In order to stop showing the picture, you mus add a new command after the message(s) or else you will get the same picture on a different characters message. So, once the current character is done speaking, put this in a call script after the message:
Quote: $face_showing = nil
That will set the pic showing to none. remember, you must do this for every picture you show in a message. With this script, the text goes over the picture so in the opacity setting while importing, make sure to put it at 100 or less, so that the text will show up.
Installation:
Ok, make a new class above 'Main' and add this into it. instructions at the bottom.
Usage:
Now as to how to use this, its actually quite simple. In an empty event set to Parallel Prossess in the trigger.
Put this in a call script:
Quote:
$game_screen.weather
Now, after weather in that call script we must define the type, power, and color of weather we want. so we get this $game_screen.weather [type (selects the type of weather, so use a number 1-15 according to the list at the begging of the script), Power (sets the power of the weather 0-40, 0 being none, 40 being strongest), Hue (0-255, changes the color). so, in the event, lets say we want heavy rain in the map. the call script would look like so:
Quote:
$game_screen.weather [1, 40, 0]
Thats all there is too it.
Weather Script
# ccoa's weather script
# with ideas by ScriptKitty and Dr DJ
#
# Weather Types:
# 1 - rain
# 2 - storm
# 3 - snow
# 4 - hail
# 5 - rain with thunder and lightning
# 6 - falling leaves (autumn)
# 7 - blowing leaves (autumn)
# 8 - swirling leaves (autumn)
# 9 - falling leaves (green)
# 10 - cherry blossom (sakura) petals
# 11 - rose petals
# 12 - feathers
# 13 - blood rain
# 14 - sparkles
# 15 - user defined
#
# Weather Power:
# An integer from 0-40. 0 = no weather, 40 = 400 sprites
#
# Usage:
# Create a call script with the following:
# $game_screen.weather(type, power, hue)
#
# Usage of user-defined weather:
# Look at the following globals:
$WEATHER_UPDATE = false # the $WEATHER_IMAGES array has changed, please update
$WEATHER_IMAGES = [] # the array of picture names to use
$WEATHER_X = 0 # the number of pixels the image should move horizontally (positive = right, negative = left)
$WEATHER_Y = 0 # the number of pizels the image should move vertically (positive = down, negative = up)
$WEATHER_FADE = 0 # how much the image should fade each update (0 = no fade, 255 = fade instantly)
$WEATHER_ANIMATED = false # whether or not the image should cycle through all the images
# **** ccoa ****
for i in 1..500
sprite = Sprite.new(viewport)
sprite.z = 1000
sprite.visible = false
sprite.opacity = 0
@sprites.push(sprite)
@current_pose.push(0)
@info.push(rand(50))
@countarray.push(rand(15))
end
end
def dispose
for sprite in @sprites
sprite.dispose
end
@rain_bitmap.dispose
@storm_bitmap.dispose
@snow_bitmap.dispose
@hail_bitmap.dispose
@petal_bitmap.dispose
@blood_rain_bitmap.dispose
for image in @autumn_leaf_bitmaps
image.dispose
end
for image in @green_leaf_bitmaps
image.dispose
end
for image in @rose_bitmaps
image.dispose
end
for image in @feather_bitmaps
image.dispose
end
for image in @sparkle_bitmaps
image.dispose
end
for image in @user_bitmaps
image.dispose
end
$WEATHER_UPDATE = true
end
def type=(type)
return if @type == type
@type = type
case @type
when 1 # rain
bitmap = @rain_bitmap
when 2 # storm
bitmap = @storm_bitmap
when 3 # snow
bitmap = @snow_bitmap
when 4 # hail
bitmap = @hail_bitmap
when 5 # rain w/ thunder and lightning
bitmap = @rain_bitmap
@thunder = true
when 6 # falling autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 7 # blowing autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 8 # swirling autumn leaves
bitmap = @autumn_leaf_bitmaps[0]
when 9 # falling green leaves
bitmap = @green_leaf_bitmaps[0]
when 10 # sakura petals
bitmap = @petal_bitmap
when 11 # rose petals
bitmap = @rose_bitmaps[0]
when 12 # feathers
bitmap = @feather_bitmaps[0]
when 13 # blood rain
bitmap = @blood_rain_bitmap
when 14 # sparkles
bitmap = @sparkle_bitmaps[0]
when 15 # user-defined
bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
else
bitmap = nil
end
if @type != 5
@thunder = false
end
# **** ccoa ****
for i in 1..500
sprite = @sprites[i]
if sprite != nil
sprite.visible = (i <= @max)
sprite.bitmap = bitmap
end
end
end
def ox=(ox)
return if @ox == ox;
@ox = ox
for sprite in @sprites
sprite.ox = @ox
end
end
def oy=(oy)
return if @oy == oy;
@oy = oy
for sprite in @sprites
sprite.oy = @oy
end
end
def max=(max)
return if @max == max;
# **** ccoa ****
@max = [[max, 0].max, 500].min
for i in 1..500
sprite = @sprites[i]
if sprite != nil
sprite.visible = (i <= @max)
end
end
end
def update
return if @type == 0
for i in 1..@max
sprite = @sprites[i]
if sprite == nil
break
end
if @type == 1 or @type == 5 or @type == 13 # rain
sprite.x -= 2
sprite.y += 16
sprite.opacity -= 8
if @thunder and (rand(8000 - @max) == 0)
$game_screen.start_flash(Color.new(255, 255, 255, 255), 5)
Audio.se_play("Audio/SE/061-Thunderclap01")
end
end
if @type == 2 # storm
sprite.x -= 8
sprite.y += 16
sprite.opacity -= 12
end
if @type == 3 # snow
sprite.x -= 2
sprite.y += 8
sprite.opacity -= 8
end
if @type == 4 # hail
sprite.x -= 1
sprite.y += 18
sprite.opacity -= 15
end
if @type == 6 # falling autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
end
sprite.x -= 1
sprite.y += 1
end
if @type == 7 # blowing autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
end
sprite.x -= 10
sprite.y += (rand(4) - 2)
end
if @type == 8 # swirling autumn leaves
@count = rand(20)
if @count == 0
sprite.bitmap = @autumn_leaf_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @autumn_leaf_bitmaps.size
end
if @info[i] != 0
if @info[i] >= 1 and @info[i] <= 10
sprite.x -= 3
sprite.y -= 1
elsif @info[i] >= 11 and @info[i] <= 16
sprite.x -= 1
sprite.y -= 2
elsif @info[i] >= 17 and @info[i] <= 20
sprite.y -= 3
elsif @info[i] >= 21 and @info[i] <= 30
sprite.y -= 2
sprite.x += 1
elsif @info[i] >= 31 and @info[i] <= 36
sprite.y -= 1
sprite.x += 3
elsif @info[i] >= 37 and @info[i] <= 40
sprite.x += 5
elsif @info[i] >= 41 and @info[i] <= 46
sprite.y += 1
sprite.x += 3
elsif @info[i] >= 47 and @info[i] <= 58
sprite.y += 2
sprite.x += 1
elsif @info[i] >= 59 and @info[i] <= 64
sprite.y += 3
elsif @info[i] >= 65 and @info[i] <= 70
sprite.x -= 1
sprite.y += 2
elsif @info[i] >= 71 and @info[i] <= 81
sprite.x -= 3
sprite.y += 1
elsif @info[i] >= 82 and @info[i] <= 87
sprite.x -= 5
end
@info[i] = (@info[i] + 1) % 88
else
if rand(200) == 0
@info[i] = 1
end
sprite.x -= 5
sprite.y += 1
end
end
if @type == 9 # falling green leaves
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @green_leaf_bitmaps.size
sprite.bitmap = @green_leaf_bitmaps[@current_pose[i]]
@countarray[i] = rand(15)
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y += 1
end
if @type == 10 # sakura petals
if @info[i] < 25
sprite.x -= 1
else
sprite.x += 1
end
@info[i] = (@info[i] + 1) % 50
sprite.y += 1
end
if @type == 11 # rose petals
@count = rand(20)
if @count == 0
sprite.bitmap = @rose_bitmaps[@current_pose[i]]
@current_pose[i] = (@current_pose[i] + 1) % @rose_bitmaps.size
end
if @info[i] % 2 == 0
if @info[i] < 10
sprite.x -= 1
elsif
sprite.x += 1
end
end
sprite.y += 1
end
if @type == 12 # feathers
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @feather_bitmaps.size
sprite.bitmap = @feather_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
if rand(100) == 0
sprite.x -= 1
end
if rand(100) == 0
sprite.y -= 1
end
if @info[i] < 50
if rand(2) == 0
sprite.x -= 1
else
sprite.y -= 1
end
else
if rand(2) == 0
sprite.x += 1
else
sprite.y += 1
end
end
@info[i] = (@info[i] + 1) % 100
end
if @type == 14 # sparkles
if @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @sparkle_bitmaps.size
sprite.bitmap = @sparkle_bitmaps[@current_pose[i]]
end
@countarray[i] = (@countarray[i] + 1) % 15
sprite.y += 1
sprite.opacity -= 1
end
if @type == 15 # user-defined
if $WEATHER_UPDATE
update_user_defined
$WEATHER_UPDATE = false
end
if $WEATHER_ANIMATED and @countarray[i] == 0
@current_pose[i] = (@current_pose[i] + 1) % @user_bitmaps.size
sprite.bitmap = @user_bitmaps[@current_pose[i]]
end
sprite.x += $WEATHER_X
sprite.y += $WEATHER_Y
sprite.opacity -= $WEATHER_FADE
end
x = sprite.x - @ox
y = sprite.y - @oy
if sprite.opacity < 64 or x < -50 or x > 750 or y < -300 or y > 500
sprite.x = rand(800) - 50 + @ox
sprite.y = rand(800) - 200 + @oy
sprite.opacity = 255
end
end
end
def make_bitmaps
color1 = Color.new(255, 255, 255, 255)
color2 = Color.new(255, 255, 255, 128)
@rain_bitmap = Bitmap.new(7, 56)
for i in 0..6
@rain_bitmap.fill_rect(6-i, i*8, 1, 8, color1)
end
@storm_bitmap = Bitmap.new(34, 64)
for i in 0..31
@storm_bitmap.fill_rect(33-i, i*2, 1, 2, color2)
@storm_bitmap.fill_rect(32-i, i*2, 1, 2, color1)
@storm_bitmap.fill_rect(31-i, i*2, 1, 2, color2)
end
@snow_bitmap = Bitmap.new(6, 6)
@snow_bitmap.fill_rect(0, 1, 6, 4, color2)
@snow_bitmap.fill_rect(1, 0, 4, 6, color2)
@snow_bitmap.fill_rect(1, 2, 4, 2, color1)
@snow_bitmap.fill_rect(2, 1, 2, 4, color1)
@sprites = []
def update_user_defined
for image in @user_bitmaps
image.dispose
end
#user-defined bitmaps
for name in $WEATHER_IMAGES
@user_bitmaps.push(RPG::Cache.picture(name))
end
for sprite in @sprites
sprite.bitmap = @user_bitmaps[rand(@user_bitmaps.size)]
end
end
attr_reader :type
attr_reader :max
attr_reader :ox
attr_reader :oy
end
end
Near Fantastica's Dynamic Maps:
Instructions:
Nearââ¬â¢s Dynamic Maps script. You will need this is your going to use Wachungaââ¬â¢s random map generator. Put this in a class above all of your other custom scripts, but under the anti-lag script if you are using that, called Dynamic Maps, then put this into it.
Sorry about the wait, a few posting restrictions and features were keeping me from posting anymore.
Fukuyama's Custom Save Menu (With edits from Wachuga to remove < > tags):
Instructions:
Ok, this script will take any "<>" tags out of the map name, that was Wachunga's edit. Now, make a new class above "Main" and name it Custom Save Menu then put this into it:
Custom Save Menu
#================================================
# ====Create a new script above main and put all that code in it. ======
#================================================
#
#
#
#
#
# ? Window_SaveFile
#------------------------------------------------------------------------------
# ????????????????????????????????????
#==============================================================================
class Scene_File
#--------------------------------------------------------------------------
# ? ?????????
# help_text : ????????????????
#--------------------------------------------------------------------------
def initialize(help_text)
@help_text = help_text
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ???????????
@help_window = Window_Help.new
@help_window.set_text(@help_text)
# ???????????????
@savefile_windows = []
for i in 0..3
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
# ??????????????
@file_index = $game_temp.last_file_index
@savefile_windows[@file_index].selected = true
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@help_window.dispose
for i in @savefile_windows
i.dispose
end
if self.is_a?(Scene_Save)
@confirm_window.dispose
@yes_no_window.dispose
end
# C ??????????
if Input.trigger?(Input::C)
# ???? on_decision (??????) ???
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
# B ??????????
if Input.trigger?(Input::B)
# ???? on_cancel (??????) ???
on_cancel
return
end
# ??????????????
if Input.repeat?(Input::DOWN)
# ????????????????????????
# ?????????? 3 ??????
if Input.trigger?(Input::DOWN) or @file_index < 3
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ?????????
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 1) % 4
@savefile_windows[@file_index].selected = true
return
end
end
# ??????????????
if Input.repeat?(Input::UP)
# ????????????????????????
# ?????????? 0 ???????
if Input.trigger?(Input::UP) or @file_index > 0
# ???? SE ???
$game_system.se_play($data_system.cursor_se)
# ?????????
@savefile_windows[@file_index].selected = false
@file_index = (@file_index + 3) % 4
@savefile_windows[@file_index].selected = true
return
end
end
end
#--------------------------------------------------------------------------
# ? ????????
# file_index : ?????????????? (0?3)
#--------------------------------------------------------------------------
def make_filename(file_index)
return "Save#{file_index + 1}.rxdata"
end
end
#
# Map Name Script ver.1.03.3
# by: fukuyama
# Japanese Comments Removed By: K-Anator
# http://www.rpg-reborn.tk
# This only gives the game_map.name method
#==============================================================================
# Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
alias xrxs20_main main
def main
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
xrxs20_main
end
end
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
def name
$map_infos[@map_id]
end
end
Makeamidget's Battle Warning Script:
Instructions:
This script will put a bar over your head that will have an encounter bar in it. The size depends on the encounter rate and when the bar gets to the very end you will be attacked by monsters. First go to 'Scene_Map' and add this under the 'main' command:
Now, make a new class above 'Main' and call it Encounter Bar and put this into it:
Battle Warning Script
#=================================================
# The amazing Battle Warning thing by makeamidget
#=================================================
class Encounter < Window_Base
def initialize(x=0,y=0,width=200,height=45)
if width > 640
width = 640
end
super(x, y, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $defaultfonttype # "Help" window font
self.contents.font.size = $defaultfontsize
self.opacity = 0#change if you want to see the box
refresh
end
def refresh
self.contents.clear
draw_encounter(0,0)
end
Momomomo's Item Book Script (Translated by Mcdohl):
Instructions:
Installation:
Make a new class called Item Book above 'Main' and put the spoiler code into it.
Usage:
It is a very long script indeed lol, but don't be worried, its not too hard to use.
First off, go to your Database in your game after you get this script in and go to the system tab. In the bottom left hand corner in the element/attribute tab, add new slots. Now, the stuff in these lines:
Is what you put in those new elements/attributes you just made. Note that I have customized this to my needs, if you want to get rid of the quest items, and quests, just delete all instances of each out of those lines above that are in the script. You can add new ones in the same way as well.
Now, go to the items and armor tabs in your database and, lets say were in the armor tab, we go to Bronze Shield and check the 'armor' element/attribute. We go to Power Ring and check the accessories element/attribute. this places that item in that section. You do the same for items.
Common Items are what the defaults are, or what you want of course, then you can add sections or other items, and armors. Weapons are already listed, you don't need to make an element/attribute for them.
Now, to call this from the menu or a call script use this:
Quote: $scene = Scene_ItemBook.new
Item Book Script
#================================
# Item_Book by momomomo?
# http://f53.aaa.livedoor.jp/%7Emomomo/sou...ource.html
#----------------------------------------------------------------
#-Translated by Mcdohl
#----------------------------------------------------------------
#================================
# English is not my main language, so I'm sorry if you can't understand some of my comments.
# 11.18.2005
# Script translated, known bugs:
# -Won't display items you have equipped at start until you unequip them. This is because the
# script detects items until you get them on the "item" menu, not the Equipment menu. A way
# to fix this is to start with nothing equipped, then add the items and equip them in an auto-start
# event.
# This script will add all the items you acquire throughout the game into a "Book."
# In this book you can see the stats, price, element, etc. Works great with KGC's Item
# Grouping Script.
module Item_Book_Config
# The following line (SHOW_COMPLETE_TYPE =) is very important. It will define how are
# the items counted. (The item count appears on the upper right corner, in the help window.
# Use "0" to display nothing.
# Use "1" to display it in a "items found so far/total" format.
# Use "2" to use percentage completion.
# Use "3" Method 1+2
SHOW_COMPLETE_TYPE = 1
end
# Name the item, weapon and armor categories. If your key items are in the Item index in the
# database, then type it inside the item_kind_name brackets and so on. Got it? I hope so. ^^
@item_kind_name = ["Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@weapon_kind_name = ["Weapons"]
@armor_kind_name = ["Armor", "Accessories"]
# Next is the menu setup. It's a vertical list. List the categories in any order you want.
# Note: The categories below must coincide with the categories you listed above.
@kind_row = ["Items",
"Status_Inflicting_Items",
"Status Increasing Items",
"Quest_Items",
"Weapons",
"Armor",
"Accessories",
"Quests"]
# Now write the element setups. It's easier to understand this if you're already using KGC's
# item grouping script. You need to add elements in the Database (in the System Tab). For
# example, if you want to use a Key Item category, go make an element called "Key Item" and
# then apply it to all the items you want them to appear under the Key Item category!
# If you're not going to categorize a kind of item, like in this case "Weapons" then just type the
# brackets with nothing inside.
@item_kind_element_name = ["Common Items", "Quest_Items", "Quests", "Status_Inflicting_Items", "Status Increasing Items"]
@weapon_kind_element_name = []
@armor_kind_element_name = ["Armor", "Accessories"]
# Reading Database data.
@item_id_data = item_book_id_set
@weapon_id_data = weapon_book_id_set
@armor_id_data = armor_book_id_set
end
#--------------------------------------------------------------------------
# ? Defining Kinds
#--------------------------------------------------------------------------
def kind_search(name)
if @item_kind_name.include?(name)
return [0, @item_kind_name.index(name)]
elsif @weapon_kind_name.include?(name)
return [1, @weapon_kind_name.index(name)]
elsif @armor_kind_name.include?(name)
return [2, @armor_kind_name.index(name)]
end
end
#--------------------------------------------------------------------------
# ? ??????????? <----No idea
#--------------------------------------------------------------------------
def no_add_element
no_add = 0
# ???????ID???
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /??????/
no_add = i
break
end
end
return no_add
end
#--------------------------------------------------------------------------
# ? ?????????ID??? <-----No idea
#--------------------------------------------------------------------------
def element_search(element_name)
return nil if element_name == nil
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /^#{element_name}/
return i
end
end
end
#--------------------------------------------------------------------------
# ? Item Database
#--------------------------------------------------------------------------
def item_book_id_set
data = []
no_add = no_add_element
if @item_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_items.size
item = $data_items[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@item_kind_element_name.size
data[i] = [0]
element_id = element_search(@item_kind_element_name[i])
for j in 1...$data_items.size
item = $data_items[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
#--------------------------------------------------------------------------
# ? Weapon Database
#--------------------------------------------------------------------------
def weapon_book_id_set
data = []
no_add = no_add_element
if @weapon_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_weapons.size
item = $data_weapons[i]
next if item.name == ""
next if item.element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@weapon_kind_element_name.size
data[i] = [0]
element_id = element_search(@weapon_kind_element_name[i])
for j in 1...$data_weapons.size
item = $data_weapons[j]
next if item.name == ""
next if item.element_set.include?(no_add)
if item.element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
#--------------------------------------------------------------------------
# ? Armor Database
#--------------------------------------------------------------------------
def armor_book_id_set
data = []
no_add = no_add_element
if @armor_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_armors.size
item = $data_armors[i]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
data[0].push(item.id)
end
else
for i in 0...@armor_kind_element_name.size
data[i] = [0]
element_id = element_search(@armor_kind_element_name[i])
for j in 1...$data_armors.size
item = $data_armors[j]
next if item.name == ""
next if item.guard_element_set.include?(no_add)
if item.guard_element_set.include?(element_id)
data[i].push(item.id)
end
end
end
end
return data
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ? Element Set Up
# NOTE: Default RTP elements were used.
#--------------------------------------------------------------------------
def draw_attack_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("Fire") if elem == "Fire"
elem_temp.push("Ice") if elem == "Ice"
elem_temp.push("Thunder") if elem == "Thunder"
elem_temp.push("Water") if elem == "Water"
elem_temp.push("Earth") if elem == "Earth"
elem_temp.push("Wind") if elem == "Wind"
elem_temp.push("Light") if elem == "Light"
elem_temp.push("Darkness") if elem == "Darkness"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ?????? <---No idea
#--------------------------------------------------------------------------
def draw_attack_wp_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("?") if elem == "?"
elem_temp.push("?") if elem == "?"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "??")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ?????? <-------No idea
#--------------------------------------------------------------------------
def draw_attack_weak_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
elem_temp.push("") if elem == ""
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? States (Status Abnormalities, like Poison, etc.)
#--------------------------------------------------------------------------
def draw_attack_add_state(x, y, plus_state_set)
state_temp = []
for i in plus_state_set
state = $data_states[i]
state_temp.push(state.name) if state.name != ""
end
if state_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
oy = 0
for name in state_temp
cx = self.contents.text_size(name).width
if ox + cx + 4 >= self.contents.width - 128
ox = 0
oy += 1
end
self.contents.draw_text(x+ox, y+oy*32, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ??????? <-------No idea
#--------------------------------------------------------------------------
def draw_scope(scope)
case scope
when 0
return ""
when 1
return "???"
when 2
return "???"
when 3
return "????"
when 4
return "????"
when 5
return "????"
when 6
return "????"
when 7
return "???"
end
end
end
class Game_Temp
attr_accessor :item_book_data
alias temp_item_book_data_initialize initialize
def initialize
temp_item_book_data_initialize
@item_book_data = Data_ItemBook.new
end
end
class Game_Party
attr_accessor :item_count # ????????(???)
attr_accessor :weapon_count # ??????(???)
attr_accessor :armor_count # ??????(???)
#--------------------------------------------------------------------------
# ? Registers items when you obtain them
#--------------------------------------------------------------------------
alias item_book_info_initialize initialize
def initialize
item_book_info_initialize
@item_count = {}
@weapon_count = {}
@armor_count = {}
end
alias item_book_gain_item gain_item
def gain_item(item_id, n)
add_item_count(item_id, 0) if n > 0
item_book_gain_item(item_id, n)
end
alias item_book_gain_weapon gain_weapon
def gain_weapon(item_id, n)
add_weapon_count(item_id, 0) if n > 0
item_book_gain_weapon(item_id, n)
end
alias item_book_gain_armor gain_armor
def gain_armor(item_id, n)
add_armor_count(item_id, 0) if n > 0
item_book_gain_armor(item_id, n)
end
def add_item_count(item_id, type = 0)
if type == -1
@item_count[item_id] = 0
else
@item_count[item_id] = 1
end
end
def add_weapon_count(weapon_id, type = 0)
if type == -1
@weapon_count[weapon_id] = 0
else
@weapon_count[weapon_id] = 1
end
end
def add_armor_count(armor_id, type = 0)
if type == -1
@armor_count[armor_id] = 0
else
@armor_count[armor_id] = 1
end
end
#--------------------------------------------------------------------------
# ? ???????????????
#--------------------------------------------------------------------------
def item_book_max
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_max(kind)
end
end
return size
end
#--------------------------------------------------------------------------
# ? ???????????????
#--------------------------------------------------------------------------
def item_book_now
kind_data = []
kind_data[0] = $game_temp.item_book_data.item_kind_name
kind_data[1] = $game_temp.item_book_data.weapon_kind_name
kind_data[2] = $game_temp.item_book_data.armor_kind_name
size = 0
for i in 0..2
for kind in kind_data[i]
size += item_book_category_now(kind)
end
end
return size
end
#--------------------------------------------------------------------------
# ? ?????????????
#--------------------------------------------------------------------------
def item_book_complete_percentage
i_max = item_book_max.to_f
i_now = item_book_now.to_f
comp = i_now / i_max * 100
return comp.truncate
end
#--------------------------------------------------------------------------
# ? ?????????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_max(category)
kind_data = $game_temp.item_book_data.kind_search(category)
case kind_data[0]
when 0
id_data = $game_temp.item_book_data.item_id_data.dup
when 1
id_data = $game_temp.item_book_data.weapon_id_data.dup
when 2
id_data = $game_temp.item_book_data.armor_id_data.dup
end
index = kind_data[1]
size = id_data[index].size - 1
return size
end
#--------------------------------------------------------------------------
# ? ?????????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_now(category)
kind_data = $game_temp.item_book_data.kind_search(category)
index = kind_data[1]
case kind_data[0]
when 0
now_item_info = @item_count.keys
elename = $game_temp.item_book_data.item_kind_element_name[index]
item_set = $data_items
when 1
now_item_info = @weapon_count.keys
elename = $game_temp.item_book_data.weapon_kind_element_name[index]
item_set = $data_weapons
when 2
now_item_info = @armor_count.keys
elename = $game_temp.item_book_data.armor_kind_element_name[index]
item_set = $data_armors
end
# ???????ID???
no_add = $game_temp.item_book_data.no_add_element
element_id = $game_temp.item_book_data.element_search(elename)
new_item_info = []
for i in now_item_info
item = item_set[i]
next if item == nil
next if item.name == ""
case item
when RPG::Item
ele_set = item.element_set
when RPG::Weapon
ele_set = item.element_set
when RPG::Armor
ele_set = item.guard_element_set
end
next if ele_set.include?(no_add)
if element_id == nil or ele_set.include?(element_id)
new_item_info.push(item.id)
end
end
return new_item_info.size
end
#--------------------------------------------------------------------------
# ? ???????????????????
# category:??????
#--------------------------------------------------------------------------
def item_book_category_complete_percentage(category)
i_max = item_book_category_max(category).to_f
i_now = item_book_category_now(category).to_f
comp = i_now / i_max * 100
end
end
class Interpreter
def item_book_max(category=nil)
if category == nil
return $game_party.item_book_max
else
return $game_party.item_book_category_max(category)
end
end
def item_book_now(category=nil)
if category == nil
return $game_party.item_book_now
else
return $game_party.item_book_category_now(category)
end
end
def item_book_comp(category=nil)
if category == nil
return $game_party.item_book_complete_percentage
else
return $game_party.item_book_category_complete_percentage(category)
end
end
end
class Window_ItemBook < Window_Selectable
attr_reader :data
attr_reader :item_kind
attr_reader :item_index
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize(index=0)
super(0, 64, 640, 416)
@column_max = 2
@book_data = $game_temp.item_book_data
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
@item_kind = index
self.index = 0
#refresh
end
def new_data_set(index)
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def data_set(index)
kind_row_data = @book_data.kind_search(@book_data.kind_row[index])
@item_kind = kind_row_data[0]
@item_index = kind_row_data[1]
data = []
case @item_kind
when 0
data = @book_data.item_id_data[@item_index].dup
when 1
data = @book_data.weapon_id_data[@item_index].dup
when 2
data = @book_data.armor_id_data[@item_index].dup
end
return data
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def show?(kind, id)
case kind
when 0
if $game_party.item_count[id] == 0 or $game_party.item_count[id] == nil
return false
else
return true
end
when 1
if $game_party.weapon_count[id] == 0 or $game_party.weapon_count[id] == nil
return false
else
return true
end
when 2
if $game_party.armor_count[id] == 0 or $game_party.armor_count[id] == nil
return false
else
return true
end
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
#???? 0 ??????????????????????
return if @item_max == 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
case @item_kind
when 0
item = $data_items[@data[index]]
id = @book_data.item_id_data[@item_index].index(item.id)
when 1
item = $data_weapons[@data[index]]
id = @book_data.weapon_id_data[@item_index].index(item.id)
when 2
item = $data_armors[@data[index]]
id = @book_data.armor_id_data[@item_index].index(item.id)
end
return if item == nil
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 32, 32, id.to_s)
if show?(@item_kind, item.id)
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x+48, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x+48 + 28, y, 212, 32, item.name, 0)
else
# The "??" are used for the blank spaces. (The spaces of the items you have not obtained yet.)
self.contents.draw_text(x+48 + 28, y, 212, 32, "??", 0)
return
end
end
end
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
#???
end
end
class Scene_ItemBook
include Item_Book_Config
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ????????
@title_window = Window_Base.new(0, 0, 640, 64)
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
# Your book's title.
@title_window.contents.draw_text(4, 0, 320, 32, "Item Book", 0)
draw_comp
@main_window = Window_ItemBook.new
@main_window.active = false
@main_window.index = -1
@help_window = Window_Help.new
@help_window.z = 110
@help_window.y = 64
@help_window.visible = false
command = $game_temp.item_book_data.kind_row
@kind_window = Window_Command.new(160, command)
@kind_window.z = 110
@kind_window.x = 320 - @kind_window.width / 2
@kind_window.y = 240 - @kind_window.height / 2
@kind_window.active = true
# ???????????? (?????????????)
@info_window = Window_ItemBook_Info.new
@info_window.z = 110
@info_window.visible = false
@info_window.active = false
# ?????????????
@info_window.help_window = @help_window
@visible_index = 0
@now_kind = nil
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@title_window.dispose
@help_window.dispose
@main_window.dispose
@kind_window.dispose
@info_window.dispose
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ????????
#@help_window.update
@main_window.update
@kind_window.update
@info_window.update
if @info_window.active
update_info
return
end
# ?????????????????: update_target ???
if @main_window.active
update_main
return
end
# ????????????????: update_kind ???
if @kind_window.active
update_kind
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????)
#--------------------------------------------------------------------------
def update_kind
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
if @now_kind != @kind_window.index
@main_window.new_data_set(@kind_window.index)
@main_window.refresh
@now_kind = @kind_window.index
end
subtitle = $game_temp.item_book_data.kind_row[@kind_window.index]
# This is, when you enter a sub-menu. (for example Armors). Armors is the subtitle, so you
# write a text to go before Armors. The default said "Item Book:" that way it would look this
# way when you scroll through the Armor Section..."Item Book: Armors."
title = ""+subtitle
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, title, 0)
draw_comp(subtitle)
@kind_window.active = false
@kind_window.visible = false
@main_window.active = true
@main_window.index = 0
return
end
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (?????????????????)
#--------------------------------------------------------------------------
def update_main
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = false
@kind_window.active = true
@kind_window.visible = true
@main_window.index = -1
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "??????", 0)
draw_comp
return
end
# C ??????????
if Input.trigger?(Input::C)
if @main_window.item == nil or
@main_window.show?(@main_window.item_kind, @main_window.item) == false
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ?? SE ???
$game_system.se_play($data_system.decision_se)
@main_window.active = false
@info_window.active = true
@info_window.visible = true
@visible_index = @main_window.index
@info_window.refresh(@main_window.item, @main_window.item_kind, @main_window.item_index)
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (??????????????????)
#--------------------------------------------------------------------------
def update_info
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = true
@info_window.active = false
@info_window.visible = false
@help_window.visible = false
return
end
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
return
end
if Input.trigger?(Input::L)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != 0
@visible_index -= 1
else
@visible_index = @main_window.data.size - 1
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
if Input.trigger?(Input::R)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != @main_window.data.size - 1
@visible_index += 1
else
@visible_index = 0
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
end
def draw_comp(category=nil)
if SHOW_COMPLETE_TYPE != 0
if category == nil
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_complete_percentage
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_now
i_max = $game_party.item_book_max
comp = $game_party.item_book_complete_percentage
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
else
case SHOW_COMPLETE_TYPE
when 1
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
text = i_now.to_s + "/" + i_max.to_s
when 2
comp = $game_party.item_book_category_complete_percentage(category)
text = comp.to_s + "%"
when 3
i_now = $game_party.item_book_category_now(category)
i_max = $game_party.item_book_category_max(category)
comp = $game_party.item_book_category_complete_percentage(category)
text = i_now.to_s + "/" + i_max.to_s + " " + comp.to_s + "%"
end
end
if text != nil
@title_window.contents.draw_text(320, 0, 288, 32, text, 2)
end
end
end
end
Create a new class above "Main" and place the spoiler code into it.
Usage:
First off, go to your Database in your game after you get this script in and go to the system tab. In the bottom left hand corner in the element/attribute tab, add new slots. Now, the stuff in these lines:
Quote:# Name the skill categories.
@skill_kind_name = ["Physical", "Elemental", "Non-Elemental", "Curative", "Status"]
# Next is the menu setup. It's a vertical list. List the categories in any order you want.
# Note: The categories below must coincide with the categories you listed above.
@kind_row = ["Physical",
"Elemental",
"Non-Elemental",
"Curative",
"Status"]
# Now write the element setups.You need to add elements in the Database (in the System Tab). For
# example, if you want to use a "Physical" category, go make an element called "Physical" and
# then apply it to all the skills you want them to appear under the Physical category!
@skill_kind_element_name = ["Physical", "Elemental", "Curative", "Status", "Non-Elemental"]
@skill_id_data = skill_book_id_set
end
Is what you put in those new elements/attributes you just made. Note that I have customized this to my needs, if you want to get rid of the stuff you don't want just delete all instances of each out of those lines above that are in the script. You new ones in the same way as well. Now, go to the skills tab, and go to the 'Fire' spell. Now, check the Elemental element/attribute to place this spell into the Elemental section of the skill book. Then just do the same for the rest of the skills by selecting to proper element/attribute for them. Now, to call this script from the main menu or from a call script, use this:
Quote: $scene = Scene_SkillBook.new
Skill Book Script
#=================================
# Item_Book by momomomo?
# http://f53.aaa.livedoor.jp/%7Emomomo/sou...ource.html
#----------------------------------------------------------------
#-Translated by Mcdohl
#----------------------------------------------------------------
#================================
# English is not my main language, so I'm sorry if you can't understand some of my comments.
# 11.18.2005
# Script translated, known bugs:
# -Doesn't seem to work with some custom-skill learning scripts.
# This script will add all the skills you learn throughout the game into a "Book."
# In this book you can see the stats, MP cost, element and states of each skill.
module Skill_Book_Config
# The following line (SHOW_COMPLETE_TYPE =) is very important. It will define how are
# the items counted. (The item count appears on the upper right corner, in the help window.
# Use "0" to display nothing.
# Use "1" to display it in a "items found so far/total" format.
# Use "2" to use percentage completion.
# Use "3" for...a weird item counting method...
SHOW_COMPLETE_TYPE = 3
DRAW_POW_ZERO = false
ZERO_POW_TEXT = ""
end
class Window_SkillBook_Info < Window_Selectable
include Skill_Book_Config
end
class Data_SkillBook
attr_reader :skill_kind_name
attr_reader :kind_row
attr_reader :skill_id_data
attr_reader :skill_kind_element_name
#--------------------------------------------------------------------------
# ? Setup
#--------------------------------------------------------------------------
def initialize
# Name the skill categories.
@skill_kind_name = ["Physical", "Elemental", "Non-Elemental", "Curative", "Status"]
# Next is the menu setup. It's a vertical list. List the categories in any order you want.
# Note: The categories below must coincide with the categories you listed above.
@kind_row = ["Physical",
"Elemental",
"Non-Elemental",
"Curative",
"Status"]
# Now write the element setups.You need to add elements in the Database (in the System Tab). For
# example, if you want to use a "Physical" category, go make an element called "Physical" and
# then apply it to all the skills you want them to appear under the Physical category!
@skill_kind_element_name = ["Physical", "Elemental", "Curative", "Status", "Non-Elemental"]
@skill_id_data = skill_book_id_set
end
#--------------------------------------------------------------------------
# ? Defining Kinds
#--------------------------------------------------------------------------
def kind_search(name)
if @skill_kind_name.include?(name)
return [0, @skill_kind_name.index(name)]
end
end
#--------------------------------------------------------------------------
# ? ???????????
#--------------------------------------------------------------------------
def no_add_element
no_add = 0
# ???????ID???
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /??????/
no_add = i
break
end
end
return no_add
end
#--------------------------------------------------------------------------
# ? ?????????ID???
#--------------------------------------------------------------------------
def element_search(element_name)
return nil if element_name == nil
for i in 1...$data_system.elements.size
if $data_system.elements[i] =~ /^#{element_name}/
return i
end
end
end
#--------------------------------------------------------------------------
# ? ??????ID??
#--------------------------------------------------------------------------
def skill_book_id_set
data = []
no_add = no_add_element
if @skill_kind_element_name.size == 0
data[0] = [0]
for i in 1...$data_skills.size
skill = $data_skills[i]
next if skill.name == ""
next if skill.element_set.include?(no_add)
data[0].push(skill.id)
end
else
for i in 0...@skill_kind_element_name.size
data[i] = [0]
element_id = element_search(@skill_kind_element_name[i])
for j in 1...$data_skills.size
skill = $data_skills[j]
next if skill.name == ""
next if skill.element_set.include?(no_add)
if skill.element_set.include?(element_id)
data[i].push(skill.id)
end
end
end
end
return data
end
end
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ? ???????
# skill_id : ??? ID
# This seems to be how the script detects a new skill, this may be the key to making it compatible
# with custom-learning skills scripts, not sure tho.
#--------------------------------------------------------------------------
alias game_actor_skill_book_learn_skill learn_skill
def learn_skill(skill_id)
game_actor_skill_book_learn_skill(skill_id)
$game_system.add_skill_count(skill_id)
end
end
class Window_Base < Window
#--------------------------------------------------------------------------
# ? Element Set Up
# NOTE: Default RTP elements were used.
#--------------------------------------------------------------------------
def draw_attack_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("Fire") if elem == "Fire"
elem_temp.push("Ice") if elem == "Ice"
elem_temp.push("Thunder") if elem == "Thunder"
elem_temp.push("Water") if elem == "Water"
elem_temp.push("Earth") if elem == "Earth"
elem_temp.push("Wind") if elem == "Wind"
elem_temp.push("Light") if elem == "Light"
elem_temp.push("Darkness") if elem == "Darkness"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def draw_attack_wp_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("?") if elem == "?"
elem_temp.push("?") if elem == "?"
elem_temp.push("?") if elem == "?"
elem_temp.push("?") if elem == "?"
elem_temp.push("?") if elem == "?"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "??")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def draw_attack_weak_element(x, y, element_set)
elem_temp = []
for i in element_set
elem = $data_system.elements[i]
elem_temp.push("??") if elem == "? ??"
elem_temp.push("?") if elem == "? ?"
elem_temp.push("??") if elem == "? ??"
elem_temp.push("?") if elem == "? ?"
elem_temp.push("?") if elem == "? ?"
elem_temp.push("?") if elem == "? ?"
elem_temp.push("??") if elem == "? ??"
elem_temp.push("??") if elem == "? ??"
end
if elem_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "??")
return
end
ox = 0
for name in elem_temp
cx = self.contents.text_size(name).width
self.contents.draw_text(x+ox, y, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? States (Status Abnormalities like Poison, Sleep, etc.)
#--------------------------------------------------------------------------
def draw_attack_add_state(x, y, plus_state_set)
state_temp = []
for i in plus_state_set
state = $data_states[i]
state_temp.push(state.name) if state.name != ""
end
if state_temp.size == 0
self.contents.draw_text(x, y, 64, 32, "None")
return
end
ox = 0
oy = 0
for name in state_temp
cx = self.contents.text_size(name).width
if ox + cx + 4 >= self.contents.width - 128
ox = 0
oy += 1
end
self.contents.draw_text(x+ox, y+oy*32, cx, 32, name)
ox += cx+8
end
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def draw_scope(scope)
case scope
when 0
return ""
when 1
return ""
when 2
return ""
when 3
return ""
when 4
return ""
when 5
return ""
when 6
return ""
when 7
return ""
end
end
end
class Game_Temp
attr_accessor :skill_book_data
alias temp_skill_book_data_initialize initialize
def initialize
temp_skill_book_data_initialize
@skill_book_data = Data_SkillBook.new
end
end
class Game_System
attr_accessor :skill_count # ???????(???)
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
alias game_system_skill_book_initialize initialize
def initialize
game_system_skill_book_initialize
@skill_count = {}
end
#--------------------------------------------------------------------------
# ? ???????????(???)
# 0:??? 1:???
#--------------------------------------------------------------------------
def add_skill_count(skill_id, type=0)
if type == -1
@skill_count[skill_id] = 0
else
@skill_count[skill_id] = 1
end
end
#--------------------------------------------------------------------------
# ? ??????????????
#--------------------------------------------------------------------------
def skill_book_max
kind_data = $game_temp.skill_book_data.skill_kind_name
size = 0
for kind in kind_data
size += skill_book_category_max(kind)
end
return size
end
#--------------------------------------------------------------------------
# ? ??????????????
#--------------------------------------------------------------------------
def skill_book_now
kind_data = $game_temp.skill_book_data.skill_kind_name
size = 0
for kind in kind_data
size += skill_book_category_now(kind)
end
return size
end
#--------------------------------------------------------------------------
# ? ????????????
#--------------------------------------------------------------------------
def skill_book_complete_percentage
s_max = skill_book_max.to_f
s_now = skill_book_now.to_f
comp = s_now / s_max * 100
return comp.truncate
end
#--------------------------------------------------------------------------
# ? ????????????????????
# category:??????
#--------------------------------------------------------------------------
def skill_book_category_max(category)
id_data = $game_temp.skill_book_data.skill_id_data.dup
index = $game_temp.skill_book_data.kind_search(category)[1]
size = id_data[index].size - 1
return size
end
#--------------------------------------------------------------------------
# ? ????????????????????
# category:??????
#--------------------------------------------------------------------------
def skill_book_category_now(category)
now_skill_info = @skill_count.keys
index = $game_temp.skill_book_data.kind_search(category)[1]
# ???????ID???
no_add = $game_temp.skill_book_data.no_add_element
elename = $game_temp.skill_book_data.skill_kind_element_name[index]
element_id = $game_temp.skill_book_data.element_search(elename)
new_skill_info = []
for i in now_skill_info
skill = $data_skills[i]
next if skill == nil
next if skill.name == ""
next if skill.element_set.include?(no_add)
if element_id == nil or skill.element_set.include?(element_id)
new_skill_info.push(skill.id)
end
end
return new_skill_info.size
end
#--------------------------------------------------------------------------
# ? ??????????????????
# category:??????
#--------------------------------------------------------------------------
def skill_book_category_complete_percentage(category)
s_max = skill_book_category_max(category).to_f
s_now = skill_book_category_now(category).to_f
comp = s_now / s_max * 100
end
end
class Interpreter
def skill_book_max(category=nil)
if category == nil
return $game_system.skill_book_max
else
return $game_system.skill_book_category_max(category)
end
end
def skill_book_now(category=nil)
if category == nil
return $game_system.skill_book_now
else
return $game_system.skill_book_category_now(category)
end
end
def skill_book_comp(category=nil)
if category == nil
return $game_system.skill_book_complete_percentage
else
return $game_system.skill_book_category_complete_percentage(category)
end
end
end
class Window_SkillBook < Window_Selectable
attr_reader :data
attr_reader :item_kind
attr_reader :item_index
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize(index=0)
super(0, 64, 640, 416)
@column_max = 2
@book_data = $game_temp.skill_book_data
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
@item_kind = index
self.index = 0
#refresh
end
def new_data_set(index)
@data = data_set(index)
@data.shift
#@data.sort!
@item_max = @data.size
end
#--------------------------------------------------------------------------
# ? ????????
#--------------------------------------------------------------------------
def data_set(index)
kind_row_data = @book_data.kind_search(@book_data.kind_row[index])
@item_kind = kind_row_data[0]
@item_index = kind_row_data[1]
data = []
case @item_kind
when 0
data = @book_data.skill_id_data[@item_index].dup
end
return data
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def show?(kind, id)
case kind
when 0
if $game_system.skill_count[id] == 0 or $game_system.skill_count[id] == nil
return false
else
return true
end
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
#???? 0 ??????????????????????
return if @item_max == 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
case @item_kind
when 0
item = $data_skills[@data[index]]
id = @book_data.skill_id_data[@item_index].index(item.id)
end
return if item == nil
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 32, 32, id.to_s)
if show?(@item_kind, item.id)
bitmap = RPG::Cache.icon(item.icon_name)
opacity = 255
self.contents.blt(x+48, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x+48 + 28, y, 212, 32, item.name, 0)
else
# The "??" are used in blank spaces. (the skills you haven't learned yet)
self.contents.draw_text(x+48 + 28, y, 212, 32, "??", 0)
return
end
end
end
cost = item.sp_cost.to_s
# Change "MP" to whatever you want. Like "SP" for example, or just leave it in MP.
self.contents.draw_text(4+20 + 28 + 232, 0, 48, 32, "MP:", 2)
self.contents.draw_text(4+48 + 28 + 232, 0, 48, 32, cost.to_s, 2)
@help_window.set_text(item.description)
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_help
#???
end
end
class Scene_SkillBook
include Skill_Book_Config
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def main
# ????????
@title_window = Window_Base.new(0, 0, 640, 64)
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "Skill Book", 0)
draw_comp
@main_window = Window_SkillBook.new
@main_window.active = false
@main_window.index = -1
@help_window = Window_Help.new
@help_window.z = 110
@help_window.y = 64
@help_window.visible = false
command = $game_temp.skill_book_data.kind_row
@kind_window = Window_Command.new(160, command)
@kind_window.z = 110
@kind_window.x = 320 - @kind_window.width / 2
@kind_window.y = 240 - @kind_window.height / 2
@kind_window.active = true
# ???????????? (?????????????)
@info_window = Window_SkillBook_Info.new
@info_window.z = 110
@info_window.visible = false
@info_window.active = false
# ?????????????
@info_window.help_window = @help_window
@visible_index = 0
@now_kind = nil
# ?????????
Graphics.transition
# ??????
loop do
# ????????
Graphics.update
# ???????
Input.update
# ??????
update
# ????????????????
if $scene != self
break
end
end
# ?????????
Graphics.freeze
# ????????
@title_window.dispose
@help_window.dispose
@main_window.dispose
@kind_window.dispose
@info_window.dispose
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
# ????????
#@help_window.update
@main_window.update
@kind_window.update
@info_window.update
if @info_window.active
update_info
return
end
# ?????????????????: update_target ???
if @main_window.active
update_main
return
end
# ????????????????: update_kind ???
if @kind_window.active
update_kind
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (????????????????)
#--------------------------------------------------------------------------
def update_kind
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
if @now_kind != @kind_window.index
@main_window.new_data_set(@kind_window.index)
@main_window.refresh
@now_kind = @kind_window.index
end
subtitle = $game_temp.skill_book_data.kind_row[@kind_window.index]
# This is, when you enter a sub-menu. (for example Physical). Physical is the subtitle, so you
# write a text to go before Armors. The default said "Skill Book:" that way it would look this
# way when you scroll through the Physical Section..."Skill Book: Physical."
title = ""+subtitle
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, title, 0)
draw_comp(subtitle)
@kind_window.active = false
@kind_window.visible = false
@main_window.active = true
@main_window.index = 0
return
end
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (?????????????????)
#--------------------------------------------------------------------------
def update_main
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = false
@kind_window.active = true
@kind_window.visible = true
@main_window.index = -1
@title_window.contents.clear
@title_window.contents = Bitmap.new(640 - 32, 64 - 32)
@title_window.contents.draw_text(4, 0, 320, 32, "Skill Book", 0)
draw_comp
return
end
# C ??????????
if Input.trigger?(Input::C)
if @main_window.item == nil or
@main_window.show?(@main_window.item_kind, @main_window.item) == false
# ??? SE ???
$game_system.se_play($data_system.buzzer_se)
return
end
# ?? SE ???
$game_system.se_play($data_system.decision_se)
@main_window.active = false
@info_window.active = true
@info_window.visible = true
@visible_index = @main_window.index
@info_window.refresh(@main_window.item, @main_window.item_kind, @main_window.item_index)
return
end
end
#--------------------------------------------------------------------------
# ? ?????? (??????????????????)
#--------------------------------------------------------------------------
def update_info
# B ??????????
if Input.trigger?(Input::B)
# ????? SE ???
$game_system.se_play($data_system.cancel_se)
@main_window.active = true
@info_window.active = false
@info_window.visible = false
@help_window.visible = false
return
end
# C ??????????
if Input.trigger?(Input::C)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
return
end
if Input.trigger?(Input::L)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != 0
@visible_index -= 1
else
@visible_index = @main_window.data.size - 1
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
if Input.trigger?(Input::R)
# ?? SE ???
$game_system.se_play($data_system.decision_se)
loop_end = false
while loop_end == false
if @visible_index != @main_window.data.size - 1
@visible_index += 1
else
@visible_index = 0
end
loop_end = true if @main_window.show?(@main_window.item_kind,@main_window.data[@visible_index])
end
id = @main_window.data[@visible_index]
@info_window.refresh(id, @main_window.item_kind, @main_window.item_index)
return
end
end
def draw_comp(category=nil)
if SHOW_COMPLETE_TYPE != 0
if category == nil
case SHOW_COMPLETE_TYPE
when 1
s_now = $game_system.skill_book_now
s_max = $game_system.skill_book_max
text = s_now.to_s + "/" + s_max.to_s
when 2
comp = $game_system.skill_book_complete_percentage
text = comp.to_s + "%"
when 3
s_now = $game_system.skill_book_now
s_max = $game_system.skill_book_max
comp = $game_system.skill_book_complete_percentage
text = s_now.to_s + "/" + s_max.to_s + " " + comp.to_s + "%"
end
else
case SHOW_COMPLETE_TYPE
when 1
s_now = $game_system.skill_book_category_now(category)
s_max = $game_system.skill_book_category_max(category)
text = s_now.to_s + "/" + s_max.to_s
when 2
comp = $game_system.skill_book_category_complete_percentage(category)
text = comp.to_s + "%"
when 3
s_now = $game_system.skill_book_category_now(category)
s_max = $game_system.skill_book_category_max(category)
comp = $game_system.skill_book_category_complete_percentage(category)
text = s_now.to_s + "/" + s_max.to_s + " " + comp.to_s + "%"
end
end
if text != nil
@title_window.contents.draw_text(320, 0, 288, 32, text, 2)
end
end
end
end
Wachuga's Maze Generator:
**BEFORE YOU PUT THIS IN, BE SURE TO PUT NEAR FANTASTICA'S DYNAMIC MAPS SCRIPT IN YOUR GAME!!!**
Instructions:
Installation:
This script has a lot of components to it, so I formatted it slightly differently then my other scripts as far as in the class browser goes.
I made an empty class and called it Maze Generator then under that I made a new empty class called ----------------------.
This is because there are four classes to this script, it organizes it a bit to do it like that.
I will list installation instructions along side the spoiler tags this time around.
Usage:
Now in order to use this you must place <rand> in the map name but there are other things as well. First of all these maps can be saved by putting <save> in the name before <rand>.
Now, if you want to control the randomness of the maze (this only does mazes for now, but Wachunga is now working on a full map generator) you have 3 options. the first <#> after <rand> controls the chances of curves and twists. the second <#> after <rand> decreases the number of dead ends. And the last <#> after <rand> increases the chance that dead ends will connect to another pathway.
Examples:
Quote:My Map <rand>
My Map 2 <rand> <2> <5> <1>
Each time you enter or exit a map that doesnt have <save> in it, it will change, so keep that in mind, also, you must place <start> in an event (I put it in the teleport) name where the begging of the maze is, carful though, the entrance and exits have to be in certain areas, otherwise your going to get a warning message when you try to enter it. Same thing with the exit, put <end> in an event name where you want the end to be at (again, I would put it in the teleport).
Make a new one called Game_Map*** and put this in it:
Game_Map***
=begin
======================
Random Map Generator - version 0.51
======================
by Wachunga, based on Jamis Buck's D&D dungeon generator
==============
Instructions
==============
To indicate a map is to be randomly generated, include <rand> in its
name. You may also optionally specify custom randomness, sparsity and
dead end removal parameters to guide how the map is generated
(see comments within for more details). These may also be included
in the map name, as in this example: "XYZ <rand><0.8><5><0.8>"
(from left to right, randomness, sparsity and deadend removal in that order).
Finally, the optional parameter <save> may immediately follow <rand> to
indicate that the map should be generated randomly the first time but then
saved and remain the same thereafter instead of randomizing again.
Events are not erased on the map which will be randomly generated, but
there is no way to guarantee they'll be positioned correctly. (The only
exceptions to this are two events which determine the start and end of the
maze.)
Place an event named <start> to specify a location you'd like the player to
begin the maze (else a default is chosen). To avoid appearing inside a wall,
the start location should not be at any of the four corners of the map nor
any tile where x is even or y is odd (exceptions occur along an edge of the
map, i.e. when x=0, x=width-1, y=0 or y=height-1). The diagram below may
clarify, where discouraged starting points are marked with an X:
y\x 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
0 X X X X X X X X X X X
1 X X X X X X X X X X X X X X X X X X X X
2 X X X X X X X X X
3 X X X X X X X X X X X X X X X X X X X X
4 X X X X X X X X X
5 X X X X X X X X X X X X X X X X X X X X
6 X X X X X X X X X
7 X X X X X X X X X X X X X X X X X X X X
8 X X X X X X X X X
9 X X X X X X X X X X X X X X X X X X X X
10 X X X X X X X X X
11 X X X X X X X X X X X X X X X X X X X X
12 X X X X X X X X X
13 X X X X X X X X X X X X X X X X X X X X
14 X X X X X X X X X X X
(These restrictions are unfortunate, but necessary. Note as well that if
you're not using a wall face then y SHOULD BE even. Either way,
you should get a warning message if you've placed a start/end incorrectly.)
If you want there to be a passage leading off the map, the start location
must be placed on an edge (i.e. x=0, y=0, x=width-1 or y=height-1).
Alternatively, the start and/or exit locations can be somewhere in the
interior of the map... in this case the player arrives/exits by magic,
falling, climbing, etc.
All the above also applies for the exit location, except the event is named
<end>. Again, a default end is chosen if one is not supplied.
Of course, if the player is to be able to exit the map from either of
these two points, you must make the event teleport appropriately.
Also, the teleport into the maze should point at same square as the <start>
event, or else you may get stuck in a wall.
You can specify which tiles to use for the floor, walls, etc in the Maze
class (just add an appropriate 'elsif').
Questions and feedback should be directed to the thread in the
"User-Submitted RGSS Scripts" forum at http://www.rmxp.net/forums
=end
$save_map_list = []
class Game_Map
alias old_setup_map setup_map
def setup_map(map_id)
old_setup_map(map_id)
tags = map_name.delete(' ').scan(/<[A-Za-z0-9_.]+>/) # get all the tags
if not tags.empty? and tags[0].upcase == '<RAND>'
tags.shift # remove the first element
if not tags.empty? and tags[0].upcase == '<SAVE>'
$save_map_list.push(@map_id)
tags.shift
end
if not tags.empty?
for i in 0...tags.length
tags[i] = tags[i].delete("<>").to_f
end
end
startX = 0; startY = 2 # default starting position
endX = @map.width-1; endY = @map.height-1 # default ending position
# note that these defaults haven't yet been tested much
for i in @map.events.keys
if @map.events[i].name.upcase == '<START>'
startX = @map.events[i].x
startY = @map.events[i].y
elsif @map.events[i].name.upcase == '<END>'
endX = @map.events[i].x
endY = @map.events[i].y
end
end
# note that *tags will expand the array, passing individual elements
# (if any) as arguments (randomness, sparsity and chance to remove deadends)
# e.g. if map name includes "<rand><0.5><10><0.6>", then the call is:
# maze = Maze.new( @map.width, @map.height, startX, startY, endX, endY, 0.5, 10, 0.6)
maze = Maze.new( @map.tileset_id, @map.width, @map.height, startX, startY, endX, endY, *tags)
# set these up for teleports into the maze
maze.draw
end
end
def data=(newdata)
@map.data = newdata
end
def map_name
return load_data("Data/MapInfos.rxdata")[@map_id].name
end
end
Now, under that class make a new one called 'Maze' and put this into it:
# prepare the base matrix
@base = Direction_Matrix.new(@width, @height, @startX, @startY, @endX, @endY, pRandomness, pSparsity, pRemovalChance)
# reset everything in the Tile module to 0
Tile.floor = 0
Tile.wall = 0
Tile.wallFace = 0
# prepare the tiles depending on the tileset
if @tileset == 27
Tile.setFloor(2,1) # 384
Tile.setWall(1,2) # 48-95
Tile.setWallFace(4,2) # 401
elsif @tileset == 51
Tile.setFloor(2,2) # 384
Tile.setWall(2,1) # 385
#elsif @tileset == 'y'
# others go here
else
# nothing specified so just use default
Tile.setFloor(2,1) # 384
Tile.setWall(1,2) # 48-95
end
# if no wall face is being used, then Y locations should be ODD (opposite of
# when using a wall face)
if (@startX % 2) == 0 and @startX != 0 and @startX != @width-1
print 'Warning: player may start in a wall (starting X location is even).'
end
if Tile.wallFace != 0
if (@startY % 2) != 0 and @startY != 0 and @startY != @height-1
print 'Warning: player may start in a wall (starting Y location is odd).'
end
else
if (@startY % 2) == 0 and @startY != 0 and @startY != @height-1
print 'Warning: player may start in a wall (starting Y location is even).'
end
end
if (@endX % 2) == 0 and @endX != 0 and @endX != @width-1
print 'Warning: maze end may be unreachable (X location is even).'
end
if Tile.wallFace != 0
if (@endY % 2) != 0 and @endY != 0 and @endY != @height-1
print 'Warning: maze end may be unreachable (Y location is odd).'
end
else
if (@endY % 2) == 0 and @endY != 0 and @endY != @height-1
print 'Warning: maze end may be unreachable (Y location is even).'
end
end
# initialized with all walls
@matrix = Array.new(@width, WALL)
for i in 0...@width
@matrix[i] = Array.new(@height, WALL)
end
setup
end
=begin
Sets up the actual maze from a base matrix of only directions.
(Basic algorithm from Jamis Buck's D&D dungeon generator.)
=end
def setup
for x in 0...@base.width
for y in 0...@base.height
dir = @base.matrix[x][y]
if (dir != 0) # not sparsified
@matrix[x*2+1][y*2+1] = PASSAGE
end
if ((dir & Direction_Matrix::NORTH) != 0)
@matrix[x*2+1][y*2] = PASSAGE
end
if ((dir & Direction_Matrix::WEST) != 0)
@matrix[x*2][y*2+1] = PASSAGE
end
# only necessary for right edge start/exit
if ((dir & Direction_Matrix::EAST) != 0)
@matrix[x*2+2][y*2+1] = PASSAGE
# if extra wall is there, need to "dig deeper"
if (@width % 2) == 0 and x*2+3 == @width-1
@matrix[x*2+3][y*2+1] = PASSAGE
end
end
# only necessary for bottom edge start/exit
if ((dir & Direction_Matrix::SOUTH) != 0)
@matrix[x*2+1][y*2+2] = PASSAGE
# if extra wall is there, need to "dig deeper"
if (@height % 2) == 0 and y*2+3 == @height-1
@matrix[x*2+1][y*2+3] = PASSAGE
end
end
end
end
end
=begin
Display the matrix in an ASCII table (useful for debugging).
(Much more readable if you're using a monospaced font for dialog boxes.)
=end
def display
char_array = Array.new(@width, 0)
for i in 0...@width
char_array[i] = Array.new(@height, 0)
end
for x in 0...@width
for y in 0...@height
tile = @matrix[x][y]
char = ' '
if ((tile == WALL)) then char << '#' end
if ((tile == PASSAGE)) then char << ' ' end
char_array[y][x] = char
end
end
display = ''
for i in 0...@height
display << char_array[i].flatten.to_s << "\n"
end
print display
end
=begin
Draw the maze using the map's tileset.
=end
def draw
newdata = Table.new(@width, @height, 3)
# put down the floor on the first layer (z=0)
z = 0
for x in 0...@width
for y in 0...@height
newdata[x,y,z] = Tile.floor
end
end
# now for the walls on the second layer (z=1)
z = 1
if Tile.wall.type.to_s.upcase != "HASH" # not autotiles
for x in 0...@width
for y in 0...@height
newdata[x,y,z] = Tile.wall if (@matrix[x][y] == WALL)
end
end
else # autotiles...
for x in 0...@width
for y in 0...@height
# skip passages
if (@matrix[x][y] == PASSAGE) then next end
# calculate adjacent walls
adj = ''
if (x == 0)
adj << '147'
else
if (y == 0) then adj << '1'
else
if (@matrix[x-1][y-1] == WALL) then adj << '1' end
end
if (@matrix[x-1][y] == WALL) then adj << '4' end
if (y == @height-1) then adj << '7'
else
if (@matrix[x-1][y+1] == WALL) then adj << '7' end
end
end
if (x == @width-1)
adj << '369'
else
if (y == 0) then adj << '3'
else
if (@matrix[x+1][y-1] == WALL) then adj << '3' end
end
if (@matrix[x+1][y] == WALL) then adj << '6' end
if (y == @height-1) then adj << '9'
else
if (@matrix[x+1][y+1] == WALL) then adj << '9' end
end
end
if (y == 0)
adj << '2'
else
if (@matrix[x][y-1] == WALL) then adj << '2' end
end
if (y == @height-1)
adj << '8'
else
if (@matrix[x][y+1] == WALL) then adj << '8' end
end
# if no adjacent walls, set it as 0
if (adj == '') then adj = '0' end
# convert to an array, sort, and then back to a string
adj = adj.split(//).sort.join
newdata[x,y,z] = eval 'Tile.wall[adj.to_i]'
# show single wall tile beneath bottom-facing walls
if Tile.wallFace > 0
if not adj.include?('8')
newdata[x,y+1,z] = Tile.wallFace
end
end
end # for
end # for
end # if-else
$game_map.data = newdata
end # draw method
end
Under this class make another new one called 'Direction Matrix' and put this into it:
Directional Matrix
=begin
A matrix whose elements each contains 1-4 directions (north, east, south,
west) forming the basis for a maze or dungeon.
(Basic algorithms from Jamis Buck's D&D dungeon generator.)
=end
class Direction_Matrix
NORTH = 0b00001
EAST = 0b00010
SOUTH = 0b00100
WEST = 0b01000
ALL_DIRS = NORTH | EAST | SOUTH | WEST
FLAG = 0b10000
# if even, decrement by 1
@width -= 1 if (pWidth % 2 == 0)
@height -= 1 if (pHeight % 2 == 0)
if @startX != 0
@startX -= 1 if (pStartX % 2 == 0)
end
if @startY != 0
@startY -= 1 if (pStartY % 2 == 0)
end
if @endX != 0
@endX -= 1 if (pEndX % 2 == 0)
end
if @endY != 0
@endY -= 1 if (pEndY % 2 == 0)
end
# handle a weird situation
if @startX >= @width then @startX = @width-1 end
if @endX >= @width then @endX = @width-1 end
@matrix = Array.new(@width, 0)
for i in 0...@width
@matrix[i] = Array.new(@height, 0)
end
generate
# we need the original start/end locations and width/height in these cases
if pStartY == 0
@matrix[@startX][@startY] |= NORTH
elsif pStartX == 0
@matrix[@startX][@startY] |= WEST
elsif (pStartX == @width*2+1 and (pWidth % 2) == 0) or
(pStartX == @width*2 and (pWidth % 2) != 0)
@matrix[@startX][@startY] |= EAST
elsif (pStartY == @height*2+1 and (pHeight % 2) == 0) or
(pStartY == @height*2 and (pHeight % 2) != 0)
@matrix[@startX][@startY] |= SOUTH
end
if pEndY == 0
@matrix[@endX][@endY] |= NORTH
elsif pEndX == 0
@matrix[@endX][@endY] |= WEST
elsif (pEndX == @width*2+1 and (pWidth % 2) == 0) or
(pEndX == @width*2 and (pWidth % 2) != 0)
@matrix[@endX][@endY] |= EAST
elsif (pEndY == @height*2+1 and (pHeight % 2) == 0) or
(pEndY == @height*2 and (pHeight % 2) != 0)
@matrix[@endX][@endY] |= SOUTH
end
sparsify
removeDeadends
end
=begin
The algorithm for generating random mazes is as follows:
(1) randomly pick a starting tile from the map
(2) pick a random direction and move that way as long as there
is a new tile in that direction and hasn't been visited yet
(3) perform (2) until there is no valid direction to move in, then
pick a new tile that HAS been visited before and perform (2)
and (3) until all the tiles have been visited
=end
def generate
testedDirs = lastDir = straightStretch = 0
x = @startX
y = @startY
remaining = @width * @height - 1
# loop for all remaining tiles
while (remaining > 0)
if (testedDirs == ALL_DIRS)
# we're stuck so choose an already-visited tile
while true
x = rand(@width)
y = rand(@height)
break if @matrix[x][y] != 0
end
testedDirs = @matrix[x][y]
end
# eliminate impossible directions
if (x < 1) then testedDirs |= WEST
elsif (x+1 > @width) then testedDirs |= EAST
end
if (y < 1) then testedDirs |= NORTH
elsif (y+1 > @height) then testedDirs |= SOUTH
end
randomSelection = false
# depending on randomness parameter of map,
# either select direction randomly or continue straight
# (but no stretch can be longer than half the width/height)
if ( rand < @randomness)
randomSelection = true
else
case lastDir
when NORTH
if ( y>0 and straightStretch < @height/2 and @matrix[x][y-1]==0 )
direction = lastDir
else randomSelection = true
end
when EAST
if ( x+1<@width and straightStretch < @width/2 and @matrix[x+1][y]==0 )
direction = lastDir
else randomSelection = true
end
when SOUTH
if ( y+1<@height and straightStretch < @height/2 and @matrix[x][y+1]==0 )
direction = lastDir
else randomSelection = true
end
when WEST
if ( x>0 and straightStretch < @width/2 and @matrix[x-1][y]==0 )
direction = lastDir
else randomSelection = true
end
else randomSelection = true
end
end
if (randomSelection)
# reset
direction = 0
straightStretch = 0
# pick random direction
# keep trying until a valid one is found
while ( (direction == 0) or ((testedDirs & direction) != 0) )
temp_x = x
temp_y = y
case rand(4)
when 0 # north
if (y > 0) then direction = NORTH; temp_y-=1
else testedDirs |= NORTH
end
when 1 # east
if (x+1 < @width) then direction = EAST; temp_x+=1
else testedDirs |= EAST
end
when 2 # south
if (y+1 < @height) then direction = SOUTH; temp_y+=1
else testedDirs |= SOUTH
end
when 3 # west
if (x > 0) then direction = WEST; temp_x-=1
else testedDirs |= WEST
end
end
# check next square to ensure it's valid
if ( @matrix[temp_x][temp_y] != 0 )
# record direction as tested
testedDirs |= direction
# if all directions are invalid, impossible to
# select random direction so break out
if (testedDirs == ALL_DIRS) then break end
direction = 0
end
end
else
straightStretch+=1
end
# if all directions are tested, move on to next
# iteration where an already-visited tile will be picked
if (testedDirs == ALL_DIRS) then next end
lastDir = direction
# set selected direction in maze at both current tile
# and destination tile
@matrix[x][y] |= direction
case direction
when NORTH then y-=1; direction = SOUTH
when EAST then x+=1; direction = WEST
when SOUTH then y+=1; direction = NORTH
when WEST then x-=1; direction = EAST
end
@matrix[x][y] |= direction
testedDirs = @matrix[x][y]
remaining-=1
end
end
=begin
Sparsify the maze by the given amount ("sparsity") representing the
number of times to sparsify (i.e. shorten deadends, creating empty areas so the
maze isn't perfectly dense).
A smaller maze will sparsify faster than a larger maze, so the smaller the maze,
the smaller the number should be to accomplish the same relative amount of "sparsification".
=end
def sparsify
for i in 0...@sparsity
for x in 0...@width
for y in 0...@height
# don't sparsify from the beginning or end points --
# this guarantees a solution to the maze
if (x == @startX) and (y == @startY) then next end
if (x == @endX) and (y == @endY) then next end
dir = @matrix[x][y]
# if only one direction, found a deadend
# so otherwise, go to next tile
if not [NORTH, EAST, SOUTH, WEST].include?(dir)
next
end
# remove deadend
@matrix[x][y] = 0
# for previous tile, remove direction to removed deadend
# also temporarily flag it as visited so any new deadends
# created aren't sparsified in the same pass
case dir
when NORTH
@matrix[x][y-1] &= ~SOUTH
@matrix[x][y-1] |= FLAG
when EAST
@matrix[x+1][y] &= ~WEST
@matrix[x+1][y] |= FLAG
when SOUTH
@matrix[x][y+1] &= ~NORTH
@matrix[x][y+1] |= FLAG
when WEST
@matrix[x-1][y] &= ~EAST
@matrix[x-1][y] |= FLAG
end
end
end
# clear the flags for the next sparsifying pass
for x in 0...@width
for y in 0...@height
@matrix[x][y] &= ~FLAG
end
end
end
end
=begin
Display the matrix in an ASCII table (useful for debugging)
(Much more readable if you're using a monospaced font for dialog boxes.)
=end
def display
char_array = Array.new(@width, 0)
for i in 0...@width
char_array[i] = Array.new(@height, 0)
end
for x in 0...@width
for y in 0...@height
dir = @matrix[x][y]
char = '['
if ((dir & NORTH) != 0) then char << 'N' else char << ' ' end
if ((dir & EAST) != 0) then char << 'E' else char << ' ' end
if ((dir & WEST) != 0) then char << 'W' else char << ' ' end
if ((dir & SOUTH) != 0) then char << 'S' else char << ' ' end
char << ']'
char_array[y][x] = char
end
end
display = ''
for i in 0...@height
display << char_array[i].flatten.to_s << "\n"
end
print display
end
=begin
Clears the given percentage ("removalChance") of deadends from the maze by
causing the deadends to extend until they hit another passage. As this
causes cycles in the maze, it can result in multiple possible solutions
to the maze (but makes it seem more natural).
=end
def removeDeadends
for x in 0...@width
for y in 0...@height
dir = @matrix[x][y]
# if only one direction, found a deadend
# so otherwise, go to next tile
if not [NORTH, EAST, SOUTH, WEST].include?(dir)
next
end
# random roll to see if this deadend is skipped
if (rand > @removalChance) then next end
cur_x = x; cur_y = y
back_dir = dir
# continue as long as new corridor not reached
while (@matrix[cur_x][cur_y] == back_dir)
direction = 0
testedDirs = 0
# pick random direction
# keep trying until a valid one is found
while (direction == 0)
temp_x = cur_x
temp_y = cur_y
case rand(4)
when 0 # north
if (cur_y > 0) then direction = NORTH; back_dir = SOUTH; temp_y-=1
else testedDirs |= NORTH
end
when 1 # east
if (cur_x+1 < @width) then direction = EAST; back_dir = WEST; temp_x+=1
else testedDirs |= EAST
end
when 2 # south
if (cur_y+1 < @height) then direction = SOUTH; back_dir = NORTH; temp_y+=1
else testedDirs |= SOUTH
end
when 3 # west
if (cur_x > 0) then direction = WEST; back_dir = EAST; temp_x-=1
else testedDirs |= WEST
end
end
# check if deadend tile already goes this way
if ( @matrix[cur_x][cur_y] == direction )
# record direction as tested
testedDirs |= direction
direction = 0
end
# if all directions are invalid, impossible to
# select random direction so break out
if (testedDirs == ALL_DIRS) then break end
end
if (testedDirs == ALL_DIRS) then break end
# add new direction to deadend
@matrix[cur_x][cur_y] |= direction
# add new direction to tile adjacent to deadend
@matrix[temp_x][temp_y] |= back_dir
# move on to next tile
cur_x = temp_x; cur_y = temp_y
end
end
end
end
end
Now, under this class put one more called 'Tile' and then put this script into that:
Tile
module Tile
@floor = 0
@wallFace = 0
@wall = 0
# to be extended with others to make maps "pretty", e.g. random ground features
=begin
The following array lists systematic keys which are based on adjacent
walls (where 'W' is the wall itself):
1 2 3
4 W 6
7 8 9
e.g. 268 is the key that will be used to refer to the autotile
which has adjacent walls north, east, and south. For the Castle Prison
tileset (autotile #1), this is 67.
def Tile.setFloor(row, col)
if row > 1
@floor = Tile.index(row, col)
else # autotiles
@floor = Hash.new(0)
j = Tile.index(row, col)
for i in Autotile_Keys
@floor[i] = j
j += 1
end
# add duplicates
for i in Duplicate_Keys.keys
@floor[i] = @floor[Duplicate_Keys[i]]
end
end
end
def Tile.floor
@floor
end
def Tile.floor=(value)
@floor = value
end
def Tile.wall=(value)
@wall = value
end
def Tile.wallFace=(value)
@wallFace = value
end
def Tile.setWallFace(row, col)
if row > 1
@wallFace = Tile.index(row, col)
else # autotiles
@wallFace = Hash.new(0)
j = Tile.index(row, col)
for i in Autotile_Keys
@wallFace[i] = j
j += 1
end
# add duplicates
for i in Duplicate_Keys.keys
@wallFace[i] = @wallFace[Duplicate_Keys[i]]
end
end
end
def Tile.wallFace
@wallFace
end
def Tile.setWall(row, col)
if row > 1
@wall = Tile.index(row, col)
else # autotiles
@wall = Hash.new(0)
j = Tile.index(row, col)
for i in Autotile_Keys
@wall[i] = j
j += 1
end
# add duplicates
for i in Duplicate_Keys.keys
@wall[i] = @wall[Duplicate_Keys[i]]
end
end
end
def Tile.wall
@wall
end
=begin
This method returns the index of a specific tile in the tileset,
or the base index for one of the 7 autotiles.
Parameters:
row - row where the tile is found within the tileset ( 1+ )
col - column where the tile is found within the tileset ( 1-8 )
Note: this method is NOT zero-indexed, i.e. rows and columns start at 1
e.g.
index(1,2) returns 48
index(2,1) returns 384
index(4,8) returns 407
By the way, here's an example of how autotile indexes work...
The function to return the index of a single tile within an autotile
(given by at_index) is (at_index-1)*48 + col-1 + (row-1)*8
(where row, col, and at_index are again NOT zero-indexed)
=end
def Tile.index(row, col)
if row > 1 # if not autotiles
return 383 + col + 8*(row-2)
else
return (col-1)*48
end
end
not sure what you mean by "destroyed" -- the old rmxp.org is still going under a different name, and this is a fairly recent newcomer. the other places have been fairly turmoil-free, too.
unless you're talking about this site being hacked, but that didn't really delete that much!
cool finds, though. the maze generator sounds particularly interesting, although I hope it's not just a reprise of VX's silly dungeon generator.
Put this script in a new class called Dynamic Shadows. Put it over both the Sun Effects Script and Wachungaââ¬â¢s Fog of War script if you are using it. Script is in the spoiler tags.
Usage:
Ok, jusââ¬â¢ an FYI, this script is caterpillar compatible. Its quite simple to use actually. I find it easier though to write down all the different commands to the scripts I have implemented, for easy reference, so I suggest you do the same. Now, here are the commands that you will need to use in order to use this script:
**All of these commands go into comments in the events, also, donââ¬â¢t capitalize any of the commands at any point, otherwise it wont work**
Quote:begin shadow source ââ¬â starts a source of light in an event
begin shadow ââ¬â starts shadows for an event (party members all have this automatically)
Now, put these in comments only if you have selected the event to be a source:
Quote:anglemin (number between 0 and 360. Example: anglemin 0)- sets angle of rotation
anglemax (number between 0 and 360. Example: anglemax 360) ââ¬â sets angle of rotation
distancemax (number)- sets how far the shadow will show up.
And thatââ¬â¢s all there is to it. Just remember Geometry; this script works in angles, 180 being half way around, and 360 being all the way around.
There is currently a bug that causes shadows to get ââ¬Åstuckââ¬Â on the top of the window as you move down away from them.
Dynamic Shadows
#==============================================================================
# ? Sprite_Shadow (Sprite_Ombre )
# Based on Genzai Kawakami's shadows, dynamisme&features by Rataime, extra features Boushy
#==============================================================================
CATERPILLAR_COMPATIBLE = true
SHADOW_WARN = true
class Game_Party
attr_reader :characters
end
class Sprite_Shadow < RPG::Sprite
attr_accessor :character
def initialize(viewport, character = nil,id=0)
super(viewport)
params=$shadow_spriteset.shadows[id]
@source=params[0]
@anglemin=0
@anglemin=params[1] if params.size>1
@anglemax=0
@anglemax=params[2] if params.size>2
@self_opacity=100
@self_opacity=params[4] if params.size>4
@distancemax=350
@distancemax=params[3] if params.size>3
@character = character
update
end
def update
if !in_range?(@character, @source, @distancemax)
self.opacity=0
return
end
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
if self.angle>90 or angle<-90
if @character.direction== 6
sy = ( 4- 2) / 2 * @ch
end
if @character.direction== 4
sy = ( 6- 2) / 2 * @ch
end
if @character.direction== 2
sy = ( 8- 2) / 2 * @ch
end
if @character.direction== 8
sy = ( 2- 2) / 2 * @ch
end
end
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = @character.screen_y-5
self.z = @character.screen_z(@ch)-1
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
@deltax=@source.screen_x-self.x
@deltay= @source.screen_y-self.y
self.color = Color.new(0, 0, 0)
@distance = ((@deltax ** 2) + (@deltay ** 2))
self.opacity = @self_opacity*13000/((@distance*370/@distancemax)+6000)
self.angle = 57.3*Math.atan2(@deltax, @deltay )
@angle_trigo=self.angle+90
if @angle_trigo<0
@angle_trigo=360+@angle_trigo
end
if @anglemin !=0 or @anglemax !=0
if (@angle_trigo<@anglemin or @angle_trigo>@anglemax) and @anglemin<@anglemax
self.opacity=0
return
end
if (@angle_trigo<@anglemin and @angle_trigo>@anglemax) and @anglemin>@anglemax
self.opacity=0
return
end
end
end
def in_range?(element, object, range)# From Near's Anti Lag Script, edited
x = (element.screen_x - object.screen_x) * (element.screen_x - object.screen_x)
y = (element.screen_y - object.screen_y) * (element.screen_y - object.screen_y)
r = x + y
if r <= (range * range)
return true
else
return false
end
end
end
#===================================================
# ? CLASS Sprite_Character edit
#===================================================
class Sprite_Character < RPG::Sprite
alias shadow_initialize initialize
def initialize(viewport, character = nil)
@character = character
super(viewport)
@ombrelist=[]
if character.is_a?(Game_Event) and $shadow_spriteset.shadows!=[]
params = XPML_read("Shadow",@character.id,4)
if params!=nil
for i in 0...$shadow_spriteset.shadows.size
@ombrelist.push(Sprite_Shadow.new(viewport, @character,i))
end
end
end
if character.is_a?(Game_Player) and $shadow_spriteset.shadows!=[]
for i in 0...$shadow_spriteset.shadows.size
@ombrelist.push(Sprite_Shadow.new(viewport, $game_player,i))
end
#===================================================
# ? Compatibility with fukuyama's caterpillar script
#===================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil
for member in $game_party.characters
for i in 0...$shadow_spriteset.shadows.size
@ombrelist.push(Sprite_Shadow.new(viewport, member,i))
end
end
end
#===================================================
# ? End of the compatibility
#===================================================
end
shadow_initialize(viewport, @character)
end
alias shadow_update update
def update
shadow_update
if @ombrelist!=[]
for i in 0...@ombrelist.size
@ombrelist[i].update
end
end
end
end
#===================================================
# ? CLASS Game_Event edit
#===================================================
class Game_Event
attr_accessor :id
end
#===================================================
# ? CLASS Spriteset_Map edit
#===================================================
class Spriteset_Map
attr_accessor :shadows
alias shadow_initialize initialize
def initialize
$shadow_spriteset=self
@shadows=[]
warn=false
for k in $game_map.events.keys.sort
warn=true if ($game_map.events[k].list!=nil and $game_map.events[k].list[0].code == 108 and ($game_map.events[k].list[0].parameters == ["s"] or $game_map.events[k].list[0].parameters == ["o"]))
params = XPML_read("Shadow Source",k,4)
$shadow_spriteset.shadows.push([$game_map.events[k]]+params) if params!=nil
end
p "Warning : At least one event on this map uses the obsolete way to add shadows" if warn == true and SHADOW_WARN
shadow_initialize
end
end
#===================================================
# ? XPML Definition, by Rataime, using ideas from Near Fantastica
#
# Returns nil if the markup wasn't present at all,
# returns [] if there wasn't any parameters, else
# returns a parameters list with "int" converted as int
# eg :
# begin first
# begin second
# param1 1
# param2 two
# begin third
# anything 3
#
# p XPML_read("first", event_id) -> []
# p XPML_read("second", event_id) -> [1,"two"]
# p XPML_read("third", event_id) -> [3]
# p XPML_read("forth", event_id) -> nil
#===================================================
def XPML_read(markup,event_id,max_param_number=0)
parameter_list = nil
event=$game_map.events[event_id]
return if event.list==nil
for i in 0...event.list.size
if event.list[i].code == 108 and event.list[i].parameters[0].downcase == "begin "+markup.downcase
parameter_list = [] if parameter_list == nil
for j in i+1...event.list.size
if event.list[j].code == 108
parts = event.list[j].parameters[0].split
if parts.size!=1 and parts[0].downcase!="begin"
if parts[1].to_i!=0 or parts[1]=="0"
parameter_list.push(parts[1].to_i)
else
parameter_list.push(parts[1])
end
else
return parameter_list
end
else
return parameter_list
end
return parameter_list if max_param_number!=0 and j==i+max_param_number
end
end
end
return parameter_list
end
Rataime's Sun Effects Script :
Instructions:
Installation:
Put this script in a new class called Dynamic Shadows. Put it under the Dynamic Shadows Script and over Wachungaââ¬â¢s Fog of War script if you are using it. Script is in the spoiler tags.
Usage:
Same as before, this script is Caterpillar compatible. Place this in a class under the Dynamic Shadows script (you should use both of them). Again, some commands, make sure you put them in comments inside an empty event in maps where you want a sun:
Quote:begin sun ââ¬â starts a sun
(optional)
angle (number between ââ¬â180 and 180)
opacity (number between 0 and 255, sets darkness of shadow)
You can also have 2 suns or more by making another even using begin sun and setting an angle for the second, third, ect.
Sun Effects
#==============================================================================
# ? Sprite_Sun
# # Based on Sprite_Shadow, modified by Rataime
#==============================================================================
CATERPILLAR_COMPATIBLE = true
SUN_WARN =true
class Game_Party
attr_reader :characters
end
class Sprite_Sun < RPG::Sprite
attr_accessor :character
def initialize(viewport, character = nil,id=0)
super(viewport)
@character = character
params=$sun_spriteset.sun[id]
self_angle=45
self_angle=params[0] if params.size>0
self_opacity=128
self_opacity=params[1] if params.size>1
@self_angle=self_angle
@self_opacity=self_opacity
update
end
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.character_name or
@character_hue != @character.character_hue
@tile_id = @character.tile_id
@character_name = @character.character_name
@character_hue = @character.character_hue
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.character_hue)
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.character_name,
@character.character_hue)
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
@direct=@character.direction
if self.angle>90 or angle<-90
if @direct== 6
sy = ( 4- 2) / 2 * @ch
end
if @direct== 4
sy = ( 6- 2) / 2 * @ch
end
if @direct != 4 and @direct !=6
sy = (@character.direction - 2) / 2 * @ch
end
else
sy = (@character.direction - 2) / 2 * @ch
end
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = @character.screen_y-5
self.z = @character.screen_z(@ch)-1
self.opacity = @self_opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
self.angle = @self_angle.to_i-90
self.color = Color.new(0, 0, 0)
end
end
#===================================================
# ? CLASS Sprite_Character edit
#===================================================
class Sprite_Character < RPG::Sprite
alias sun_initialize initialize
def initialize(viewport, character = nil)
@character = character
super(viewport)
@sunlist=[]
if character.is_a?(Game_Event) and $sun_spriteset.sun!=[]
params = XPML_read("Shadow",@character.id,2)
if params!=nil
for i in 0...$sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, @character,i))
end
end
end
if character.is_a?(Game_Player) and $sun_spriteset.sun!=[]
for i in 0...$sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, $game_player,i))
end
#===================================================
# ? Compatibility with fukuyama's caterpillar script
#===================================================
if CATERPILLAR_COMPATIBLE and $game_party.characters!=nil
for member in $game_party.characters
for i in 0...$sun_spriteset.sun.size
@sunlist.push(Sprite_Sun.new(viewport, member,i))
end
end
end
#===================================================
# ? End of the compatibility
#===================================================
end
sun_initialize(viewport, @character)
end
alias sun_update update
def update
sun_update
if @sunlist!=[]
for i in 0...@sunlist.size
@sunlist[i].update
end
end
end
end
#===================================================
# ? CLASS Game_Event edit
#===================================================
class Game_Event
attr_accessor :id
end
#===================================================
# ? CLASS Spriteset_Map edit
#===================================================
class Spriteset_Map
attr_accessor :sun
alias sun_initialize initialize
def initialize
@sun=[]
$sun_spriteset=self
warn=false
for k in $game_map.events.keys.sort
warn=true if ($game_map.events[k].list!=nil and $game_map.events[k].list[0].code == 108 and ($game_map.events[k].list[0].parameters == ["sun"] or $game_map.events[k].list[0].parameters == ["o"]))
params = XPML_read("Sun",k,2)
$sun_spriteset.sun.push(params) if params!=nil
end
p "Warning : At least one event on this map uses the obsolete way to add a sun effect" if warn == true and SUN_WARN
sun_initialize
end
end
#===================================================
# ? XPML Definition, by Rataime, using ideas from Near Fantastica
#
# Returns nil if the markup wasn't present at all,
# returns [] if there wasn't any parameters, else
# returns a parameters list with "int" converted as int
# eg :
# begin first
# begin second
# param1 1
# param2 two
# begin third
# anything 3
#
# p XPML_read("first", event_id) -> []
# p XPML_read("second", event_id) -> [1,"two"]
# p XPML_read("third", event_id) -> [3]
# p XPML_read("forth", event_id) -> nil
#===================================================
def XPML_read(markup,event_id,max_param_number=0)
parameter_list = nil
event=$game_map.events[event_id]
return if event.list==nil
for i in 0...event.list.size
if event.list[i].code == 108 and event.list[i].parameters[0].downcase == "begin "+markup.downcase
parameter_list = [] if parameter_list == nil
for j in i+1...event.list.size
if event.list[j].code == 108
parts = event.list[j].parameters[0].split
if parts.size!=1 and parts[0].downcase!="begin"
if parts[1].to_i!=0 or parts[1]=="0"
parameter_list.push(parts[1].to_i)
else
parameter_list.push(parts[1])
end
else
return parameter_list
end
else
return parameter_list
end
return parameter_list if max_param_number!=0 and j==i+max_param_number
end
end
end
return parameter_list
end
SephirothSpawn's Dynamic bank Script:
Instructions:
Installation:
Now, make a new class above 'Main' and cal it Dynamic Banks then add the spoilered script into it.
Usage:
This is a very interesting little script. It calculates interest so whenever you leave money in the bank, it will accrue interest.
Now, to call this use this in a call script:
Quote:$scene = Scene_Bank.new
Now, to adjust this to your needs you can edit these lines:
these lines effect your initial balance, and interest rate, what savings bonds you already have, and the amount of time that has passed for your bonds and interest:
These lines affect the amount of time it takes to update your balance with the interest, and how much the interest adds to your total amount of money. Note that the 3600 is in seconds:
finally, these allow you to modify the bonds. Hereââ¬â¢s a break down of how the bonds are set up above:
Quote:bonds = [ Savings_Bond.new("Bond Name", Bond Cost, Bond Intrest, Time for Bond to Mature )])
Now, if you want each bank to be different, then you can do this in the call script:
Quote:bonds = [ Savings_Bond.new("Bond Name", Bond Cost, Bond Intrest, Time for Bond to Mature )])
$scene = Scene_Bank.new(intrest)
so, in this exapmle, we want 2 custom bonds and a new intrest rate:
Quote:bonds = [Savings_Bond.new("Custom Bond 1", 10000, 30, 5), Savings_Bond.new("Custom Bond 2", 20000, 60, 10)])
$scene = Scene_Bank.new (10)
we now have 2 custom bonds and the interest rate will be set to 10%. Custom bond 1 will cost 10,000 gold, increase by 30% at maturity and take 5 hours of game play to mature, while custom bond 2 will cost 20,000 gold, increase by 60% at maturity and take 10 hours of game play to mature.
Dynamic Banks
#==============================================================================
# Banking System
#--------------------------------------------------------------------------
# Created By SephirothSpawn (12.05.05)
# Last Updated: 12.06.05
#==============================================================================
#==============================================================================
# ** Scene_Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias Command: New Game
#--------------------------------------------------------------------------
alias bank_command_new_game command_new_game
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
$game_bank = Game_BankSystem.new
bank_command_new_game
end
end
#==============================================================================
# ** Window_RefreshCommand
#==============================================================================
class Window_RefreshCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
# Compute window height from command quantity
super(0, 0, width, commands.size * 32 + 32)
@item_max = commands.size
@commands = commands
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh(commands = @commands)
@commands = commands
@item_max = commands.size
if self.contents != nil
self.contents.dispose
self.contents = nil
end
self.contents = Bitmap.new(width - 32, @item_max * 32)
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
self.contents.draw_text(0, 32 * index, self.contents.width - 8, 32, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Undisable Item
# index : item number
#--------------------------------------------------------------------------
def undisable_item(index)
draw_item(index, normal_color)
end
end
mawk Wrote:not sure what you mean by "destroyed" -- the old rmxp.org is still going under a different name, and this is a fairly recent newcomer. the other places have been fairly turmoil-free, too.
unless you're talking about this site being hacked, but that didn't really delete that much!
cool finds, though. the maze generator sounds particularly interesting, although I hope it's not just a reprise of VX's silly dungeon generator.
hmm, I did not know that (about the old RMXP, I tried rmxp.net but the site is gone. Last I knew that is where they were at.)
rmxp.net went through tons of administration changes and is now called hbgames.org. this is a fairly new site using the old domain name, but a lot of the members are longtime rm users.
Create a new class above ââ¬ÅMainââ¬Â and place the spoiler script into it. If you are using Rataime's Sun/Shadow scripts, please place the new class for this under those.
Next right click on the following image and save asââ¬Â¦
Then import it into your database in RMXP. This is the FOW tile, its required for the script to work.
My ââ¬ÅSmokeââ¬Â edit:
Usage:
Ok, now, before we get into too much here, please be aware that there is a newer version of this but I am using this older one.
Now to use this place <FOW> into the map name of the map that you want to use it on.
You can customize it a bit by adding a <#> after the <FOW> (# = 1-3). Each sequential number adds more view tiles to the area that you uncover as you walk through the FOW.
Fog of War
=begin
============
Fog of War - version 1.01 (2005-11-04)
============
by Wachunga
0.8 - original release
0.85
- added colour parameter to map names
- fixed bug where map grids overlapped
0.9
- switched over to a tilemap (from a sprite)
- now more compatible with minimap scripts (but they'll have to take
extra tilemap into account)
1.0
- switched over to an autotile instead of using a custom tileset
* edges looks nicer, but gradual fading had to be removed
* colour parameter no longer possible (set by autotile)
- move event (including jumping and speed changes) bug fixed
- teleportation bug fixed
- some optimization
- made compatible with Cogwheel's Pixel Movement script
(see http://www.rmxp.net/forums/index.php?showtopic=24716 for details)
1.01
- fixed bug when teleporting from map without FoW to a map with FoW
Note:
There's no need to add the autotile via the database. Just place the file in
the autotile folder, import it, and change the FOW_AT_NAME constant to
the appropriate filename. To change the colour of the fog of war, create a
new autotile.
To indicate a map is to have fog of war (i.e. its tiles are dark until
the player gets within visual range), include <FoW> in its name. You may
also optionally specify a range between 0 and 3. This may also be
included in the map name, as in this example:
"your-map-name <FoW><2>" (range is 2)
The ranges work as follows:
range = 0 reveals just the square on which the player stands
range = 1 is the same as range 0 plus four adjacent tiles
i.e. @
@P@
@
range = 2 is the same as range 1 plus eight additional tiles
i.e. @
@@@
@@P@@
@@@
@
range = 3 (default) is the same as range 2 plus twelve additional tiles
i.e. @
@@@
@@@@@
@@@P@@@
@@@@@
@@@
@
=end
alias dm_setup setup_map
def setup_map(map_id)
dm_setup(map_id)
# set defaults
@fow_on = false
@fow_grid = nil
@fow_range = 3
# get any tags from the map name
tags = $game_map.map_name.delete(' ').scan(/<[A-Za-z0-9_.,]+>/)
if not tags.empty? and tags[0].upcase == '<FOW>'
tags.shift # remove FOW tag
@fow_on = true
if @fow_grid == nil # only if not already defined
@fow_grid = Array.new(@map.width, FOW)
for i in 0...@map.width
@fow_grid[i] = Array.new(@map.height, FOW)
end
end
# check if range specified, else default to 3
if not tags.empty?
x = tags[0].delete("<>").to_i
@fow_range = x if x >= 0 and x < 4
end
end
end
=begin
Updates the underlying grid which keeps track of which tiles have been
"discovered" (i.e. no fog of war) based on where player has already explored.
=end
def update_fow_grid
px = $game_player.x
py = $game_player.y
@fow_grid[px][py] |= REVEALED
# reveal more, depending on range
if @fow_range > 0
if px > 0
@fow_grid[px-1][py] |= REVEALED
end
if py < @map.height-1
@fow_grid[px][py+1] |= REVEALED
end
if py > 0
@fow_grid[px][py-1] |= REVEALED
end
if px < @map.width-1
@fow_grid[px+1][py] |= REVEALED
end
if @fow_range > 1
if px > 0
if py > 0
@fow_grid[px-1][py-1] |= REVEALED
end
if py < @map.height-1
@fow_grid[px-1][py+1] |= REVEALED
end
if px > 1
@fow_grid[px-2][py] |= REVEALED
end
end
if px < @map.width-1
if py > 0
@fow_grid[px+1][py-1] |= REVEALED
end
if py < @map.height-1
@fow_grid[px+1][py+1] |= REVEALED
end
end
if px < @map.width-2
@fow_grid[px+2][py] |= REVEALED
end
if py > 1
@fow_grid[px][py-2] |= REVEALED
end
if py < @map.height-2
@fow_grid[px][py+2] |= REVEALED
end
if @fow_range > 2
if px > 0
if py > 1
@fow_grid[px-1][py-2] |= REVEALED
end
if py < @map.height-2
@fow_grid[px-1][py+2] |= REVEALED
end
if px > 1
if py > 0
@fow_grid[px-2][py-1] |= REVEALED
end
if py < @map.height-1
@fow_grid[px-2][py+1] |= REVEALED
end
if px > 2
@fow_grid[px-3][py] |= REVEALED
end
end
end
if px < @map.width-1
if py > 1
@fow_grid[px+1][py-2] |= REVEALED
end
if py < @map.height-2
@fow_grid[px+1][py+2] |= REVEALED
end
if px < @map.width-2
if py > 0
@fow_grid[px+2][py-1] |= REVEALED
end
if py < @map.height-1
@fow_grid[px+2][py+1] |= REVEALED
end
if px < @map.width-3
@fow_grid[px+3][py] |= REVEALED
end
end
end
if py > 2
@fow_grid[px][py-3] |= REVEALED
end
if py < @map.height-3
@fow_grid[px][py+3] |= REVEALED
end
end
end
end
end
def map_name
return load_data("Data/MapInfos.rxdata")[@map_id].name
end
def initialize
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
@fog = Plane.new(@viewport1)
@fog.z = 3000
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
# add fog of war tilemap...
if $game_map.fow_on
for m in 0...$game_map.width
for n in 0...$game_map.height
# reset SKIP flag
$game_map.fow_grid[m][n] &= ~SKIP
end
end
@fow_tilemap = Tilemap.new(@viewport1)
@fow_tilemap.autotiles[0] = RPG::Cache.autotile(FOW_AT_NAME)
@fow_autotiles = Hash.new(0)
j = 48 # starting autotile index
for i in Autotile_Keys
@fow_autotiles[i] = j
j += 1
end
# add duplicates
for i in Duplicate_Keys.keys
@fow_autotiles[i] = @fow_autotiles[Duplicate_Keys[i]]
end
data = Table.new($game_map.width, $game_map.height, 3)
# set everything to fog
for x in 0...$game_map.width
for y in 0...$game_map.height
data[x,y,2] = 48 # fog
end
end
@fow_tilemap.map_data = data
priorities = Table.new(96)
# set to highest priority to ensure everything is covered
for i in 48...96
priorities[i] = 5
end
@fow_tilemap.priorities = priorities
$game_map.update_fow_grid
update_fow_tilemap # reveal any explored tiles
end
update
end
=begin
Updates the fog of war tilemap based on the map's underlying grid.
This method is called by Game_Player.update whenever the player moves.
=end
def update_fow_tilemap
checked = Array.new($game_map.width,0)
for k in 0...$game_map.width
checked[k] = Array.new($game_map.height,0)
end
for x in (($game_map.display_x/128)-1).round .. (($game_map.display_x/128)+21).round
for y in (($game_map.display_y/128)-1).round .. (($game_map.display_y/128)+16).round
# check boundaries
if x > $game_map.width - 1 or x < 0 then next end
if y > $game_map.height - 1 or y < 0 then next end
if $game_map.fow_grid[x][y] == REVEALED # (but not SKIP)
others = false
@fow_tilemap.map_data[x,y,2] = 0 if @fow_tilemap.map_data[x,y,2] != 0
for i in x-1 .. x+1
for j in y-1 .. y+1
# check new boundaries
if i > $game_map.width - 1 or i < 0 then next end
if j > $game_map.height - 1 or j < 0 then next end
if $game_map.fow_grid[i][j] == FOW
others = true # can't flag as SKIP because there's nearby fog
if checked[i][j] == 0
checked[i][j] = 1
# only fill if not already revealed
if @fow_tilemap.map_data[i,j,2] != 0
# calculate adjacent fog
adj = ''
if (i == 0)
adj << '147'
else
if (j == 0) then adj << '1'
else
if ($game_map.fow_grid[i-1][j-1] == FOW) then adj << '1' end
end
if ($game_map.fow_grid[i-1][j] == FOW) then adj << '4' end
if (j == $game_map.height-1) then adj << '7'
else
if ($game_map.fow_grid[i-1][j+1] == FOW) then adj << '7' end
end
end
if (i == $game_map.width-1)
adj << '369'
else
if (j == 0) then adj << '3'
else
if ($game_map.fow_grid[i+1][j-1] == FOW) then adj << '3' end
end
if ($game_map.fow_grid[i+1][j] == FOW) then adj << '6' end
if (j == $game_map.height-1) then adj << '9'
else
if ($game_map.fow_grid[i+1][j+1] == FOW) then adj << '9' end
end
end
if (j == 0)
adj << '2'
else
if ($game_map.fow_grid[i][j-1] == FOW) then adj << '2' end
end
if (j == $game_map.height-1)
adj << '8'
else
if ($game_map.fow_grid[i][j+1] == FOW) then adj << '8' end
end
# if no adjacent fog, set it as 0
if (adj == '') then adj = '0' end
# convert to an array, sort, and then back to a string
adj = adj.split(//).sort.join
@fow_tilemap.map_data[i,j,2] = eval '@fow_autotiles[adj.to_i]'
end
end
end
end
end
if not others
# no adjacent fog found, so flag tile to prevent processing again
$game_map.fow_grid[x][y] |= SKIP
end
end
end
end
end
alias old_dispose dispose
def dispose
if @fow_tilemap != nil
@fow_tilemap.dispose
end
old_dispose
end
alias old_update update
def update
if $game_map.fow_on == true
@fow_tilemap.ox = $game_map.display_x / 4
@fow_tilemap.oy = $game_map.display_y / 4
@fow_tilemap.update
end
old_update
end
end
def initialize
super
@last_x = @x
@last_y = @y
end
def update_jump
super
# only update when about to land, not revealing anything jumped over
if $game_map.fow_on and @jump_count == 0
$game_map.update_fow_grid
$scene.spriteset.update_fow_tilemap
end
end
def update_move
super
if $game_map.fow_on and (@x != @last_x or @y != @last_y)
unless jumping?
$game_map.update_fow_grid
$scene.spriteset.update_fow_tilemap
end
end
@last_x = @x
@last_y = @y
end
The function to return the index of a single tile within an autotile
(given by at_index) is (at_index-1)*48 + col-1 + (row-1)*8
(where row, col, and at_index are again NOT zero-indexed)
=end
=begin
The following array lists systematic keys which are based on adjacent
walls (where 'W' is the wall itself):
1 2 3
4 W 6
7 8 9
e.g. 268 is the key that will be used to refer to the autotile
which has adjacent walls north, east, and south. For the Castle Prison
tileset (autotile #1), this is 67.
Now, create a new class above 'Main' and call it Floating Location Window, then add the spoiler code to it.
Usage:
Now, for how to use this. I like this location window script because you input the map name manually, so if your using a script that has you put <text> in the map name it wont show up lol.
So, how do we go about using this you ask?
In a Call Script in an empty event set to 'auto start' in the trigger options we put this:
Quote:$scene.set_location ("Map Name")
Replace map name with the name of your map. Now, we want this to work every time we enter or exit this map, so, in that same event, create a new switch operation and call it Location Switch, well I did that but you can call it what you will. Now, every time you make a teleport, under the teleport command, put in the location switch operation and set it to off so that it will turn on and process the call script. You must do this for every Teleport event that you make, otherwise the location window wont show. So your teleport events should look like this:
Installation:
If you are using KGCââ¬â¢s Limit Breaker script be aware that this script does not work well with it.
Now, make a new class called Enemies that Level Up above 'Main' and
Put the spoiler code into it.
Usage:
All right, this script is jus like it sounds. Like in FF8 the enemies level up as you do, so in the database, set the stats of your monsters to their lvl 99 stats, other wise they will be very weak.
Sephiroth decided to add Tricksters Boss Monster script so there are a few things you must do. First off as I said before, make the stats of your monsters at their lvl 99 forms. Also, if you have a boss monster add (BOSS) to the name in the database like this:
Quote:Boss Monster Name(BOSS)
This will tell the script not to work its magic on these monsters marked as (BOSS) and also the word (BOSS) wont show up in the names in case you were wondering. And thatââ¬â¢s all there is to it.
Enemies that Level Up
#==============================================================================
# Enemies That Level UP
#--------------------------------------------------------------------------
# Created By SephirothSpawn (11.17.05)
# Last Updated: 11.18.05
# Updated: Can Make Enemies Bosses (They Do Not Level Up) 11.18.05
#==============================================================================
#==============================================================================
# Module RPG
#==============================================================================
module RPG
#=========================================================================
# Class Weapon
#=========================================================================
class Enemy
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
# Base Statistics
attr_accessor :b_maxhp, :b_maxsp, :b_str, :b_dex, :b_agi, :b_int
attr_accessor :b_atk, :b_pdef, :b_mdef, :b_eva, :b_exp, :b_gold
# Boss Check
attr_accessor :boss
#--------------------------------------------------------------------------
# * Set Bases
#--------------------------------------------------------------------------
def set_bases
@b_maxhp, @b_maxsp = @maxhp, @maxsp
@b_str, @b_dex, @b_agi, @b_int = @str, @dex, @agi, @int
@b_atk, @b_pdef, @b_mdef, @b_eva = @atk, @pdef, @mdef, @eva
@b_exp, @b_gold = @exp, @gold
# Checks to See if there's a boss
if @name.include?("(BOSS)")
@boss = true
@name.slice!("(BOSS)")
else
@boss = false
end
end
#--------------------------------------------------------------------------
# * Update Level
#--------------------------------------------------------------------------
def update_level
unless @boss
# Calulates Average Level of Party
average = 0
for actor in $game_party.actors
average += actor.level
end
average /= $game_party.actors.size
# Adds 1 (So when you're at level 99, 100% of the Stats are used)
average += 5
# Set to a percent
average /= 200.000
# Update Stats
@maxhp = (@b_maxhp * average).to_i
@maxsp = (@b_maxsp * average).to_i
@str = (@b_str * average).to_i
@dex = (@b_dex * average).to_i
@agi = (@b_agi * average).to_i
@int = (@b_int * average).to_i
@atk = (@b_atk * average).to_i
@pdef = (@b_pdef * average).to_i
@mdef = (@b_mdef * average).to_i
@eva = (@b_eva * average).to_i
@exp = (@b_exp * average + 1).to_i
@gold = (@b_gold * average + 1).to_i
end
end
end
end
#==============================================================================
# Class Scene Title
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Alias' New Game Method
#--------------------------------------------------------------------------
alias new_game command_new_game
#--------------------------------------------------------------------------
# * Adds Base Stats For Enemies
#--------------------------------------------------------------------------
def command_new_game
for i in 1...$data_enemies.size
$data_enemies[i].set_bases
end
new_game
end
end
#==============================================================================
# Class Scene Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
for i in 1...$data_enemies.size
$data_enemies[i].update_level
end
end
end
#Trickster & SephirothSpawn
Squall789's FF7 Credits Script:
Instructions:
Installation:
Make a new class above ââ¬ÅMainââ¬Â and place the spoiler code into it.
Usage:
This script creates a credits roll similar to the ones used at the beginning of FF7.
You can call this a couple of ways. You can make it run from the start of your game by replacing this in ââ¬ÅMainââ¬Â:
Quote:$scene = Scene_Title.new
with this:
Quote: $scene = FFVII_Credits.new
Or you can make then run from any point in your game by putting the code above ($scene = FFVII_Credits.new) into a call script in an event. If you are going to take sections out, make sure you take everything out related to that section. So if you want to take all of section 15 out, find everything related to 15 and delete it. Ok, these lines are for the background and sound:
Installation:
Create a new class above ââ¬ÅMainââ¬Â and place the first spoilered code into it.
IMPORTANT: If your Scene_Menu has edits to it continue. If it does not, it will be faster to use the pre-edited Scene_Menu from below (second spoiler code).
Now, in your scene_menu class, after the last s# object add S# (where # is the number after the last object. So if you have an s5 this one is s6) = "Quest Window".
Example:
Quote:s6 = ââ¬ÅQuest Windowââ¬Â
In the line that has (s1, s2, s3, s4, s5 ect) add the s# from the quest window's line, so, if we continue with it being 6, its (s1, s2, s3, s4, s5, s6).
Now, find the @dispose's and @update's in the "Scene_Menu' and add this to the respective group:
Quote:# Teh_Freak - update the quest window
if @quest_window.active
update_quest
return
end
Under this:
Quote:if @status_window.active
update_status
return
end
end
add this:
Quote:#------------------------------------------------------------------------
# ? Teh_Freak - Update Quest
#------------------------------------------------------------------------
def update_quest
# If escape is pressed
if Input.trigger?(Input::B)
# do the sound effect
$game_system.se_play($data_system.cancel_se)
# switch windows to normal again
@command_window.active = true
@quest_window.active = false
@quest_window.visible = false
@status_window.visible = true
return
end
end
# END update_quest#-------------------------------------------
and that should do it. Now, you might get an error in "Scene_Menu" If you do, and the erroring line is the last end in Scene_Menu, then comment it out by putting a # in front of it.
Usage:
This script is a tricky one to use, for a few reasons:
You need to put some edits into a few classes and you need to decide how many normal items you are going to create, because after a certain number, the items all become quest items. So, first off, in "Window_Item" find this:
Quote:@quest_number = 33 #Teh_Freak - this is the item ID of the FIRST quest item
Now any item after 33 will now be a quest item. The description will be the quest items description, so make sure you label them right. Also, after you complete a quest, you might want to make a quest called "questââ¬â¢s name"- complete so that you know itââ¬â¢s completed. Again, thatââ¬â¢s what I am doing with mine.
Quest Window
#==============================================================================
# ? Window_Quest
#------------------------------------------------------------------------------
# Based on Window_Item, with several changes
#==============================================================================
class Window_Quest < Window_Selectable
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize
super(0, 0, 480, 480)
@column_max = 1
@quest_number = 34 #Teh_Freak - this is the item ID of the FIRST quest item
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ? ???????
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in @quest_number...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# ???? 0 ??????????????????????
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = "OldEnglish"
self.contents.font.size = 20
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ? ?????
# index : ????
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = index
y = index * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, width, 32, item.description, 0)
end
end
Now, to be able to use this, we need to call the menu up. This only works thought the main menu so go to "Scene_Menu" press ctrl + a, come back to here, select all of this:
**ONLY REPLACE THIS IF YOU DON'T HAVE EDITATIONS TO "SCENE_MENU' ALREADY. IF YOU DO HAVE EDITATIONS, SKIP THIS PART AND GO BACK TO THE INSTRUCTIONS SECTION!!!**