Make minimum damage dealt 1 instead of 0

MusicTF

Soundtrack Composer
Veteran
Joined
Mar 30, 2015
Messages
102
Reaction score
8
First Language
English
Primarily Uses
Hi, 

I am looking for a script that makes the game work so that when an actor attacks an enemy (or vice versa) they always deal at least 1 damage to their target, even if the attacker has 3 ATK and the target has 999 DEF.  There are certain enemies in my game that give lots of EXP, but have massive defense and little HP, (like the metal monsters in "Dragon Quest/Warrior" games) and lower level actors can't touch them.

Thanks!
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
You don't need a script for this.  You can do this one of two ways.

In your damage formula box do this

[damage formula, 1].max

Apart from taking time, possible typos and omitted skills, Guarding and other skills can still reduce it to 0HP, so as an alternative:

[SIZE=10.5pt]Go to the [/SIZE]make_damage_value method in Game_Battler.

[SIZE=10.5pt]Right before this line:[/SIZE]

@result.make_damage(value.to_i, item)add this

Code:
if value > 0.0value = [value, 1.0].maxend
 
Last edited by a moderator:

MusicTF

Soundtrack Composer
Veteran
Joined
Mar 30, 2015
Messages
102
Reaction score
8
First Language
English
Primarily Uses
Thanks for your help, I can't believe you responded so fast!

ksjp17, that 3-line edit to the script you gave me didn't work, so I used the script Jackus gave the link to, and that works fine.
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Hmm, interesting. I'll have to look into that a bit more.  Thanks for mentioning.
 

MusicTF

Soundtrack Composer
Veteran
Joined
Mar 30, 2015
Messages
102
Reaction score
8
First Language
English
Primarily Uses
Hmm, interesting. I'll have to look into that a bit more.  Thanks for mentioning.
It could just be that I entered it wrong.  I'm not sure how RGSS3 handles white space, but I may have gotten the indentation wrong.  You were somewhat ambiguous in that respect for someone who doesn't know much about RGSS3
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
The whole little section should have ended up looking like this (I think)

Code:
# * Calculate Damage  #--------------------------------------------------------------------------  def make_damage_value(user, item)    value = item.damage.eval(user, self, $game_variables)    value *= item_element_rate(user, item)    value *= pdr if item.physical?    value *= mdr if item.magical?    value *= rec if item.damage.recover?    value = apply_critical(value, user, item) if @result.critical    value = apply_variance(value, item.damage.variance)    value = apply_guard(value)    if value > 0.0      value = [value, 1.0].max    end    @result.make_damage(value.to_i, item)  end
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
797
Reaction score
350
First Language
English
Primarily Uses
N/A
The edit won't work if there are scripts that overwrite make_damage_value.

I did an edit of my own and had to move it due to this issue.

You have to find the lowest version of the method and make your edits there.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top