Modifiers and damage calculating not working

Hey there!

I’m pretty confused. The additive and percentage modifiers didn’t work and it everytime when I hit an enemy, it uses only the base stat damage value from the player. No additional weapon damage and no modifiers. This bug kept existing for a while but I always said “I fix it later”… and now … uhm… yeah :smiley:

I even don’t know which file to post here, so I can receive help :)!

As a rule, it’s a lot easier to nail down bugs like these as soon as they pop up, if the course is continuing on like they’re working. (There are sometimes some bugs that we fix later).

There are a lot of moving parts to the IModifierProvider and our Stats system.

The first place to check is to make sure that your Fighter script is implementing the IModifierProvider interface. Make sure the class declaration reads

public class Fighter : Monobehaviour, IModifierProvider //optional ISaveable, not sure where you are

Paste in your Fighter’s GetAdditiveModifiers and GetPercentageModifiers method.

Next, we need to make sure that we’re getting the modifiers in the first place.
Paste in your BaseStats.GetStat() method, and we’ll take a look there.

Ok, if I add the IModifierProvider it is working but I’m almost at the end of the abilities course and at some point the IModifierProvider was deleted from Fighter.

The modifiers in the StatsEquipableItem arent working. If I give the player for example a defense stat in the Progression it is added correctly but if I add a new Equipable Item, all the modifiers aren’t applied.

Apologies, I focused on fighter because this was linked jost to the RPG course.

More things to check:
Make sure that your player is using a StatsEquipment, not an Equipment class, and that the StatsEquipment is properly implementing the IModifierProvider interface like I pointed out to Fighter (we removed it from Fighter because it becomes redundant when using the StatsEquipment).

Make sure your StatsEquipment class is properly implementing the IModifierProvider interface.
Paste in your StatsEquipableItem and StatsEquipment GetAdditiveModifiers and GetPercentageModifiers.

It was the Equipment instead of StatsEquipment :smiley: ! Thanks!!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms