Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX]Weapon Upgrade System

Basically what I want is a system where the player can spend money to boost their weapon's stat output. Similar to games like Suikoden 3-5. Here's a mockup example.

http://i28.photobucket.com/albums/c206/ ... ample2.png[/img]

1. When the scene is started, you press the up or down keys to to change the character you have selected. I'm using 8 characters total, so it would be nice if if could keep scrolling down past the intitial 3/4 characters. To select, you press the Z key. to cancel at any time or leave the scene, press the X key. When a character is highlighted, the changes that will take place are displayed in the large box to the right.

2. After a character is selected, a prompt should appear and ask if the player wants to go through with it. If yes, then boost the weapon and return to step one. If no, then return to step one without any changes. If yes, but you don't have enough money, insert a buzzer sound or a 'not enough money' message, then return to step one without any changes. If weapon is maxed out, then insert a 'Weapon cannot be boosted anymore' message of some sort.

3. Weapons would have a max level of 20 and with each 'purchase' the price rises higher and higher for the next ones. For example, purchasing an increase when the weapon is level 1 would cost something like 134 gold. The next increase would cost 356, and the next would cost 798, and so on. Also, the amount that stats get increased by should rise with each purchase as well.

4. Please make it so that the scene can be called through something like 'Scene.Weapon_Upgrade.new' or something along those lines. And exiting it returns the player to the map.

5. I suppose that there should be some way to vary weapon growth from character to character as well. If it's not possible, then I'll take a single growth pattern for all. Anything to get this done.

I hope that's enough information. I believe I'm done for now.
 

Akin

Member

This looks interesting I'll give it a shot. I'm kinda busy lately though so it might take some time.
The big problem I see off the bat for this kinda thing is that the data class for weapons is in the RPG module section that the default scripting system doesn't give access too.

*Update*
Well after playing around with it I think I have a assigning each weapon a level and increasing the weapon stats with each level done. The base stats will act as the basis for the weapon. Any idea on what formula you want to use for growth?

Code:
Stat_Final = Base_Sate * Level * Modifier

is what I was going to program as standard. Let me know if you have any other ideas.
 

Akin

Member

where do you want to be ejected to when you leave the menu to the map or the main menu? My question is basically: is this going to be setup as part of the menu system or as a shop?
 

Akin

Member

I'm not nearly done as you can see but take a look at the base that I have going and tell me what you think. I know it ejects you to the menu right now but I'll change that before I'm done.

Code:
##########################################################
# Weapon Level System Script                             #
#        by Akin                                         #
#                                                        #
##########################################################
# Weapon Levels will produce a higher stat output        #
# Level weapons from the call:                           #
# "$scene = Scene_Scene_Weapons_Upgrade.new"             #
#                                                        #
# Search for A34sZ1A to find the formulas being used     #
# to calculate the stat point raise for each weapon      #
# and for the price increase to the cost                 #
#                                                        #
##########################################################

# This Module adds level to each weapon
module RPG
  class Weapon < BaseItem
  attr_accessor :level
  alias akin_weapon_level_system_ini initialize
    def initialize
      akin_weapon_level_system_ini
      @level = 1
    end
  end
end

# This Module calculates the weapon levelup
module Akin_Weapons
  def self.level_up(weapon_input)
    if weapon_input.level == nil or weapon_input.level == 0
      weapon_input.level = 1
    end
    weapon_input.level += 1
    
    #--------Level Up Functions-------------A34sZ1A -----------------------
    # The stats will increase by a 20% of their previous value + 1
    # Everytime they level up using this formula
    # Make sure you keep the value set to an Integer by using "Integer()"
    weapon_input.atk = Integer(weapon_input.atk * 1.2 + 1)
    weapon_input.def = Integer(weapon_input.def * 1.2 + 1)
    weapon_input.spi = Integer(weapon_input.spi * 1.2 + 1)
    weapon_input.agi = Integer(weapon_input.agi * 1.2 + 1)
    #-------Level Up Functions End-----------------------------------------
  end
end

#------------------------------------------------------------------------------
#  Adds methods to window_base to draw actor's equiped weapon
#==============================================================================

class Window_Base < Window
  def draw_actor_weapon(actor, x, y)
    self.contents.font.color = power_up_color
    self.contents.draw_text(x, y, 96, WLH, "Equiped :")
    self.contents.font.color = normal_color
    n = actor.weapon_id
    equiped_weapon = $data_weapons[n]
    if equiped_weapon == nil
      self.contents.draw_text(x + 8, y + WLH, 192, WLH, "None")
    else
      self.contents.draw_text(x + 8, y + WLH, 192, WLH, equiped_weapon.name)
      if equiped_weapon.level == nil or equiped_weapon.level == 0
        $data_weapons[n].level = 1
        equiped_weapon = $data_weapons[n]
      end
      self.contents.font.color = system_color
      self.contents.draw_text(x + 8, y + WLH * 2, 112, WLH, "Weapon Lvl:")
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120, y + WLH * 2, 64, WLH, equiped_weapon.level)
    end
  end
end

#==============================================================================
# ** Window_Char_WeaponStatus
#------------------------------------------------------------------------------
#  This window displays each players weapon and level on the upgrade sceen
#==============================================================================

class Window_Char_WeaponStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     x : window X coordinate
  #     y : window Y coordinate
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y, 384, 416)
    refresh
    self.active = false
    self.index = -1
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    @item_max = $game_party.members.size
    for actor in $game_party.members
      draw_actor_face(actor, 2, actor.index * 96 + 2, 92)
      x = 104
      y = actor.index * 96 + WLH / 2
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x, y + WLH * 2)
      draw_actor_level(actor, x, y + WLH * 1)
      draw_actor_weapon(actor, x + 96, y)
    end
  end
  #--------------------------------------------------------------------------
  # * Update cursor
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0               # No cursor
      self.cursor_rect.empty
    elsif @index < @item_max    # Normal
      self.cursor_rect.set(0, @index * 96, contents.width, 96)
    elsif @index >= 100         # Self
      self.cursor_rect.set(0, (@index - 100) * 96, contents.width, 96)
    else                        # All
      self.cursor_rect.set(0, 0, contents.width, @item_max * 96)
    end
  end
end

#==============================================================================
# ** Scene_Weapons_Upgrade
#------------------------------------------------------------------------------
#  This class performs the weapon upgrade processing.
#==============================================================================

class Scene_Weapons_Upgrade < Scene_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     weapon_up_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(weapon_up_index = 0)
    @weapon_up_index = weapon_up_index
    #@actor_index = 0
  end
  #--------------------------------------------------------------------------
  # * Start processing
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background
    create_select_window
    @gold_window = Window_Gold.new(384, 360)
    @character_window = Window_Char_WeaponStatus.new(0, 0)
  end
  #--------------------------------------------------------------------------
  # * Termination Processing
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @select_window.dispose
    @gold_window.dispose
    @character_window.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    @select_window.update
    @gold_window.update
    @character_window.update
    if @select_window.active
      update_select_selection
    elsif @character_window.active
      update_actor_selection
    end
  end
  #--------------------------------------------------------------------------
  # * Create Command Window
  #--------------------------------------------------------------------------
  def create_select_window
  #-------- Menu Vocabulary -------------A34sZ1A ------------------------
    s1 = "Upgrade"
    s2 = "Exit"
  #------- Menu Vocabulary End-------------------------------------------
    @select_window = Window_Command.new(160, [s1, s2])
    @select_window.x = 384
    @select_window.index = @weapon_up_index
  end
  #--------------------------------------------------------------------------
  # * Update Command Selection
  #--------------------------------------------------------------------------
  def update_select_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      case @select_window.index
      when 0      # Upgrade
        start_actor_selection
      when 1      # Back
        return_scene
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Start Actor Selection
  #--------------------------------------------------------------------------
  def start_actor_selection
    @select_window.active = false
    @character_window.active = true
    if $game_party.last_actor_index < @character_window.item_max
      @character_window.index = $game_party.last_actor_index
    else
      @character_window.index = 0
    end
  end
  #--------------------------------------------------------------------------
  # * End Actor Selection
  #--------------------------------------------------------------------------
  def end_actor_selection
    @select_window.active = true
    @character_window.active = false
    @character_window.index = -1
  end
  #--------------------------------------------------------------------------
  # * Update Actor Selection
  #--------------------------------------------------------------------------
  def update_actor_selection
    if Input.trigger?(Input::B)
      Sound.play_cancel
      end_actor_selection
    elsif Input.trigger?(Input::C)
      $game_party.last_actor_index = @character_window.index
      upgrade_weapon($game_party.last_actor_index)
    end
  end
  
  #--------------------------------------------------------------------------
  # * Upgrade Weapon Selected
  #--------------------------------------------------------------------------
  def upgrade_weapon(actor_index)
    @actor = $game_party.members[actor_index]
    n = @actor.weapon_id
    equiped_weapon = $data_weapons[n]
    if equiped_weapon == nil
      Sound.play_buzzer
    else
      #--------Item Max Level-------------A34sZ1A -----------------------
      # Change the number after "if equiped_weapon.level >="
      # to whatever you want the max weapon level to be
      if equiped_weapon.level >= 20
      #--------Item Max Level End----- ---A34sZ1A -----------------------
        Sound.play_buzzer
      else
        Sound.play_decision
        Akin_Weapons.level_up(equiped_weapon)
      end
        @character_window.refresh
    end
  end
  
  #--------------------------------------------------------------------------
  # * Return to Original Screen
  #--------------------------------------------------------------------------
  def return_scene
    $scene = Scene_Menu.new(0) #Change this number to the options spot -1 on main menu
  end
end


# This edits the Scene_File class to add on saving and loading of weapon levels
class Scene_File < Scene_Base
  #-------------------------------Alias List
  alias akin_weaps_write_save_data write_save_data
  alias akin_weaps_read_save_data read_save_data
  
  def write_save_data(file)
	akin_weaps_write_save_data(file)
	Marshal.dump($data_weapons,        file)
  end
  
  def read_save_data(file)
	akin_weaps_read_save_data(file)
	$data_weapons         = Marshal.load(file)
  end 
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top