Dragon Soul System (or: Party-Shared Skill Points)

Dragon Soul SystemVersion: 1.0
By: Armor Nick

Introduction

This script emulates the Dragon Soul system from The Elder Scrolls: Skyrim.

Certain characters are 'Dragonborn' who can spend Dragon Souls to unlock special Dragon Shouts. Dragon Souls are gained by defeating certain enemies.

Dragon Souls are shared by the party but are spend on characters.
Creative Uses
  • Straight-up Skyrim Dragon Slaying!
  • Strategic skill management by learning skills based on the whole party.
  • A fairly original system to learn skills

Screenshots

Message after battle Show
Image


Scene_Shouts Show
Image


Demo

Will do if there is enough want.

Script

The script is divided in 2 parts. This was done because I couldn't add the 'Shouts' command to the main menu without breaking any CMS or other Menu Addon you might have. I suggest taking a look at the differences between your current menu and the menu I posted to see what you have to change.

script Show
  1.  
  2. #==============================================================================
  3. # ** Dragon Souls
  4. #------------------------------------------------------------------------------
  5. # Armor Nick
  6. # 1.0
  7. # 2011-12-05
  8. #------------------------------------------------------------------------------
  9. # This script emulates the Dragon Soul system from The Elder Scrolls: Skyrim
  10. #
  11. # Certain characters are 'Dragonborn' who can spend Dragon Souls to unlock
  12. # special Dragon Shouts. Dragon Souls are gained by defeating certain enemies.
  13. #
  14. # Dragon Souls are shared by the party but are spend on characters.
  15. #------------------------------------------------------------------------------
  16. # Instructions:
  17. #
  18. # ** Unlocking a Shout:
  19. #     $game_party.unlock_shout(skill_id)
  20. #
  21. # ** Adding Souls to the party:
  22. #     $game_party.gain_souls(n)
  23. #
  24. # ** Testing if we have a certain Shout/Skill:
  25. #     $game_party.has_shout?(skill_id)
  26. #
  27. # ** To call the Shouts screen:
  28. #     $scene = Scene_Shouts.new(actor_index)
  29. #     where: actor_index = the index of the actor in your party
  30. #------------------------------------------------------------------------------
  31. # To edit where the menu goes when you press escape:
  32. #   Control+F DS_MENU_RETURN and edit the method you find there.
  33. #==============================================================================
  34.  
  35.   Vocab::Shouts = "Shouts"
  36.   Vocab::Souls = "Souls"
  37.   Vocab::ObtainSouls = "%s %s were obtained!"
  38.   # NOTE: the above text MUST obtain '' exactly 2 times
  39.   # unless you change display_exp_and_gold at the bottom
  40.   # these variables are respectively the amount and Vocab::Souls
  41.  
  42.   #----------------------------------------------------------------------------
  43.   # Begin ANA module
  44.   #----------------------------------------------------------------------------
  45.   module ANA
  46.    
  47.     #------------------------------------------------------------------------------
  48.     # * Characters who can learn Dragon Skills (actor_id)
  49.     #------------------------------------------------------------------------------
  50.     DRAGONBORN = [1, 3, 5, 7]
  51.    
  52.     #------------------------------------------------------------------------------
  53.     # * Characters who give Dragon Souls
  54.     #------------------------------------------------------------------------------
  55.     DRAGONS = [1]
  56.  
  57.   #----------------------------------------------------------------------------
  58.   # End ANA module
  59.   #----------------------------------------------------------------------------    
  60.   end
  61.  
  62. #==============================================================================
  63. # ** Game_Party
  64. #==============================================================================
  65. class Game_Party < Game_Unit
  66.  
  67.   #--------------------------------------------------------------------------
  68.   # * Public Instance Variables
  69.   #--------------------------------------------------------------------------
  70.   attr_accessor    :souls                    # number of dragon souls
  71.   attr_reader      :shouts                   # list of unlocked shouts
  72.  
  73.   #--------------------------------------------------------------------------
  74.   # * Alias Listings
  75.   #--------------------------------------------------------------------------
  76.   alias armornick_dragonsouls_gmparty_initialize initialize
  77.  
  78.   #--------------------------------------------------------------------------
  79.   # * Object Initialization
  80.   #--------------------------------------------------------------------------
  81.   def initialize
  82.     @souls = 0
  83.     @shouts = []
  84.     armornick_dragonsouls_gmparty_initialize
  85.   end
  86.  
  87.   #--------------------------------------------------------------------------
  88.   # * Unlock Shout
  89.   #     skill_id : ID of the skill (shout)
  90.   #--------------------------------------------------------------------------  
  91.   def unlock_shout(skill_id = 0)
  92.     unless has_shout?(skill_id)
  93.       @shouts.push(skill_id)
  94.       @shouts.sort!
  95.     end
  96.   end
  97.  
  98.   #--------------------------------------------------------------------------
  99.   # * Do we have the given shout?
  100.   #--------------------------------------------------------------------------
  101.   def has_shout?(skill_id)
  102.     return @shouts.include?(skill_id)
  103.   end
  104.  
  105.   #--------------------------------------------------------------------------
  106.   # * Do we have any souls or shouts?
  107.   #--------------------------------------------------------------------------
  108.   def has_souls_or_shouts?
  109.     result = @souls > 0 || @shouts.length > 0
  110.     return result
  111.   end
  112.  
  113.   #--------------------------------------------------------------------------
  114.   # * Gain the given amount of souls
  115.   #--------------------------------------------------------------------------  
  116.   def gain_souls(n)
  117.     @souls += n
  118.   end
  119.  
  120. end #class Game_Party < Game_Unit
  121.  
  122. #==============================================================================
  123. # ** Game_Troop
  124. #==============================================================================
  125.  
  126. class Game_Troop < Game_Unit
  127.   #--------------------------------------------------------------------------
  128.   # * Calculate Number of Souls
  129.   #--------------------------------------------------------------------------
  130.   def souls_total
  131.     gold = 0
  132.     for enemy in dead_members
  133.       gold += 1 if ANA::DRAGONS.include?(enemy.enemy_id )
  134.     end
  135.     return gold
  136.   end
  137.  
  138. end #class Game_Troop < Game_Unit
  139.  
  140. #==============================================================================
  141. # ** Window_Shouts
  142. #------------------------------------------------------------------------------
  143. #  This window displays a list of the shouts the party has discovered
  144. #==============================================================================
  145.  
  146. class Window_Shouts < Window_Selectable
  147.   #--------------------------------------------------------------------------
  148.   # * Object Initialization
  149.   #     x      : window x-coordinate
  150.   #     y      : window y-coordinate
  151.   #     width  : window width
  152.   #     height : window height
  153.   #--------------------------------------------------------------------------
  154.   def initialize(x, y, width, height, actor)
  155.     super(x, y, width, height)
  156.     @actor = actor
  157.     @column_max = 2
  158.     self.index = 0
  159.     refresh
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # * Get Skill
  163.   #--------------------------------------------------------------------------
  164.   def shout
  165.     return @data[self.index]
  166.   end
  167.   #--------------------------------------------------------------------------
  168.   # * Refresh
  169.   #--------------------------------------------------------------------------
  170.   def refresh
  171.     @data = []
  172.     for shout in $game_party.shouts
  173.       @data.push($data_skills[shout])
  174.     end
  175.     @item_max = @data.size
  176.     create_contents
  177.     for i in 0...@item_max
  178.       draw_item(i)
  179.     end
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * Draw Item
  183.   #     index : item number
  184.   #--------------------------------------------------------------------------
  185.   def draw_item(index)
  186.     rect = item_rect(index)
  187.     self.contents.clear_rect(rect)
  188.     shout = @data[index]
  189.     if shout != nil
  190.       rect.width -= 4
  191.       enabled = $game_party.souls > 0 && [email protected]_learn?(shout)
  192.       draw_item_name(shout, rect.x, rect.y, enabled)
  193.       self.contents.draw_text(rect, @actor.calc_mp_cost(shout), 2)
  194.     end
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # * Update Help Text
  198.   #--------------------------------------------------------------------------
  199.   def update_help
  200.     @help_window.set_text(shout == nil ? "" : shout.description)
  201.   end
  202.  
  203. end #class Window_Shouts < Window_Selectable
  204.  
  205. #==============================================================================
  206. # ** Window_Souls
  207. #------------------------------------------------------------------------------
  208. #  This window displays the amount of souls.
  209. #==============================================================================
  210.  
  211. class Window_Souls < Window_Base
  212.   #--------------------------------------------------------------------------
  213.   # * Object Initialization
  214.   #     x : window X coordinate
  215.   #     y : window Y coordinate
  216.   #--------------------------------------------------------------------------
  217.   def initialize(x, y)
  218.     super(x, y, 160, WLH + 32)
  219.     refresh
  220.   end
  221.   #--------------------------------------------------------------------------
  222.   # * Refresh
  223.   #--------------------------------------------------------------------------
  224.   def refresh
  225.     self.contents.clear
  226.     draw_souls_value($game_party.souls, 4, 0, 120)
  227.   end
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # * Draw number with currency unit
  231.   #     value : Number (gold, etc)
  232.   #     x     : draw spot x-coordinate
  233.   #     y     : draw spot y-coordinate
  234.   #     width : Width
  235.   #--------------------------------------------------------------------------
  236.   def draw_souls_value(value, x, y, width)
  237.     cx = contents.text_size(Vocab::Souls + "\t").width
  238.     self.contents.font.color = normal_color
  239.     self.contents.draw_text(x, y, width-cx-2, WLH, value, 2)
  240.     self.contents.font.color = system_color
  241.     self.contents.draw_text(x, y, width, WLH, Vocab::Souls, 2)
  242.   end
  243.  
  244. end #class Window_Souls < Window_Base
  245.  
  246. #==============================================================================
  247. # ** Window_ShoutStatus
  248. #------------------------------------------------------------------------------
  249. #  This window displays the skill user's status on the shouts screen.
  250. #==============================================================================
  251.  
  252. class Window_ShoutStatus < Window_Base
  253.   #--------------------------------------------------------------------------
  254.   # * Object Initialization
  255.   #     x     : window X coordinate
  256.   #     y     : window Y corrdinate
  257.   #     actor : actor
  258.   #--------------------------------------------------------------------------
  259.   def initialize(x, y, actor)
  260.     super(x, y, 384, WLH + 32)
  261.     @actor = actor
  262.     refresh
  263.   end
  264.   #--------------------------------------------------------------------------
  265.   # * Refresh
  266.   #--------------------------------------------------------------------------
  267.   def refresh
  268.     self.contents.clear
  269.     draw_actor_name(@actor, 4, 0)
  270.     draw_actor_level(@actor, 140, 0)
  271.   end
  272.  
  273. end #class Window_ShoutStatus < Window_Base
  274.  
  275. #==============================================================================
  276. # ** Scene_Shouts
  277. #==============================================================================
  278.  
  279. class Scene_Shouts < Scene_Base
  280.   #--------------------------------------------------------------------------
  281.   # * Object Initialization
  282.   #     actor_index : actor index
  283.   #--------------------------------------------------------------------------
  284.   def initialize(actor_index = 0)
  285.     @actor_index = actor_index
  286.   end
  287.  
  288.   #--------------------------------------------------------------------------
  289.   # * Start processing
  290.   #--------------------------------------------------------------------------
  291.   def start
  292.     super
  293.     create_menu_background
  294.     @actor = $game_party.members[@actor_index]
  295.     @viewport = Viewport.new(0, 0, 544, 416)
  296.     @help_window = Window_Help.new
  297.     @help_window.viewport = @viewport
  298.     @status_window = Window_ShoutStatus.new(160, 56, @actor)
  299.     @status_window.viewport = @viewport
  300.     @souls_window = Window_Souls.new(0,56)
  301.     @souls_window.viewport = @viewport
  302.     @shouts_window = Window_Shouts.new(0, 112, 544, 304, @actor)
  303.     @shouts_window.viewport = @viewport
  304.     @shouts_window.help_window = @help_window
  305.   end
  306.  
  307.   #--------------------------------------------------------------------------
  308.   # * Termination Processing
  309.   #--------------------------------------------------------------------------
  310.   def terminate
  311.     super
  312.     dispose_menu_background
  313.     @help_window.dispose
  314.     @status_window.dispose
  315.     @shouts_window.dispose
  316.     @souls_window.dispose
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # * Return to Original Screen
  320.   #     DS_MENU_RETURN
  321.   #--------------------------------------------------------------------------
  322.   def return_scene
  323.     # Edit this method to choose where you go after pressing escape
  324.     # $scene = Scene_Map.new    # I want to go back to the map screen
  325.     $scene = Scene_Menu.new(6)  # I want to go back to the menu (index)
  326.   end  
  327.  
  328.   #--------------------------------------------------------------------------
  329.   # * Frame Update
  330.   #--------------------------------------------------------------------------
  331.   def update
  332.     super
  333.     update_menu_background
  334.     @help_window.update
  335.     @status_window.update
  336.     @shouts_window.update
  337.     @souls_window.update
  338.     if @shouts_window.active
  339.       update_skill_selection
  340.     end
  341.   end  
  342.  
  343.   #--------------------------------------------------------------------------
  344.   # * Update Skill Selection
  345.   #--------------------------------------------------------------------------
  346.   def update_skill_selection
  347.     if Input.trigger?(Input::B)
  348.       Sound.play_cancel
  349.       return_scene
  350.   elsif Input.trigger?(Input::C)
  351.       @shout = @shouts_window.shout
  352.       if $game_party.souls > 0 and [email protected]_learn?(@shout)
  353.         Sound.play_decision
  354.         learn_shout
  355.       else
  356.         Sound.play_buzzer
  357.       end
  358.     end
  359.   end  
  360.  
  361.   #--------------------------------------------------------------------------
  362.   # * Learn Selected Shout
  363.   #--------------------------------------------------------------------------  
  364.   def learn_shout
  365.     # teach the shout and remove soul
  366.     $game_party.souls -= 1
  367.     @actor.learn_skill(@shout.id)
  368.     # refresh the windows
  369.     @status_window.refresh
  370.     @shouts_window.refresh
  371.     @souls_window.refresh
  372.   end
  373.  
  374. end #class Scene_Shouts < Scene_Base
  375.  
  376. #==============================================================================
  377. # ** Scene_Battle
  378. #------------------------------------------------------------------------------
  379. #  This class performs battle screen processing.
  380. #==============================================================================
  381.  
  382. class Scene_Battle < Scene_Base
  383.  
  384.   #--------------------------------------------------------------------------
  385.   # * Alias Listings
  386.   #--------------------------------------------------------------------------
  387.   alias armornick_dragonsouls_sbattle_display_exp_and_gold display_exp_and_gold
  388.  
  389.   #--------------------------------------------------------------------------
  390.   # * Display Gained Experience and Gold
  391.   #--------------------------------------------------------------------------
  392.   def display_exp_and_gold
  393.     souls = $game_troop.souls_total
  394.     $game_party.gain_souls(souls)
  395.     if souls > 0
  396.       text = sprintf(Vocab::ObtainSouls, souls, Vocab::Souls)
  397.       $game_message.texts.push('\.' + text)
  398.     end
  399.     armornick_dragonsouls_sbattle_display_exp_and_gold
  400.   end
  401.  
  402. end #class Scene_Battle < Scene_Base
  403.  
Expand to see the code.


Scene_Menu additions Show
  1.  
  2. #==============================================================================
  3. # ** Scene_Menu
  4. #==============================================================================
  5. class Scene_Menu < Scene_Base
  6.   #--------------------------------------------------------------------------
  7.   # * Create Command Window
  8.   #--------------------------------------------------------------------------
  9.   def create_command_window
  10.     s1 = Vocab::item
  11.     s2 = Vocab::skill
  12.     s3 = Vocab::equip
  13.     s4 = Vocab::status
  14.     s5 = Vocab::save
  15.     s6 = Vocab::game_end
  16.     s7 = Vocab::Shouts
  17.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  18.     @command_window.index = @menu_index
  19.     if $game_party.members.size == 0          # If number of party members is 0
  20.       @command_window.draw_item(0, false)     # Disable item
  21.       @command_window.draw_item(1, false)     # Disable skill
  22.       @command_window.draw_item(2, false)     # Disable equipment
  23.       @command_window.draw_item(3, false)     # Disable status
  24.     end
  25.     if $game_system.save_disabled             # If save is forbidden
  26.       @command_window.draw_item(4, false)     # Disable save
  27.     end
  28.     # disable the command if we have no souls or shouts
  29.     if ! $game_party.has_souls_or_shouts?
  30.       @command_window.draw_item(6, false)    
  31.     end
  32.   end
  33.  
  34.   #--------------------------------------------------------------------------
  35.   # * Update Command Selection
  36.   #--------------------------------------------------------------------------
  37.   def update_command_selection
  38.     if Input.trigger?(Input::B)
  39.       Sound.play_cancel
  40.       $scene = Scene_Map.new
  41.     elsif Input.trigger?(Input::C)
  42.       if $game_party.members.size == 0 and @command_window.index < 4
  43.         Sound.play_buzzer
  44.         return
  45.       elsif $game_system.save_disabled and @command_window.index == 4
  46.         Sound.play_buzzer
  47.         return
  48.       elsif ! $game_party.has_souls_or_shouts? and @command_window.index == 6
  49.         Sound.play_buzzer
  50.         return
  51.       end
  52.       Sound.play_decision
  53.       case @command_window.index
  54.       when 0      # Item
  55.         $scene = Scene_Item.new
  56.       when 1,2,3,6  # Skill, equipment, status
  57.         start_actor_selection
  58.       when 4      # Save
  59.         $scene = Scene_File.new(true, false, false)
  60.       when 5      # End Game
  61.         $scene = Scene_End.new
  62.       end
  63.     end
  64.   end
  65.  
  66.   #--------------------------------------------------------------------------
  67.   # * Update Actor Selection
  68.   #--------------------------------------------------------------------------
  69.   def update_actor_selection
  70.     if Input.trigger?(Input::B)
  71.       Sound.play_cancel
  72.       end_actor_selection
  73.     elsif Input.trigger?(Input::C)
  74.       $game_party.last_actor_index = @status_window.index
  75.       Sound.play_decision
  76.       case @command_window.index
  77.       when 1  # skill
  78.         $scene = Scene_Skill.new(@status_window.index)
  79.       when 2  # equipment
  80.         $scene = Scene_Equip.new(@status_window.index)
  81.       when 3  # status
  82.         $scene = Scene_Status.new(@status_window.index)
  83.       when 6
  84.         if ANA::DRAGONBORN.include?($game_party.members[@status_window.index].id)
  85.           $scene = Scene_Shouts.new(@status_window.index)
  86.         end
  87.       end
  88.     end
  89.   end  
  90.  
  91. end
  92.  
Expand to see the code.


Instructions
To install, just insert the first or both of the scripts in the script editor above main. You should know this by now.

** Unlocking a Shout:
$game_party.unlock_shout(skill_id)

** Adding Souls to the party:
$game_party.gain_souls(n)

** Testing if we have a certain Shout/Skill:
$game_party.has_shout?(skill_id)

** To call the Shouts screen:
$scene = Scene_Shouts.new(actor_index)
where: actor_index = the index of the actor in your party

To edit where Scene_Shouts goes when you leave the menu:
Control+F DS_MENU_RETURN in the script and edit the method you find there.
Pre-defined methods for the Main Menu and the Map are available.

FAQ
Ask away.

Compatibility

Should be compatible with most scripts. Unless, of course, you use a CMS and my menu additions together in which case post a comment and I may possibly tinker something together.

Credits and Thanks

Thanks to Enterbrain for creating RPG Maker VX so I could muck about a bit.

Author's Notes

This is my first script for RPG Maker VX but I'm fairly confident so any critics are welcome.

Feel free to make requests and I may possibly tinker something together. However, I'm doing this for fun and I do have a real job so I'm not making any promises.

These are possible additions I thought of; post if you want one or more of them:
  • A different amount of Souls per enemy (fixed or variable)
  • Switches to get Souls from every enemy and/or be able to give Shouts to every actor
  • A maximum amount of Shouts and/or Souls for the actor and/or party

Terms and Conditions

Code License Show
Copyright (c) 2011, Nick Arnoeyts
All rights reserved.
 
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 
*  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*  Neither the name of Armor Nick, Nick Arnoeyts nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=75894