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.

Monster's Adaption!

Monster's Adaption
Version: 1.09

Introduction

This script makes it easily possible, to adapt the monsters' attributes to the actors' ones!

Features
  • individual adaption to the party's average attributes
  • Create ur own exp calculation
  • Editable random Gold gain based on exp
  • select ur Enemies adapted or adapt all and normalize the exceptions
  • [highlight]NEW[/highlight]: Extra Difficulty Level added (adjust the monsters to the player's skills)

Demo

u only need to copy and paste, there's no need for it...

Script

Code:
#==============================================================================
# Monster's Adaption Script v. 1.09
# by Caldaron (11.09.2006)
# thanks to Trickster for braining me :D
#==============================================================================
module Adaption
#==============================================================================
   #--------------------------------------------------------------------------
    # the higher the [...]_mod, the less the exp is given for it
    MAXHP_MOD       = 100.00
    MAXSP_MOD       = 100.00
    STR_MOD         = 20.00
    DEX_MOD         = 20.00
    AGI_MOD         = 20.00
    INT_MOD         = 20.00
    ATK_MOD         = 30.00
    PDEF_MOD        = 30.00
    MDEF_MOD        = 30.00
    EVA_MOD         = 0.10
    GOLD_MIN        = 50.00    # minimum gold value, percentage of exp
    GOLD_RAND       = 100.00   # the higher the value, the greater the variance/formula: (rand(gold_rand)+gold_min)/100.00
    GOLD_MULTIPLIER = 1.50     # last gold multiplier, also multiplies GOLD_MIN (sick, but i love it ;D)
    ADAPT           = true     # if u want the Adaption Mode mainly used :true
    ADAPTED         = []       # insert the Enemy's ID which uses the Adaption Mode (when ADAPT is false)
    NOT_ADAPTED     = []       # insert the Enemy's ID which uses the Normal Mode (when ADAPT is true)
    EXP_CALC        = true     # if true, exp calculation of not adapted Enemies is enabled
    GOLD_CALC       = true     # if true, gold calculation of not adapted Enemies is enabled
    DIFF_EXP        = true     # if true, the exp is multiplied by $game_system.difficulty
    
  # to change the Difficulty, set:
  # $game_system.difficulty = Value
  #--------------------------------------------------------------------------
#==============================================================================
end
#==============================================================================
class Game_System
  #--------------------------------------------------------------------------
  attr_accessor :difficulty
  #--------------------------------------------------------------------------
  alias adapt_init initialize
  def initialize
    @difficulty = 100          # multiplies all Attributes with this Percentage
    adapt_init
  end
  #--------------------------------------------------------------------------
end
#==============================================================================
class Game_Enemy < Game_Battler
  #--------------------------------------------------------------------------
  alias adapt_maxhp base_maxhp
  def base_maxhp
    return Integer(adapt_maxhp * adaption(0) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_maxsp base_maxsp
  def base_maxsp
    return Integer(adapt_maxsp * adaption(1) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_str base_str
  def base_str
    return Integer(adapt_str * adaption(2) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_dex base_dex
  def base_dex
    return Integer(adapt_dex * adaption(3) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_agi base_agi
  def base_agi
    return Integer(adapt_agi * adaption(4) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_int base_int
  def base_int
    return Integer(adapt_int * adaption(5) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_atk base_atk
  def base_atk
    return Integer(adapt_atk * adaption(6) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_pdef base_pdef
  def base_pdef
    return Integer(adapt_pdef * adaption(7) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_mdef base_mdef
  def base_mdef
    return Integer(adapt_mdef * adaption(8) * $game_system.difficulty/10000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_eva base_eva
  def base_eva
    return Integer(adapt_eva * adaption(9) * $game_system.difficulty/1000.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_exp exp
  def exp
    return Integer((adapt_exp * adaption(10))/100.00)
  end
  #--------------------------------------------------------------------------
  alias adapt_gold gold
  def gold
    return Integer((adapt_gold * adaption(11))/100.00)
  end
  #--------------------------------------------------------------------------
  def adaption(type)
    if Adaption::ADAPTED.include?(id) or (Adaption::ADAPT and not Adaption::NOT_ADAPTED.include?(id))
      adaption = 0
      for actor in $game_party.actors
        case type
        when 0
          adaption += actor.maxhp
        when 1
          adaption += actor.maxsp
        when 2
          adaption += actor.str
        when 3
          adaption += actor.dex
        when 4
          adaption += actor.agi
        when 5
          adaption += actor.int
        when 6
          adaption += actor.atk
        when 7
          adaption += actor.pdef
        when 8
          adaption += actor.mdef
        when 9
          adaption += actor.eva
        when 10
          if Adaption::DIFF_EXP            
            adaption = (maxhp/Adaption::MAXHP_MOD + maxsp/Adaption::MAXSP_MOD + str/Adaption::STR_MOD + dex/Adaption::DEX_MOD + agi/Adaption::AGI_MOD + int/Adaption::INT_MOD + atk/Adaption::ATK_MOD + pdef/Adaption::PDEF_MOD + mdef/Adaption::MDEF_MOD + eva/Adaption::EVA_MOD) * $game_party.actors.size
          else
            adaption = (maxhp/Adaption::MAXHP_MOD + maxsp/Adaption::MAXSP_MOD + str/Adaption::STR_MOD + dex/Adaption::DEX_MOD + agi/Adaption::AGI_MOD + int/Adaption::INT_MOD + atk/Adaption::ATK_MOD + pdef/Adaption::PDEF_MOD + mdef/Adaption::MDEF_MOD + eva/Adaption::EVA_MOD) * $game_party.actors.size * (100.00/$game_system.difficulty)
          end
        when 11
          adaption = exp * Adaption::GOLD_MULTIPLIER * ((rand(Adaption::GOLD_RAND)+Adaption::GOLD_MIN)/100.00) * $game_party.actors.size
        end
      end
      return (adaption / $game_party.actors.size)
    elsif Adaption::NOT_ADAPTED.include?(id) or (Adaption::ADAPT == false and not Adaption::NOT_ADAPTED.include?(id))
      if type == 9
        return 10.00
      elsif type == 10 and Adaption::EXP_CALC
        if Adaption::DIFF_EXP            
          return (maxhp/Adaption::MAXHP_MOD + maxsp/Adaption::MAXSP_MOD + str/Adaption::STR_MOD + dex/Adaption::DEX_MOD + agi/Adaption::AGI_MOD + int/Adaption::INT_MOD + atk/Adaption::ATK_MOD + pdef/Adaption::PDEF_MOD + mdef/Adaption::MDEF_MOD + eva/Adaption::EVA_MOD)
        else
          return (maxhp/Adaption::MAXHP_MOD + maxsp/Adaption::MAXSP_MOD + str/Adaption::STR_MOD + dex/Adaption::DEX_MOD + agi/Adaption::AGI_MOD + int/Adaption::INT_MOD + atk/Adaption::ATK_MOD + pdef/Adaption::PDEF_MOD + mdef/Adaption::MDEF_MOD + eva/Adaption::EVA_MOD) *(100.00/$game_system.difficulty)
        end
      elsif type == 11 and Adaption::GOLD_CALC
        return exp * Adaption::GOLD_MULTIPLIER * ((rand(Adaption::GOLD_RAND)+Adaption::GOLD_MIN)/100.00)
      else
        return 100.00
      end
    end
  end
  #--------------------------------------------------------------------------
end

Instructions

put this script above main

look at the variable descriptions, these should be sufficient
Example for Adaption:

Enemy's Attack is set to 100.
So, the Enemy's attack is set to the party's average attack.
when its attack is 200, the attack is the party's attack doubled.
got it? ;)

Incompatibility

not known...

Credits and Thanks

Credits to me :D
[highlight]GREAT[/highlight] Thanks to Trickster for braining me!

Author's Notes

IMPORTANT: when EVA is set to 10 it's 100% (because u can only max 100 input)

[highlight]Prevent cheating![/highlight]
when u unequip ur party, the enemies are weaker, but u can cast the highlevel spells, so give the enemies strong spells too (when actor.level is high enough)
 
Nice Work Caldaron

1) You can remove the methods you didn't edit to increase compatibility

2) Methods base_(stat) could have been aliased to increase compatibility

3) Why the use of the instance variable @adaption, its not being used throughout the class but only in that method, you can remove the @ and make it a local variable
 
Nice. If I set the enemy's attack to 50, will it be half the mean attack of the actors?

Also, about things like STR or DEX, do we just set those like normal?
 
@trickster(or seph):
1) did
2) did, but i don't like the aliases, because too much steal the overview...
3) did, although i don't know why this is better, but i'm sure u pm me...

@kaze950: it will be 50% of the party's average attack:
as u see here,
Example:
Basil has attack 200
Hilda has attack 100
the party's average attack is 150=(200 + 100)/2
when u set the enemies attack = 100 his attack is the party's average.
is his attack set to 50, his attack is 75=(150*0.5)
edit: yes it's all the same procedure, except for eva there is 10=100% because the maximum is 100
 
ok, i'm trying to do so...
but it's my first time using moules, so give me some time to understand (yeah i'm still learning to script)
thx

EDIT: bah, don't get it done, i'm just aliasing the initialize, that would be fine too
(pls pm me how to build in the module without defining all new variables)
 
1) The aliases you wrote are incorrect, you are still overwriting those methods
The methods you are trying to alias are "function" methods and the general format for aliasing them is this

Original method
Code:
def equation
  # Something is done to a variable
  # A Variable, some function or equation
end

Aliases like so
Code:
alias new_equation equation
def equation
  n = new_equation
  # Do whatever operations you wish
  return n
end

2) All of the new variables you added to Game_System are not readable so if you try to read them you will get a no method error

3)Instead of checking for the ~ in Game_System it would be much more effective if you checked for it in RPG::Enemy (this would also remove the need for adapted_enemies in Game_System since you could make a condition that checks if the ~ was there)

4) What's with this
Code:
sys = $game_system

5) If you want to use a module then all you have to do is this
Code:
module My_Module
  HELLO = 4.5
  GOODBYE = 5.6
end

and then you may reference those constants at any time by doing this

Module::Constant

so if I wanted to call HELLO then I would do
My_Module::HELLO
 
@trickster (ayayay, this is really embarassing)
1) ok, i want to do this:
Code:
  alias adapt_maxhp base_maxhp
  def base_maxhp
    return Integer(adapt_maxhp * adaption(0))/100.00)
  end
would this be alright?
EDIT: 'stack level too deep' !ARGH!
EDIT 2: NOOOOO! worked, only had 2 same aliases...(like the entertainment? ;))

2) hmm, worked fine for me, but i'm going to use the module now

3) trying to implement this

4) used for the [stat]_mod (sys.maxhp_mod)

5) now i get it, i always tried module Enemy (don't laugh! :D)

ok, thanks for the hints . i'm always giving my best to reach the goals u all want, but as u see with my own methods...
argh, never mind...*scripting*
 
Constructive Criticism at its finest ;) By the way, very cool idea Caldaron, now I don't have to make as many enemies lol
 
Caldaron said:
@trickster (ayayay, this is really embarassing)
1) ok, i want to do this:
Code:
  alias adapt_maxhp base_maxhp
  def base_maxhp
    return Integer(adapt_maxhp * adaption(0))/100.00)
  end
would this be alright?
EDIT: 'stack level too deep' !ARGH!
EDIT 2: NOOOOO! worked, only had 2 same aliases...(like the entertainment? ;))

2) hmm, worked fine for me, but i'm going to use the module now

3) trying to implement this

4) used for the [stat]_mod (sys.maxhp_mod)

5) now i get it, i always tried module Enemy (don't laugh! :D)

ok, thanks for the hints . i'm always giving my best to reach the goals u all want, but as u see with my own methods...
argh, never mind...*scripting*

1) Yes and be careful that you don't use the same names when aliasing

3) here I'll do the hard part
Code:
module RPG
  class Enemy
    alias new_name name
    def name
      return @name
    end
    def adaptable?
      #return true or false depending on conditions
    end
  end
end

4) Well seeing as Game_System is used as a global variable, why did you set an instance variable to it, if you were doing that to save some space then it would just be easier if you just split the code into multiple lines
 
script updated to version 1.05!
thx trickster, pls look at my script's adaptability...fine?

@ Da2DBM: yeah, for this i made it, i'm lazy too :D
but don't forget: only 20 enemies in ur game result penalty points
 
@trickster: :D thx :D

Announcement
version 1.06 will soon be uploaded!

The exp and gold calculation will be separated, to make this calculation available for not adapted monsters
 
Interesting. Correct me if I'm wrong (because I'm not exactly one of the brightest people on this forum) but what this basically does is automatically help your monsters stay challenging and help them keep up with the player statistically even after leveling quite abit beyond them?

If that's the case, this is going to end up saving me a ridiculous amount of time fiddling around with monster stats (one of my least favorite parts of messing around with RMXP).
 
It works like a charm so far. It's very neat.

Mucho Kudos. I've been waiting for a script like this to come down the pipeline for a long time.
 

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