Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Equipment Stat Bonuses on Level Up
BigEd781
post Dec 3 2008, 11:33 AM
Post #1


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




Equipment Stat Bonuses on Level Up

This script must have been written already, but I couldn't find it. Someone made a request and this is simple enough, so I made it. This script will allow you to use the notes field of a weapon or armor to give the player stat bonuses when they gain a level.

Fixed a bug that occurred when the player had an empty equipment slot...oops...

Configuration / Use

Just drop the script in the Materials section.

To give a piece of equipment a stat bonus, simply add a line to the Notes section like this:

CODE
[stat mod]stat,num


"stat" = The name of the attribute to raise or decrease. This can be "hp", "mp", "atk", "def", "spi", or "agi", without the quotes.
"num" = The amount by which to increase the specified attribute.

For example, if you wanted a sword to increase the player's attack by two every time they gained a level, you would add this to the notes field of that sword:

CODE
[stat mod]atk,2


If you later want a sword that raises HP 10, attack 2, defense 4, but removed 3 agility points, you would do it like this:

CODE
[stat mod]hp,10
[stat mod]atk,2
[stat mod]def,4
[stat mod]agi,-3


White spaces and case are ignored.


Script
CODE
#                                                                              #
#                           Equipment Stat mods                                #
#                               by BigEd781                                    #
#==============================================================================#
module RPG
  
  class BaseItem
    
    def get_stat_bonuses
      bonuses = {}
      note.each { |line|
        line.downcase!        
        line.gsub!(' ', '')
        if line.include?("[statmod]")          
          pair = line.gsub("[statmod]", '').split(',')                    
          bonuses[pair[0]] = pair[1].to_i
        end
      }
      return bonuses
    end
    
  end
  
end

class Game_Actor < Game_Battler
    
  alias :eds_old_level_up :level_up
  def level_up
    eds_old_level_up
    equips.compact.each { |equip| apply_equip_stat_bonus(equip) }          
  end    
  
  def apply_equip_stat_bonus(equip)
    equip.get_stat_bonuses.each_pair { |key , value|        
        case key
          when "hp"  : self.maxhp += value
          when "mp"  : self.maxmp += value
          when "atk" : self.atk += value
          when "def" : self.def += value
          when "spi" : self.spi += value
          when "agi" : self.agi += value
        end
      }            
  end
  
end


Compatibility

This script will not be compatible with scripts that extend the number of attributes a player has. This can be easily fixed however if you give me the script that you are using. I don't foresee any other problems.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Puppet Of Fate
post Dec 3 2008, 11:45 AM
Post #2


Please join my site!
Group Icon

Group: Revolutionary
Posts: 675
Type: Mapper
RM Skill: Advanced




*Big eyes* I like! happy.gif


__________________________
Go to the top of the page
 
+Quote Post
   
icecold49
post Dec 4 2008, 01:06 PM
Post #3


My rmvx project is taking longer than I expected...
Group Icon

Group: Revolutionary
Posts: 116
Type: Developer
RM Skill: Advanced




This looks awesome, man. I might just use this in my game. Thanks for the script.

This post has been edited by icecold49: Dec 4 2008, 01:07 PM


__________________________
Go to the top of the page
 
+Quote Post
   
Twilight27
post Dec 4 2008, 02:26 PM
Post #4


Level 19
Group Icon

Group: Revolutionary
Posts: 371
Type: Event Designer
RM Skill: Beginner




I don't think I'll use it, but will still give ideas; depending though...

When you level up...do some message windows open up saying what and what stats have increased?


__________________________

Fall to the power of the Emo!
We have cookies!


Notice!! Check out my topic (http://www.rpgrevolution.com/forums/index.php?showtopic=45736&st=0#entry454175) if you're interested in helping me make a script that limits the number of characters & items you use in battle AND also an item durability feature! Thanks for any help in advance!
Go to the top of the page
 
+Quote Post
   
BigEd781
post Dec 4 2008, 03:20 PM
Post #5


No method: 'stupid_title' found for `nil:NilClass'
Group Icon

Group: Revolutionary
Posts: 1,829
Type: Scripter
RM Skill: Undisclosed




No, and they will not. That can be done with other scripts. I made a script that does just that a while back, but this script serves only this one purpose.


__________________________
`
Give me teh codez!!!


I am the master debator!
Go to the top of the page
 
+Quote Post
   
Twilight27
post Dec 4 2008, 04:05 PM
Post #6


Level 19
Group Icon

Group: Revolutionary
Posts: 371
Type: Event Designer
RM Skill: Beginner




QUOTE (BigEd781 @ Dec 4 2008, 07:20 PM) *
No, and they will not. That can be done with other scripts. I made a script that does just that a while back, but this script serves only this one purpose.


Oh ok; just thought that would have been a nice feature all in one script.


__________________________

Fall to the power of the Emo!
We have cookies!


Notice!! Check out my topic (http://www.rpgrevolution.com/forums/index.php?showtopic=45736&st=0#entry454175) if you're interested in helping me make a script that limits the number of characters & items you use in battle AND also an item durability feature! Thanks for any help in advance!
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 18th May 2013 - 01:09 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker