Gain certain stats from certain enemies?

Is it possible to fight enemies and when you kill it, you earn certain stats? For example:

I would fight a Snake

The snake is really fast, so every time I kill a snake, I gain 3 agility. Like, killing certain enemies as in you're training to be faster.

Is this possible?
if the battle is evented, this will be easy to do using event commands
It's certainly possible, and I'm working on and off on a script that allows you to set up all different kinds of similar effects (gain stats when you KO a certain foe, gain items when you Crit a foe with a certain skill, have a certain enemy stun you if you hit them with an Element they are Immune to, etc.).  But due to its complexity, this script is still probably several months off.

For now, the easiest way to do it would probably be to modify the Damage Processing method.  Check to see whether an enemy's HP has been reduced to zero or less, and if so, award the character that KO'ed that enemy some bonus stats.  Here's the original method:

#-------------------------------------------------------------------------- # * Damage Processing # @result.hp_damage @result.mp_damage @result.hp_drain # @result.mp_drain must be set before call. #-------------------------------------------------------------------------- def execute_damage(user) on_damage(@result.hp_damage) if @result.hp_damage > 0 self.hp -= @result.hp_damage self.mp -= @result.mp_damage user.hp += @result.hp_drain user.mp += @result.mp_drain endHere's a rewrite that would grant stats based on the enemy you KO'd.  In the example below, enemies 1, 2, and 3 are slimes that increase your Attack by 10 when you defeat them, and enemies 4, 5, and 6 are snakes that increase your Agility by 10.

#--------------------------------------------------------------------------# * Damage Processing# @result.hp_damage @result.mp_damage @result.hp_drain# @result.mp_drain must be set before call.#--------------------------------------------------------------------------def execute_damage(user)on_damage(@result.hp_damage) if @result.hp_damage > 0self.hp -= @result.hp_damageif (self.enemy? and user.actor? and self.hp <= 0) case self.enemy_id when 1, 2, 3 user.add_param(2, 10) when 4, 5, 6 user.agi += (6, 10) endendself.mp -= @result.mp_damageuser.hp += @result.hp_drainuser.mp += @result.mp_drainendThis does not cover a few fringe cases, such as an enemy that is KO'ed by Slip Damage, or an enemy that KO's itself (how would it know who to award the Kill to?).

Hope this helps!  Let me know if you try it and it doesn't work - I haven't tested it myself.  But I'm confident in the general concept, so if there's anything awry, it's probably just a single incorrect property or something.
user.atk += 2 user.agi += 3
These will not work. There is no way to just add onto a stat using that method. You would have to increase the param_plus value - which is an array of param id's and their bonus values.

Something like this is more appropriate:

#===============================================================================# Notetag: <pargain: param_id, value># param_id = 0..7 || value = amount to increase#===============================================================================class Game_Battler#=============================================================================== #----------------------------------------------------------------------------- # #----------------------------------------------------------------------------- alias :exe_dmg_par_gain :execute_damage def execute_damage(user) exe_dmg_par_gain(user) if enemy? && dead? && user.actor? if enemy.note =~ /<pargain🙁.*),(.*)>/i user.add_param($1.to_i,$2.to_i) end end end #----------------------------------------------------------------------------- # #-----------------------------------------------------------------------------endAnd that also allows you to notetag the enemies to give a different gain for each enemy ^_^
yeah Dekita is right... http://forums.rpgmakerweb.com/index.php?/topic/32732-modifying-params/
These will not work. There is no way to just add onto a stat using that method. You would have to increase the param_plus value - which is an array of param id's and their bonus values.
Ah, yeah, that was sloppy of me.  Thanks for the catch, Dekita.  Like I had mentioned, I had not tested it.  Modified my approach above to use "add_param" instead of "+=" .

if enemy? && dead? && user.actor?if enemy.note =~ /<pargain🙁.*),(.*)>/i

user.add_param($1.to_i,$2.to_i)
This is great!  Honestly, I've struggled in trying to incorporate notetags into my scripts.  (I've seen Galv's tutorial and it was a good start but I was still completely in the dark about how to use the concepts in more advanced ways.)  If you'd be up for making a tutorial on searching notetags for information (like the way you searched two different fields at once above, I assume looking for the comma as a separator), and how to associate that information to the actual game objects, I'm sure it would be a popular read on your website!
Personally I would avoid loading everything into param_plus because you have no idea which bonuses are coming from what.

Original thread: https://forums.rpgmakerweb.com/threads/gain-certain-stats-from-certain-enemies.34743/