# Using level in damage calculation

#### SamBargeron

##### TV Moon Horse
A search of the MV forum didn't find any topics addressing this... so hopefully I'm not duplicating something that has already been discussed...

I'm experimenting with damage calculations for the basic attack skill for my first non-test project in MV. At some point I decided to experiment utilizing level in the calculations. In doing so I discovered a bit of an oddity.

If I use b.level, it will use the highest level of any actor in the party.

If I use a.level, it will use the current combatant's level unless it is a monster. If it is a monster, it will use the highest level of any actor currently in the party.

Now this is interesting to note as it, in some way, allows monsters to grow with the party.

But in other ways it's annoying as there is no way to set a monster's level if you don't want this to apply to them.

Anyway. I might have to make a "attack" skill that is specifically for monsters and only have PCs use the basic attack skill if I want to impliment level in the damage calculation.

So, I suppose I solved my own problem during the time it took me to get comfortable posting to the forum... but maybe this is an opportunity to discuss the implications of this?

(Also, I wish the Yanfly Core Engine allowed me to change monster stats with <stat: variable> instead of only defined integers. Then I could have an enemy's hp change based on the party's level, etc.)

#### Shaz

##### Veteran
We need to know more about the item/skill, and how you're using it.

Are you using it in battle or outside of battle from the menu?

What is the scope of the skill - the user, one ally?

Who is using it?

Since monsters don't have levels, you should not use it in a damage formula for any skill that will be used by a monster.

a is the person using the item, which has no meaning if it's an item that you use from the menu.

b is the target of the item, which could be confusing if the scope is set to All Allies.

Does it do the same thing if you're not using any plugins?

#### Ramiro

##### Now with an army of Mecha-Ralphs!
on a skill:

a.level should use the user's level, keep in mind the things shaz said too, enemies should not use this skill, unless you have a way to add a level to enemies (like a plugin)

Last edited by a moderator:

#### SamBargeron

##### TV Moon Horse
I'm refering to skill "0001: Attack" which is the default attack for players and uncustomized monsters.

Initially I tried the following calculation: (a.atk / b.def) + a.level

The intention was to make the minimum damage of an attack equal to the character's current level. I could list all the different ways I played with damage calculation, but for the purpose of this discussion they're probably irrelevant.

As my curiousity grew, I eventually changed the damage calculation to: a.level

I then used a fresh uncustomized monster against a level 5 character and a level 10 character.

The level 5 character did approximately 5 damage,

The level 10 character did approximately 10 damage.

The monster did approximately 10 damage regardless of his target.

The results I achieved worked both in a fresh project with no plugins and in my main project with many plugins. It seems to just be a quirk of the system.

This is a VERY abridged version of my various experiments tonight.

Anyway. It's not really a problem. I'll just make a new skill for monsters to use as I mentioned in my original post. But I thought people might enjoy what I learned and that maybe some interesting design could spring from this. For example, maybe you want monster damage to be influenced by the party's level (seeing as how the monster will utilize the highest level in the player's party for its own "a.level").

I'm new to the forums... so... something doesn't have to be a problem to be posted here, right? We can have just general fun discussions here? I'm sincerely unsure if I accidentally posted to a support area.

#### SamBargeron

##### TV Moon Horse
I see it now... yep... I'm accidentally in support... sorry... feel free to close or whatever the proper procedure is.

#### Shaz

##### Veteran
It's okay to have general discussions  We don't really have a specific area for engine-focussed discussions though.  But it doesn't make it any less interesting.

There is an isActor() function that you could use, if you wanted to share the command between actors & enemies, but only have the level part apply to actors:

Code:
``(a.atk / b.def) + (a.isActor() ? a.level : 0)``

#### SamBargeron

##### TV Moon Horse
That's awesome! Thanks Shaz!

(I really need to learn JavaScript...)

### Latest Profile Posts

Been updating my game's control scheme to optionally use a mouse. Now the player pixel moves towards the mouse destination, which looks super sweet with the sparkles. Also turns out I made a Mouse Common Event plugin at some point... Thanks past me. Now the mouse wheel cycles different forms, and the right mouse button activates that form's special.
Oh man the controls in Mario Sunshine are pretty awful and I haven't even witnessed the controls without FLUDD
Lots of cool changes for Battle Castle in the works! Not just reworked dialogue, but gameplay, combat, and possibly lore changes to make things weightier.