RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Variable Stat Booster for Enemies

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Variable Stat Booster for Enemies
Version: 1.0
Author: modern algebra
Date: November 24, 2010

Version History


  • <Version 1.0> 11.24.2010 - Original Release

Description


This script allows you to boost the stats of enemies in-game by modifying the value of a variable. It will affect only the stats that you specify and you can specify different variables for different enemies. One of the most obvious uses for this is to modify the difficulty of a game, but it may also be used to make certain enemies stronger at night, etc...

Features

  • Allows you to dynamically boost enemy stats in-game
  • Perfect for including new difficulty settings, boosting the difficulty of fights as the story progresses, or even making certain enemies harder at different times of the day
  • Can give different variables to different enemies
  • Can choose which stats are boosted and which stats aren't

Instructions

Place this script in its own slot above Main and below Materials in the Script Editor. Please see the header for configuration instructions.

Script


Code: [Select]
#==============================================================================
#    Variable Stat Booster for Enemies
#    Version: 1.0
#    Author: modern algebra (rmrk.net)
#    Date: November 24, 2010
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Description:
#
#    This script allows you to boost the stats of enemies in-game by modifying
#   the value of a variable. It will affect only the stats that you specify and
#   you can specify different variables for different enemies. One of the most
#   obvious uses for this is to modify the difficulty of a game, but it may
#   also be used to make certain enemies stronger at night, etc...
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Instructions:
#
#    Paste this script into its own slot in the Script Editor (F11) below
#   Materials but above Main.
#
#    Configuration for this script is pretty easy. Simply add which stats you
#   want to be modified via variable in the array at line 34. Then choose
#   a default variable that will apply to all enemies at line 43. If you want
#   to set it so that only certain enemies are affected by some other variable,
#   you can just put \boost[var_id] in that enemy's notebox. When set, the
#   enemy's stats will be boosted as a percentage. So, if the variable is set
#   to 80, then the enemy's stats will be at 80% the default.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Configuration:
#
# VSB_STAT_ARRAY - include the stats that you want a booster variable to
#  modify. You can use any of the following - :atk, :def, :spi, :agi, :hit,
#  :eva, :maxhp, :maxmp, :gold, and :exp. If using YEM New Battler Stats, then
#  you can also use :res and :dex.
VSB_STAT_ARRAY = [:atk, :def, :spi, :agi]
# VSB_BOOST_VARIABLE_ID - this is the ID of the default variable that you want
#  to affect all enemies. It will only apply to enemies that do not have a
#  boost variable specified in their notebox. If 0, then no variable will apply
#  by default. When the variable chosen is <0 or 100, then the enemy's stats
#  will be normal. Otherwise, they will be that percent of the regular. EX. if
#  the variable chosen is set to 120, then the enemy stats will be boosted to
#  120% of the regular. So, if the enemy's stat is normally 15, then a variable
#  at 120 will mean the enemy's stat is going to be 18.
VSB_BOOST_VARIABLE_ID = 1
#==============================================================================

#==============================================================================
# ** RPG::Enemy
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#  Summary of Changes:
#    new method - vsb_boost_variable
#==============================================================================

class RPG::Enemy
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Boost Variable ID
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  def vsb_boost_variable
    if !@vsb_boost_variable
      @vsb_boost_variable = self.note[/\\BOOST\[(\d+)\]/i].nil? ? VSB_BOOST_VARIABLE_ID : $1.to_i
    end
    return @vsb_boost_variable
  end
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Stat Aliases
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  VSB_STAT_ARRAY.each { |stat|
VSB_STAT_DEF = <<_END_
    alias malg_vsb_#{stat}_4vn1 #{stat} unless self.method_defined? (:malg_vsb_#{stat}_4vn1)
    def #{stat} (*args)
      if $game_variables && $game_variables[vsb_boost_variable]
        var = $game_variables[vsb_boost_variable].to_f / 100.0
      end
      var = 1 if var == nil || var <= 0
      return (var*(malg_vsb_#{stat}_4vn1 (*args))).to_i
    end
_END_
    eval (VSB_STAT_DEF)
  }
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  # * Compatibility Patch for Note Editor
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  if self.method_defined? (:ma_reset_note_values)
    alias mlg_vsb_resetnote_6yc4 ma_reset_note_values
    def ma_reset_note_values (*args)
      @vsb_boost_variable = nil
      mlg_vsb_resetnote_6yc4 (*args) # Run Original Method
    end
  end
end

Credit


  • modern algebra

Thanks

  • drew6464, for a similar request which inspired this script

Support


Please post in this topic if you have any suggestions or if you encounter any bugs. It doesn't matter how old the post is, put it here anyway and do not start a new topic or PM me.

Known Compatibility Issues

If using the Note Editor, it will require that you have the General Compatibility Patch and that this script is placed below the General Compatibility Patch. Otherwise, no currently known problems.

****
Rep:
Level 76
Praise the Sun (Arcana)
GIAW 14: 1st Place (Hard Mode)
Could I make the enemies get stronger as the player levels up? Kinda like how Oblivion does it.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Yes, with some minor eventing. All you'd need to do is set a variable to the player level, then increase the booster variable based on that value. You'd probably want to do it in a parallel process common event with maybe a 60 frame Wait at the end of it.

****
Rep:
Level 76
Praise the Sun (Arcana)
GIAW 14: 1st Place (Hard Mode)
Ah, why didn't I think of that. Thanks for the script.