#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Magica Scroll System
# Version: 1.0
# Type: Custom System
# Made by : Dark Dragon
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
#==============================================================================
#==============================================================================
class Scroll_Scene < Scene_Base
#-----------------------------------------------------------------------------
# Set classes which will be used later..
#-----------------------------------------------------------------------------
def start
@window_scroll = Window_Scroll.new
@window_charcter = WindowS_Charcter.new
@scroll_details = Scroll_Details.new
@current_scroll = Window_CurrentScroll.new
@current_scroll.active = false
@charcter_status = Window_CharcterScrollStatus.new
@scroll_array = Scrolls::Scroll_Array.new
end
#-----------------------------------------------------------------------------
#Dispose of the classes whe $scene != self
#-----------------------------------------------------------------------------
def terminate
@window_scroll.dispose
@window_charcter.dispose
@scroll_details.dispose
@current_scroll.dispose
@charcter_status.dispose
end
#-----------------------------------------------------------------------------
# Update each class in loops and set the @actor value..
#-----------------------------------------------------------------------------
def update
@actor = $game_party.members[@window_charcter.index]
@window_scroll.update
@window_charcter.update
@current_scroll.update
#-----------------------------------------------------------------------------
# Set the details in the Scroll_Details window according to the position of the index
#-----------------------------------------------------------------------------
if @window_scroll.active
@scroll_details.update_details(@window_scroll.item)
elsif @current_scroll.active
case @current_scroll.index
when 0
if @actor.scroll != nil
@scroll_details.update_details2(@actor.scroll.item_related)
else
@scroll_details.update_details2(nil)
end
when 1
if @actor.scroll2 != nil
@scroll_details.update_details2(@actor.scroll2.item_related)
else
@scroll_details.update_details2(nil)
end
when 2
if @actor.scroll3 != nil
@scroll_details.update_details2(@actor.scroll3.item_related)
else
@scroll_details.update_details2(nil)
end
end
end
@current_scroll.refresh(@actor)
@charcter_status.refresh(@actor)
#-----------------------------------------------------------------------------
# Apply commands when C is pushed according to the active window..
#-----------------------------------------------------------------------------
if Input.trigger?(Input::C)
if @window_scroll.active
@window_scroll.active = false
@current_scroll.active = true
elsif @current_scroll.active
case @current_scroll.index
when 0
unless @window_scroll.item == nil
@scroll = @scroll_array.data(@window_scroll.item.scroll.id)
unless @actor.scroll == nil
$game_party.gain_item(@actor.scroll.item_related, 1)
end
@actor.scroll = @scroll
$game_party.consume_item(@window_scroll.item)
@window_scroll.refresh
@current_scroll.refresh2(@actor)
else
unless @actor.scroll == nil
$game_party.gain_item(@actor.scroll.item_related, 1)
@window_scroll.refresh
@actor.scroll = nil
@current_scroll.refresh2(@actor)
end
end
@current_scroll.active = false
@window_scroll.active = true
when 1
unless @window_scroll.item == nil
@scroll = @scroll_array.data(@window_scroll.item.scroll.id)
unless @actor.scroll2 == nil
$game_party.gain_item(@actor.scroll2.item_related, 1)
end
@actor.scroll2 = @scroll
$game_party.consume_item(@window_scroll.item)
@window_scroll.refresh
@current_scroll.refresh2(@actor)
else
unless @actor.scroll2 == nil
$game_party.gain_item(@actor.scroll2.item_related, 1)
@window_scroll.refresh
@actor.scroll2 = nil
@current_scroll.refresh2(@actor)
end
end
@current_scroll.active = false
@window_scroll.active = true
when 2
unless @window_scroll.item == nil
@scroll = @scroll_array.data(@window_scroll.item.scroll.id)
unless @actor.scroll3 == nil
$game_party.gain_item(@actor.scroll3.item_related, 1)
end
@actor.scroll3 = @scroll
$game_party.consume_item(@window_scroll.item)
@window_scroll.refresh
@current_scroll.refresh2(@actor)
else
unless @actor.scroll3 == nil
$game_party.gain_item(@actor.scroll3.item_related, 1)
@window_scroll.refresh
@actor.scroll3 = nil
@current_scroll.refresh2(@actor)
end
end
@current_scroll.active = false
@window_scroll.active = true
end
end
end
#-----------------------------------------------------------------------------
# Set the magical skills when aborting..and return to the scroll window if you are not..
#-----------------------------------------------------------------------------
if Input.trigger?(Input::B)
if @window_scroll.active
Magica.new
$scene = Scene_Map.new
elsif @current_scroll.active
@current_scroll.active = false
@window_scroll.active = true
end
end
end
end
#==============================================================================
#==============================================================================
#==============================================================================
#-----------------------------------------------------------------------------
# Set the Scroll Selection Class..
#-----------------------------------------------------------------------------
class Window_Scroll < Window_Selectable
def initialize
super(0,0,250,105)
self.contents = Bitmap.new(200,300)
self.index = 0
refresh
end
def refresh
self.contents.clear
#-----------------------------------------------------------------------------
# Push items with the first "Scroll" attribute on into the data array..
#-----------------------------------------------------------------------------
y = -1
@data = []
for i in 0 ... $game_party.items.size
if $game_party.items[i].is_a?(RPG::Item) and $game_party.items[i].element_set.include?(1)
@data.push($game_party.items[i])
y +=1
self.contents.draw_text(35,y*23-2,200,32,$game_party.items[i].name)
self.contents.draw_text(190,y*23-2,200,32,$game_party.item_number($game_party.items[i]))
draw_icon($game_party.items[i].icon_index, 0, y*23-2)
end
end
@data.push(nil)
self.contents.font.color = text_color(6)
self.contents.draw_text(5,@data.size*23-24,200,32,"Remove")
self.contents.font.color = normal_color
@item_max = @data.size
end
#-----------------------------------------------------------------------------
# Return the data array into self.data
#-----------------------------------------------------------------------------
def item
return @data[self.index]
end
end
#==============================================================================
#==============================================================================
#==============================================================================
#-----------------------------------------------------------------------------
# Set the Details Window..
#-----------------------------------------------------------------------------
class Scroll_Details < Window_Base
def initialize
super(0,250,350,167)
end
#-----------------------------------------------------------------------------
# Fill up the details when @scroll_window.active
#-----------------------------------------------------------------------------
def update_details(item)
unless item == nil
self.contents.font.size = 18
if item != @text
self.contents.clear
self.contents.font.color = text_color(6)
self.contents.draw_text(0,0,200,32,item.name)
self.contents.font.color = normal_color
text = slice_text(item.description, 400)
text.each_index {|i| self.contents.draw_text(4, i*32+32, self.width - 35, 32, text[i])}
@text = item
end
else
if item != @text
self.contents.clear
self.contents.draw_text(4, 0, self.width - 40, 32, "Remove scroll equipped.")
@text = item
end
end
end
#-----------------------------------------------------------------------------
# Fill up the window when @current_scroll.active
#-----------------------------------------------------------------------------
def update_details2(item)
unless item == nil
self.contents.font.size = 18
if item != @text
self.contents.clear
self.contents.font.color = text_color(6)
self.contents.draw_text(0,0,200,32,item.name)
self.contents.font.color = normal_color
text = slice_text(item.description, 400)
text.each_index {|i| self.contents.draw_text(4, i*32+32, self.width - 35, 32, text[i])}
@text = item
end
else
if item != @text
self.contents.clear
self.contents.draw_text(4, 0, self.width - 40, 32, "There is no scroll equipped.")
@text = item
end
end
end
end
#==============================================================================
#==============================================================================
#==============================================================================
#-----------------------------------------------------------------------------
# Set up the character selection window..
#-----------------------------------------------------------------------------
class WindowS_Charcter < Window_Selectable
def initialize
super(0,105,545,145)
for actor in $game_party.members
draw_actor_face(actor, actor.index*130+10, 10,96 )
self.contents.font.color = text_color(5)
draw_actor_name(actor,actor.index*130 +10, 10)
draw_actor_class(actor, actor.index*130+10, 35)
draw_actor_level(actor,actor.index*130 +10,60)
self.contents.font.color = normal_color
draw_actor_state(actor,actor.index*130 +90, 85 )
@column_max = 4
@item_max = $game_party.members.size
self.index = 0
end
end
def update_cursor
self.cursor_rect.set(self.index * 130, 0, 120, 120)
end
end
#==============================================================================
#==============================================================================
#==============================================================================
#-----------------------------------------------------------------------------
# Set the Current Actor Scroll window..
#-----------------------------------------------------------------------------
class Window_CurrentScroll < Window_Selectable
def initialize
super(250,0,295,105)
@item_max = 3
self.index = 0
end
#-----------------------------------------------------------------------------
# Fill up the window when contents is diffrent..
#-----------------------------------------------------------------------------
def refresh(actor)
unless actor == nil
self.contents.font.size = 18
if actor != @text
self.contents.clear
self.contents.font.color = text_color(6)
self.contents.draw_text(3,0,200,32,"")
self.contents.font.color = normal_color
if actor.scroll==nil
self.contents.draw_text(45,-2,200,32,"No equipped scroll.")
end
unless actor.scroll==nil
draw_icon(actor.scroll.item_related.icon_index, 0, -2)
self.contents.draw_text(45,-2,200,32,actor.scroll.name)
end
if actor.scroll2==nil
self.contents.draw_text(45,21,200,32,"No equipped scroll.")
end
unless actor.scroll2==nil
draw_icon(actor.scroll2.item_related.icon_index, 0, 21)
self.contents.draw_text(45,21,200,32,actor.scroll2.name)
end
if actor.scroll3==nil
self.contents.draw_text(45,44,200,32,"No equipped scroll.")
end
unless actor.scroll3==nil
draw_icon(actor.scroll3.item_related.icon_index, 0, 44)
self.contents.draw_text(45,44,200,32,actor.scroll3.name)
end
@text = actor
end
end
end
#-----------------------------------------------------------------------------
# Fill up the window when C is pushed..
#-----------------------------------------------------------------------------
def refresh2(actor)
unless actor == nil
self.contents.font.size = 18
self.contents.clear
self.contents.font.color = text_color(6)
self.contents.draw_text(3,0,200,32,"")
self.contents.font.color = normal_color
if actor.scroll==nil
self.contents.draw_text(45,-2,200,32,"No equipped scroll.")
end
unless actor.scroll==nil
draw_icon(actor.scroll.item_related.icon_index, 0, -2)
self.contents.draw_text(45,-2,200,32,actor.scroll.name)
end
if actor.scroll2==nil
self.contents.draw_text(45,21,200,32,"No equipped scroll.")
end
unless actor.scroll2==nil
draw_icon(actor.scroll2.item_related.icon_index, 0, 21)
self.contents.draw_text(45,21,200,32,actor.scroll2.name)
end
if actor.scroll3==nil
self.contents.draw_text(45,44,200,32,"No equipped scroll.")
end
unless actor.scroll3==nil
draw_icon(actor.scroll3.item_related.icon_index, 0, 44)
self.contents.draw_text(45,44,200,32,actor.scroll3.name)
end
@text = actor
end
end
end
#==============================================================================
#==============================================================================
#==============================================================================
class Window_CharcterScrollStatus < Window_Base
#-----------------------------------------------------------------------------
# Set up the characters window..
#-----------------------------------------------------------------------------
def initialize
super(350,250,195,167)
end
#-----------------------------------------------------------------------------
# Fill the window with the characters basic statues..
#-----------------------------------------------------------------------------
def refresh(actor )
unless actor == nil
self.contents.font.size = 18
if actor != @text
self.contents.clear
x = 0
draw_actor_hp(actor, x, 0)
draw_actor_mp(actor, x, 32 )
self.contents.font.size = 15
draw_actor_parameter(actor, x, 60, 0)
draw_actor_parameter(actor, x, 60 + 18, 1)
draw_actor_parameter(actor, x, 60 + 18*2, 2)
draw_actor_parameter(actor, x, 60+18*3, 3)
@text = actor
end
end
end
end
#==============================================================================
#==============================================================================
#==============================================================================
#-----------------------------------------------------------------------------
# Set the Scene_Title to set up the scrolls when starting a new game..
#-----------------------------------------------------------------------------
class Scene_Title
def load_database
$data_actors = load_data("Data/Actors.rvdata")
$data_classes = load_data("Data/Classes.rvdata")
$data_skills = load_data("Data/Skills.rvdata")
$data_items = load_data("Data/Items.rvdata")
$data_weapons = load_data("Data/Weapons.rvdata")
$data_armors = load_data("Data/Armors.rvdata")
$data_enemies = load_data("Data/Enemies.rvdata")
$data_troops = load_data("Data/Troops.rvdata")
$data_states = load_data("Data/States.rvdata")
$data_animations = load_data("Data/Animations.rvdata")
$data_common_events = load_data("Data/CommonEvents.rvdata")
$data_system = load_data("Data/System.rvdata")
$data_areas = load_data("Data/Areas.rvdata")
Set_Item_Scrolls.new
end
end