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.

Breaking monster stats limit (other than HP and SP)

First, hello everybody (it's my first post here).
I am looking for a script that will either change or completly remove limits for stats for monsters.
I looked everywhere on this forum and partly I found what I needed- script for changing HP/SP limit.
That script is here: http://www.rmxp.org/forums/index.php?topic=37281.0
However I still need to change the limit for other stats like strenght or defense.
Thanks for the help.
 

poccil

Sponsor

Put the code below in the script editor before the last script section there.
See the constant ENEMYLIMITBREAK in the code below to learn how to customize it.
(This code replaces the functionality of the script you found.)

Code:
class Game_Enemy
  ENEMYLIMITBREAK={
#   EnemyID=>[MaxHP,MaxSP,Str,Dex,Agi,Int,Atk,Pdef,Mdef,Eva]
   1=>[20000,20000,20000,20000,20000,20000,20000,20000,20000,20000],
   300=>[10,20,30,40,50,60,70,80,90,10]
  }
  def statToIndex(stat)
   hash={
    :maxhp=>0,:maxsp=>1,:str=>2,:dex=>3,
    :agi=>4,:int=>5,:atk=>6,:pdef=>7,
    :mdef=>8,:eva=>9
   }
   if stat.is_a?(Symbol)
     return hash[stat]
   else
     return stat
   end
  end
  def limits
   @limits=[] if !@limits
   return @limits
  end
  def addLimitBreak(*stats)
   if stats.length==0
     10.times {|i| self.limits[i]=true }
   else
    for stat in stats
     self.limits[statToIndex(stat)]=true
    end
   end
  end
  def removeLimitBreak(*stats)
   if stats.length==0
     self.limits.clear
   else
    for stat in stats
     self.limits[statToIndex(stat)]=false
    end
   end
  end
  def hasLimit?(stat)
   return false if !limitStat(stat)
   return (self.limits[statToIndex(stat)]) ? true : false
  end
  def limitStat(stat)
   breaks=ENEMYLIMITBREAK[@enemy_id]
   return nil if !breaks
   return breaks[statToIndex(stat)]
  end
  def base_maxhp
    return limitStat(:maxhp) if hasLimit?(:maxhp)
    return $data_enemies[@enemy_id].maxhp
  end
  def base_maxsp
    return limitStat(:maxsp) if hasLimit?(:maxsp)
    return $data_enemies[@enemy_id].maxsp
  end
  def base_str
    return limitStat(:str) if hasLimit?(:str)
    return $data_enemies[@enemy_id].str
  end
  def base_dex
    return limitStat(:dex) if hasLimit?(:dex)
    return $data_enemies[@enemy_id].dex
  end
  def base_agi
    return limitStat(:agi) if hasLimit?(:agi)
    return $data_enemies[@enemy_id].agi
  end
  def base_int
    return limitStat(:int) if hasLimit?(:int)
    return $data_enemies[@enemy_id].int
  end
  def base_atk
    return limitStat(:atk) if hasLimit?(:atk)
    return $data_enemies[@enemy_id].atk
  end
  def base_pdef
    return limitStat(:pdef) if hasLimit?(:pdef)
    return $data_enemies[@enemy_id].pdef
  end
  def base_mdef
    return limitStat(:mdef) if hasLimit?(:mdef)
    return $data_enemies[@enemy_id].mdef
  end
  def base_eva
    return limitStat(:eva) if hasLimit?(:eva)
    return $data_enemies[@enemy_id].eva
  end
end


Here are examples of the script's use.  The variable enemy
represents a variable of the type Game_Enemy. 

# Add the max HP and Atk limit break
# Possible stats for this function are:
#  :maxhp      :maxsp
#  :str        :dex
#  :agi        :int
#  :atk        :pdef
#  :mdef        :eva
enemy.addLimitBreak:)maxhp,:atk)

# Add limit breaks for all of the enemy's stats
enemy.addLimitBreak

# Remove the max HP and max SP limit break
enemy.removeLimitBreak:)maxhp,:maxsp)

# Remove all limit breaks for the enemy
enemy.removeLimitBreak
 
Thanks for the effort, but I forgot to mention one thing.
I am not a Ruby specialist and I don't know how to edit a script so it's going to work (for exception of very simple and straightfoward edits, like in Marcel's Script where I could just change 15000 to whatever number I want).
I know where to paste that script (and I did it)...so, now what?
Where should I paste something like:
enemy.addLimitBreak
Simply editing the numbers in this line:
Code:
 1=>[20000,20000,20000,20000,20000,20000,20000,20000,20000,20000],
doesn't affect monster with ID 0001 at all (it still uses stats that are in the database).

Can you (or someone else) tell me what I should do in order to make this script work?
 

poccil

Sponsor

After further review, I understand that what you want is a way to assign parameters greater than the normal maximum in the database, and not to assign a temporary limit break, as I had done.  Use this code instead.

Code:
class RPG::Enemy
  ENEMYLIMITBREAK={
#   EnemyID=>[MaxHP,MaxSP,Str,Dex,Agi,Int,Atk,Pdef,Mdef,Eva]
   1=>[20000,20000,20000,20000,20000,20000,20000,20000,20000,20000],
   300=>[10,20,30,40,50,60,70,80,90,10]
  }
  %w[
      maxhp maxsp str dex agi int atk pdef mdef eva
  ].each_with_index do |s, i|
      eval <<-__END__
        def #{s}
          ENEMYLIMITBREAK[@id] ? ENEMYLIMITBREAK[@id][#{i}] : @#{s}
        end
      __END__
  end
end
 

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