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.

Weapons that increase SP

Simple enough request follows:

I need a script that allows certain weapons to add a certain amount of SP

FOR EXAMPLE:

Say I create a Bronze Sceptre and a Mythril Sceptre, and they can only be equipped by Gloria. I want Gloria's SP to raise by 200 when she is equipped with the Bronze Sceptre, and I want it to increase by 1000 when she is equipped with the Mythril Sceptre. How do I go about doing this?

EDIT: Whoops, forgot to note that this is for XP, if it helps
 
There's a workaround using only events.

Make a state, let's call it "add 10% SP"

Have a common event on Parallel. For the conditional switch, just make sure whatever switch is the Condition Switch is on will be on throughout the game.

Conditional Branch: [Player] is [WEAPON] equipped
> Change State [Player], + [ add 10% SP ]
Else
> Change State [Player], - [ add 10% SP ]
Branch End

Unfortunately I couldn't find a way to get a static number for the added SP.
 
I changed it a bit... this is what I did

Conditional Branch: [Player] is [WEAPON] equipped
> Change SP [Player], + X
Else
> Change SP [Player], - X
Branch End

That's all I changed and it didn't work...
Oh and X is the number that want the SP to increase by
 
^Yeah... I think I'll go with your test bed.

EDIT: One problem, When I put in the SDK script it comes up w/ this
____________________________________________________________________

Script 'SDK' line 22: LoadError occured

No such file to load -- RSC Hidden Files/The RMXP Standard Development Kit 2.3
____________________________________________________________________

All I did was copy the RSC Hidden Files folder and paste it in the folder with my project in it.
 
Just upload your whole project folder at a file storage site like, filefront.com,  box.net,  mediafire.com, or any other file storage site.
Then post the link to the file here. Then you're done! :thumb:
 

khmp

Sponsor

Still downloading it from the 17th :lol: I'll look at it for you.

At the very top of your project's script listings you forgot the RSC Require Script.
Code:
#==============================================================================
#  ** RSC Require
#------------------------------------------------------------------------------
#  Version 1.5.0
#  ? Yeyinde, 2007
#------------------------------------------------------------------------------
#  Usage: require('My_RSCFile') or rsc_require('My_RSCFile')
#==============================================================================

#-----------------------------------------------------------------------------
#  * Aliasing
#-----------------------------------------------------------------------------
if @rsc_original_require.nil?
  alias rsc_original_require require
  @rsc_original_require = true
end
#-----------------------------------------------------------------------------
#  * require
#       file : the file to load, rsc files will be handled in it's own method
#-----------------------------------------------------------------------------
def require(file)
  begin
    rsc_original_require file
  rescue LoadError
    rsc_require file
  end
end
#-----------------------------------------------------------------------------
#  * rsc_require
#           file : the RSC file which will be loaded. The .rsc extension may
#                   be ommited
#-----------------------------------------------------------------------------
def rsc_require(file)
  # Create error object
  load_error = LoadError.new("No such file to load -- #{file}")
  # Tack on the extension if the argument does not already include it.
  file += '.rsc' unless file.split('.')[-1] == 'rsc'
  # Iterate over all require directories
  $:.each do |dir|
    # Make the rout-to-file
    filename = dir + '/' + file
    # If load was successful
    if load_rsc(filename)
      # Load was successful
      return true
    end
  end
  # Raise the error if there was no file to load
  raise load_error
end
#-----------------------------------------------------------------------------
#  * load_rsc
#    file_name : the file to be evaluated
#-----------------------------------------------------------------------------
def load_rsc(file_name)
  file_name = file_name[2..file_name.length] if file_name[0..1] == './'
  # If the file exists and so does the encypted archive
  if File.exists?(file_name) && ENCRYPTED
    raise RSCSecurityError.new('Potential security breach: ' +
      '#{File.basename(file_name)} is a real file')
  end
  # Start a begin-rescue block
  begin
    # Load the data from the file
    script_data = load_data(file_name)
    # Iterate over each data entry in the array
    script_data.each_with_index do |data|
      # Store the script name
      script_name = data[0][0]
      # Store the script data after inflating it
      script = Zlib::Inflate.inflate(data[0][1])
      # Start a begin-rescue block
      begin
        # Evaluate the script data
        eval(script)
      # If there is an error with the script
      rescue Exception => error
        # Remove the (eval): from the start of the message
        error.message.gsub!('(eval):', '')
        # Get the line number
        line = error.message.sub(/:[\w \W]+/) {$1}
        # Get the error details
        message = error.message.sub(/\d+:in `load_rsc'/) {''}
        # Print the error and details
        print "File '#{file_name}' script '#{script_name}' line #{line}: #{error.type} occured.

#{message}"
        # Exit with value 1 (standard error)
        exit 1
      end
    end
    # Load was a success
    return true
  # No file to load
  rescue Errno::ENOENT
    # Load was a failure
    return false
  end
end

#==============================================================================
#  ** RSCSecurityError
#==============================================================================
class RSCSecurityError < StandardError; end

#---------------------------------------------------------------------------
#  ** Encrypted archive detection
#---------------------------------------------------------------------------
list = Dir.entries('.')
list.reject!{|file| File.extname(file) != '.rgssad' || 
                    File.basename(file) != '.rgssad'}
ENCRYPTED = !list.empty?

# Insert Game.exe's base folder into require array
$: << '.' unless $:.include?('.')
# Remove all nil objects
$:.compact!

Then move the SDK above all the custom scripts but below the default script Scene_Debug.
 
Thanks for that, but I still have one question: How exactly do I make the Actor Stat Bonuses work?

EDIT: Actually I have another problem:
_________________________________________________________________________________

Script 'Stat Bonus Base' line 101: NameError occured

undefined local variable or method 'seph_statbonusbase_bmaxhp' for #<Game_Actor:0x135c0a8>
_________________________________________________________________________________

No idea on how to go about this :down:
 

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