Enemy Elements Authors: ThallionDarkshine Version: 0.1 Type: Enemy Stat Add-on Key Term: Enemy Add-on
Introduction
This script adds some variety to your random battles. You can define different "elements" for enemies, each of which can change different stats such as MaxHP, MaxSP, Strength, Dexterity, and many more. Then, you can give each enemy a different set of possible "elements" that the script will randomly choose from to apply. Thus, you could make weaker enemies with the "element" of minion, as I did in the script.
Features
Spices up random battles. You don't have to give any enemy an "element" if you don't want to. Use an unlimited number of "elements". Use combinations of elements.
Screenshots
You can't really capture stat changes in a screenshot.
Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120
In practice, if you set, for example, :maxhp = -25 you are setting the monster's maxhp to 75%? I'm not too much familiar with the instance_variable_get/set methods (to be honest, I didn't know they existed)... Anyway, nice addon. I feel it could be pretty useful
To improve compatibility, you should do something like this:
CODE
#==================================================== # ** aliases #==================================================== alias old_maxhp base_maxhp alias old_maxsp base_maxsp alias old_base_str base_str alias old_base_int base_int alias old_base_agi base_agi alias old_base_dex base_dex alias old_base_atk base_atk alias old_base_pdef base_pdef alias old_base_mdef base_mdef alias old_base_eva base_eva alias old_exp exp alias old_gold gold
def base_maxhp return old_maxhp * @maxhp_mod / 100 end
def base_maxsp return old_maxsp * @maxsp_mod / 100 end
def base_str return old_base_str * @str_mod / 100 end
def base_dex return old_base_dex * @dex_mod / 100 end
def base_agi return old_base_agi* @agi_mod / 100 end
def base_int return old_base_int * @int_mod / 100 end
def base_atk return old_base_atk * @atk_mod / 100 end
def base_pdef return old_base_pdef * @pdef_mod / 100 end
def base_mdef return old_base_mdef * @mdef_mod / 100 end
def base_eva return old_base_eva * @eva_mod / 100 end
def exp return old_exp * @exp_mod / 100 end
def gold return old_gold * @gold_mod / 100 end
If you replace the correct section of the script with this snippet, you should get rid of every compatibility issue (aliases are the most powerful ally you have while looking for compatibility).
Jens
__________________________
"Thorns are the rose's sweetest essence..." -Jens of Zanicuud
Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120
In practice, if you set, for example, :maxhp = -25 you are setting the monster's maxhp to 75%? I'm not too much familiar with the instance_variable_get/set methods (to be honest, I didn't know they existed)... Anyway, nice addon. I feel it could be pretty useful
To improve compatibility, you should do something like this:
CODE
#==================================================== # ** Game_Enemy #==================================================== class Game_Enemy < Game_Battler #==================================================== # * invariables #==================================================== ELEMENTS = { :minion => [[:maxhp, -50], [:atk, -25], [:maxsp, -63], [:exp, -50], [:gold, -50]], :brute => [[:maxhp, 12], [:atk, 3], [:maxsp, -21], [:exp, 4], [:gold, 4], [:dex, -9], [:agi, -8], [:mdef, -14]], } #==================================================== # * aliases #==================================================== alias tdks_elmnt_init initialize alias old_maxhp base_maxhp alias old_maxsp base_maxsp alias old_base_str base_str alias old_base_int base_int alias old_base_agi base_agi alias old_base_dex base_dex alias old_base_atk base_atk alias old_base_pdef base_pdef alias old_base_mdef base_mdef alias old_base_eva base_eva alias old_exp exp alias old_gold gold #==================================================== # * elements #==================================================== def self.elements(id) return case id when 0 then [] when 1 then [[:minion, :brute]] #this line is an example: gives the Ghost the minion and brute element else [] end end #==================================================== # ** initialize #==================================================== def initialize(troop_id, member_index) tdks_elmnt_init(troop_id, member_index) elements = Game_Enemy.elements(@enemy_id) @elements = elements.length > 0 ? elements[rand(elements.length)] : nil @atk_mod=@pdef_mod=@mdef_mod=@str_mod=@dex_mod=@agi_mod=@int_mod=@maxhp_mod =@maxsp_mod=@eva_mod=@exp_mod=@gold_mod=100 @elements.each{|element|Game_Enemy::ELEMENTS[element].each{|i|instance_variable_set("@#{i[0]}_mod",i[1]+instance_variable_get("@#{i[0]}_mod"))}if Game_Enemy::ELEMENTS.keys.include?(element)}if @elements @hp = maxhp @sp = maxsp end #==================================================== # * base_maxhp #==================================================== def base_maxhp return old_maxhp * @maxhp_mod / 100 end #==================================================== # * base_maxsp #==================================================== def base_maxsp return old_maxsp * @maxsp_mod / 100 end #==================================================== # * base_str #==================================================== def base_str return old_base_str * @str_mod / 100 end #==================================================== # * base_dex #==================================================== def base_dex return old_base_dex * @dex_mod / 100 end #==================================================== # * base_agi #==================================================== def base_agi return old_base_agi* @agi_mod / 100 end #==================================================== # * base_int #==================================================== def base_int return old_base_int * @int_mod / 100 end #==================================================== # * base_atk #==================================================== def base_atk return old_base_atk * @atk_mod / 100 end #==================================================== # * base_pdef #==================================================== def base_pdef return old_base_pdef * @pdef_mod / 100 end #==================================================== # * base_mdef #==================================================== def base_mdef return old_base_mdef * @mdef_mod / 100 end #==================================================== # * base_eva #==================================================== def base_eva return old_base_eva * @eva_mod / 100 end #==================================================== # * exp #==================================================== def exp return old_exp * @exp_mod / 100 end #==================================================== # * gold #==================================================== def gold return old_gold * @gold_mod / 100 end end
I've just rearranged your script. With all these aliases, compatibility is almost certain I've noticed this script is not so much user friendly... you should add some non-generic example to explain how to use it to newbies, in my opinion... BTW you surely earned your 5 Rev Points
Jens
__________________________
"Thorns are the rose's sweetest essence..." -Jens of Zanicuud