What's wrong with this damage formula?

Evil_Nazgul0616

Veteran
Veteran
Joined
Aug 29, 2013
Messages
79
Reaction score
0
First Language
English
Primarily Uses
I have a boss that you have to fight with a temporary party member in your party. The gimmick to this fight is that the temporary party member has the only skill that can actually take a large chunk out of the boss's health.

The damage formula I'm using for said skill is this:

if b.id==94;9999;else;(150+a.mat*2-b.mdf*2);end

What it's supposed to do is check if the target is the boss (Which has an ID of 94 in the database) and if the target is indeed the boss, deal 9999 damage, and if not, use the skill's default damage formula. However, when I tested the skill against the boss, it did no damage at all.

So why isn't this formula working?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
Are you 100% sure that that is the correct way to identify the particular enemy?

It might be that you should be using

[SIZE=10.5pt]$game_troop.members[n].  where n = the index number of the particular enemy in the troop.[/SIZE]

[SIZE=10.5pt]Another possibility is that it should be[/SIZE]

[SIZE=10.5pt]def enemy?[/SIZE]
 

Evil_Nazgul0616

Veteran
Veteran
Joined
Aug 29, 2013
Messages
79
Reaction score
0
First Language
English
Primarily Uses
You could use Yanfly's Weapon Attack Replace or Vlue's Set Guard/Attack Skills to make the guest actor have access to a separate attack formula.
That's not quite the effect I'm looking for though, because I want the skill to do 9999 damage to the specific boss only, the skill will use its normal damage formula for every other enemy, and I want to refrain from creating two copies of the same skill unless there is no other choice. Furthermore, what you're suggesting is to replace the primary attack command of the guest actor with the skill, which I also don't want. (The skill is supposed to be separate from the main attack command.)
 
Last edited by a moderator:

Murd

Apprentice
Member
Joined
Jan 28, 2015
Messages
112
Reaction score
7
First Language
Thai
Primarily Uses
Guessing b.id is not a correct way of checking enemy's id so it returns 0 damage as else;.

Try if b.enemy_id=94; 9999; else; damage formula;end for instead (I don't test it myself coz' I'm at work lol).
 
Last edited by a moderator:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Here's a silly idea. Try setting the skill to do damage equal to b.id (for the short term), and no variance. If it does exactly 94 damage to that boss, then you know it is finding the id correctly and that is not the issue. I'd suggest trying that and reporting the result, as that would either prove the theory right that b.id doesn't work, or prove to everyone that this is not the issue.
 
Last edited by a moderator:

Evil_Nazgul0616

Veteran
Veteran
Joined
Aug 29, 2013
Messages
79
Reaction score
0
First Language
English
Primarily Uses
Here's a silly idea. Try setting the skill to do damage equal to b.id (for the short term), and no variance. If it does exactly 94 damage to that boss, then you know it is finding the id correctly and that is not the issue. I'd suggest trying that and reporting the result, as that would either prove the theory right that b.id doesn't work, or prove to everyone that this is not the issue.
I just tried this.The result was the same "<target> took no damage." message I got before.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,787
Reaction score
939
First Language
Chinese
Primarily Uses
N/A
Try this instead:

b.enemy? && b.enemy_id == 94 ? 9999 : 150 + (a.mat - b.mdf) * 2Yours doesn't work as in the default RMVXA, enemies doesn't use id. They use enemy_id instead.

When yours are run, it actually returns a no method error. There's no crashes however, as it's rescued by forcing the resulting damage to be 0.

Technically speaking:

attr_reader :enemy_id # enemy IDIs the Game_Enemy public instance variable returning the enemy's id.

def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) # Evaluates the item's damage formula 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) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) endIs the Game_Battler method using the damage formula.

def eval(a, b, v) [Kernel.eval(@formula), 0].max * sign rescue 0 # Returns 0 when the game would crash endIs the RPG::UsableItem::Damage method evaluating the damage formula.
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,583
Latest member
write2dgray
Top