The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: tSwitch on October 26, 2007, 07:57:04 PM

Title: SP+ when Defending v1.00
Post by: tSwitch on October 26, 2007, 07:57:04 PM
SP+ when Defending v1.00
Version: 1.00
Author: NAMKCOR
Date: October 26, 2007

Version History




Planned Future Versions

Description



adds SP to the actor (or possibly enemy) when they defend

Features


Screenshots

N/A

Instructions

simply configure the values as instructed and the script does the rest

Script




#=============================================================================
#   SP+ when Defending v1.00                                                 
#-----------------------------------------------------------------------------
#   Created By: NAMKCOR                                                                                                     
#   Created for the Websites: Chaos Project, RPG Maker Resource Kit
#                                        (www.chaosproject.co.nr; www.rmrk.net)                     
#   If this script is hosted on any other website, then it is stolen,
#   please contact me at the address given below       
#   Requested by: MrMoo (RMRK)
#-----------------------------------------------------------------------------
#   If you find any Bugs/Incompatability issues with this script, please contact
#   me at the following e-mail address: Rockman922@aol.com, and
#   please be descriptive with your e-mail subject, as I delete spam on sight.                                                                                                             
#-----------------------------------------------------------------------------
#   Function:                                                                                                                             
#    allows actors (and possibly enemies) to recover SP when defending
#                                                                         
#    Compatability:
#     most likely compatible with SDK (untested)
#     no known issues at the moment       
#
#     Instructions to modify:                                                                                                                     
#      Comments and instructions for the individual customizations will
#      be given right where they are located. 
#      Only real skills needed are reading, typing, and copy&paste
#
#     Instructions for use:
#       simply change the below values
#       as instructed and the script will do the rest
#       
#-----------------------------------------------------------------------------
#     Version History:
#     1.0 - completed system
#=============================================================================

class Scene_Battle
 
  alias make_basic_action_result_original make_basic_action_result
  def make_basic_action_result
   
    #==========================================================================
    # These values are here for you to configure :D
    #--------------------------------------------------------------------------    #
    # @SP_to_add = the number (or percent) of SP you want recovered when
    #               the actor (or possibly enemy) defends
    # @is_percent = determines if @SP_to_add is a percent or not
    # @actors_only = determines if enemies can heal SP when defending or not
    #==========================================================================
   
    @SP_to_add = 25
    @is_percent = false
    @actors_only = false
   
    #==========================================================================
    # DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
    #==========================================================================
    if @active_battler.current_action.basic == 1
      if @is_percent
        if @actors_only
          if @active_battler.is_a?(Game_Actor)
            recover_sp = @active_battler.maxsp * @SP_to_add / 100
          end
        end
      else
        if @actors_only
          if @active_battler.is_a?(Game_Actor)
            recover_sp = @SP_to_add
          end
        else
          recover_sp = @SP_to_add
        end
      end
      @active_battler.damage = -recover_sp
      @active_battler.sp += recover_sp
      @active_battler.damage_pop = true
    end
    make_basic_action_result_original
  end
end


Credit




Thanks


Support



If you find any Bugs/Incompatability issues with this script, please contact me at   
the following e-mail address: Rockman922@aol.com, and please be descriptive   
with your e-mail subject, as I delete spam on sight.

Known Compatibility Issues

incompatble with RTAB

Author's Notes

yay for script requests

Restrictions

Created for the Websites: Chaos Project, RPG Maker Resource Kit
(www.chaosproject.co.nr; www.rmrk.net)                     
If this script is hosted on any other website, then it is stolen, please contact me at either of the locations given

If you use this script in your game, please link me to the topic
I love to see what my work is used for

do NOT use this script in a commercial game unless you get my permission first
Title: Re: SP+ when Defending v1.00
Post by: djkdjl on October 26, 2007, 08:06:28 PM
that's a pretty useful script,,thx once again namkcor,,u did it again.
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on October 26, 2007, 08:08:39 PM
thanks, I do what I can :D
Title: Re: SP+ when Defending v1.00
Post by: modern algebra on October 26, 2007, 08:50:10 PM
Very nice. Another excellent script.
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on October 26, 2007, 09:48:33 PM
thanks, glad you like it, hope MrMoo got it
Title: Re: SP+ when Defending v1.00
Post by: :) on October 27, 2007, 01:15:46 AM
NAMKCOR...you rock!
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on October 27, 2007, 01:18:22 AM
;D thanks Nouman
Title: Re: SP+ when Defending v1.00
Post by: Leventhan on October 27, 2007, 02:51:11 AM
That's a very useful script!
Great Job ;D
Title: Re: SP+ when Defending v1.00
Post by: MrMoo on October 28, 2007, 08:34:29 PM
Oh noes :(
The very first error. I didn't implement the script till today, but I'm using an RTAB Ver.1.16 by Cogwheel and I got an error whenever I try to defend. The error takes place in cogwheel's script so I dunno if you could change the script to be RTAB compatible or not.

Here's a pic of the error message.
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fimg100.imageshack.us%2Fimg100%2F9171%2Fsadfacesb9.jpg&hash=52da0a36fd2ef5acc50fd94ea07f9ac688c1968a)
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on October 29, 2007, 07:02:29 AM
is my script below cogwheel's or above cogwheel's?

if the latter, put it below the RTAB
if the former, send me the scripts.rxdata so I can take a look
Title: Re: SP+ when Defending v1.00
Post by: modern algebra on October 29, 2007, 02:12:27 PM
It likely has to do with the fact that RTAB expects an argument for self.damage. Specifically, I believe it expects the attacker (Game_Battler), but I can't remember. I haven't looked at RTAB for a long time.
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on October 29, 2007, 02:14:43 PM
hmm...perhaps...
I would like to see the scripts.rxdata if the first fix doesn't work
if worse comes to worse, I could just merge them
Title: Re: SP+ when Defending v1.00
Post by: MrMoo on October 29, 2007, 10:38:27 PM
The script is below the RTAB right above main. I'll send you the rxdata through pm later today.
Title: Re: SP+ when Defending v1.00
Post by: :) on October 29, 2007, 11:31:46 PM
+10 rep.
;D
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on October 30, 2007, 12:21:11 AM
Quote from: MrMoo on October 29, 2007, 10:38:27 PM
The script is below the RTAB right above main. I'll send you the rxdata through pm later today.

alright, sounds good
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on November 11, 2007, 07:56:45 PM
alright, I'm having very little luck making this work with RTAB
no clue why it's not working, and RTAB is so confusing to look at that I can't figure out where to put it to merge it... :tpg:
Title: Re: SP+ when Defending v1.00
Post by: MrMoo on November 11, 2007, 08:11:06 PM
Lol then I guess it's too much trouble  :-\
Thanks anyways, this could still be useful to other people.
Title: Re: SP+ when Defending v1.00
Post by: tSwitch on November 11, 2007, 08:41:46 PM
it has to be possible, I'm just unsure how to do it cuz I don't know RTAB well enough :tpg: