[RMVX] Magica Scroll System

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 87
Magica Scroll System
Version: 1.0
Type: Custom System

Introduction

This script allows you to equip your party with scrolls before entering a battle, which allows them to use certain skills. This will make a player think of a strategy before entring a battle and then applying it in the battle ground..

Features

  • A nicely designed Scene to handle the scrolls..
  • You can edit the scroll easily through the "items" slot and a ready made template for you to use on RGSS..
  • Additional "Switch trigger" function that will help you include the presence of scrolls in certain events..

Screenshots



Demo
http://www.fileshost.com/en/file/29880/Magica-Scroll-System-exe.html

Script
Spoiler for:
Code: [Select]
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# 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

Spoiler for:
Code: [Select]
#==============================================================================
# ? Magica
#------------------------------------------------------------------------------
# Right, now here is where you can set each scroll's effects. Wether it was it was adding magical
# skills,  corresponding with other events, it doesn't matter !
# I made the basic commands which are setting a new skill,
#
# How to use :
#
# - Add the effects you want using the already setted methods under "def initialize"  :
#     (set_magica or switch_trigger)
#      the arguments are as follows :
#      set_magica(scroll_id,skill_id)
#      set_switch(scroll_id, switch, character)
#
#==============================================================================

class Magica
 
  def initialize #Add the scroll related skills below this line
 end
 
 
#This is the method you'll be using for setting magic.
 def set_magica(scroll_id,skill_id)
    for i in 0...$game_party.members.size
    @actor = $game_party.members[i]
     if @actor.scroll.id == $data_items[scroll_id].scroll.id or @actor.scroll2.id == $data_items[scroll_id].scroll.id or @actor.scroll3.id == $data_items[scroll_id].scroll.id
    @actor.learn_skill(skill_id)
    else
    @actor.forget_skill(skill_id)
    end
    end
end
   #This is the method you'll be using for triggering a switch
def switch_trigger(scroll_id, switch, character)
    if $game_party.members[character-1].scroll.id == $data_items[scroll_id].scroll.id or $game_party.members[character-1].scroll2.id == $data_items[scroll_id].scroll.id or $game_party.members[character-1].scroll3.id == $data_items[scroll_id].scroll.id
      $game_switches[switch] = true
    else
            $game_switches[switch] = false
      end
  end
 
end
Spoiler for:
Code: [Select]
module Scrolls
 
  class Scroll_Array
   
    def initialize
      # Don't forget to add the scroll's class name in this array, and don't forget the ".new"
      @scroll_array = [Fire_Scroll.new, Water_Scroll.new,Blaze_Scroll.new,Ice_Scroll.new]
    end
    def data(id)
      for i in 0...@scroll_array.size
        if @scroll_array[i].id == id
       return @scroll_array[i]
          end
        end
      end
   
    end
   #=====================================================================
   #=====================================================================
#=====================================================================
    #How to set Scrolls :
    # 1 - Use the template below and follow the instructions
    # 2 - Add the <class name> with a ".new" sticked to the end of it in the Array above..
    # 3 - Add a line in the "Set_Item_Scrolls" class below using this syntax :
    #         $data_items[item_id].scroll = Scrolls::<class name>.new
    #         item_id : The id of the item related to the scroll
    #         <class name> : The name of the class of the scroll, again, don't forget the ".new"
    #4 - All the items related to scrolls must have the first attribute -name it "Scroll"- setted on..
    #     If you still have problems with functioning the script please revise the templates in the
    #     demonstration game, if you still experince problems, you can PM in the RRR forums
    #     or through msn live messanger through my e-mail : denarto0o0@hotmail.com
#=====================================================================
#=====================================================================

=begin

class <class name> #This can be anything but it should start with a capital letter
  def initialize
  end
  def id
    return <id> #This is the ID of the item you want the scroll to be related to..
  end
    def item_related
      return $data_items[id]
      end
  def name
      return <name> #The name of the scroll, you should name it like
                                #the item the scroll is related to although you can change it
                                # don't forget to put BETWEEN 2 QOUTE MARKZ
    end
  end
 
=end
#=====================================================================
#=====================================================================

 end
 
  class Set_Item_Scrolls
    def initialize
      #Set the items related to the scrolls here
     $data_items[1].scroll = Scrolls::Water_Scroll.new
      $data_items[2].scroll = Scrolls::Fire_Scroll.new
       $data_items[5].scroll = Scrolls::Blaze_Scroll.new
      $data_items[6].scroll = Scrolls::Ice_Scroll.new
    end
    end



Instructions

Add the first scroll above main and add th other two below it..
Follow the instructions in the script..
And dont forget to set the Scroll Related items to the first attribute, and you preferably should name it "Scroll"..


Credits and Thanks

  • Blizzard - For his slice_text add-on to the Window_Base Class
  • Zeriab for his.... tipz >_>

Author's Notes
If you experience any problems regarding the script please try the demonstration first, if you STILL have problems feel free to PM or contact me through MSN live messenger ... my e-mail denarto0o0@hotmail.com
« Last Edit: January 27, 2008, 08:29:04 AM by Dark Dragon X »

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Nice work, once the admins finally decide to give me a VX Database I'll move this there :P

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Best RPG Maker User (Scripting)2010 Most Mature Member
Looks good, but the text on the faces is kind of ugly in my opinion. Plus, for pictures that are light it will become impossible to read white text. If you want to keep it that way, it might not be a bad idea to play around with the alpha of the faces or the text.

**
Rep:
Level 87
Yeah I agree, I'll change that in the official version ^_^
More suggestions people D=

**
Rep:
Level 87
Okay the script is available now..
I re-scripted almost the whole thing to make it for 3 slots D=

**
Rep:
Level 86
Hell Blade © 2008, All Rights Reserved
Script for VX, great work!  ;8