How to make the most of custom formulae. Part #1

Since you know exactly how much TP/MP is used per skill, that is SO EASY to do...

want it additive?

Code:
damage_original + mp_cost_value_here
Want it as a multiplier?
Code:
damage_original*mp_cost_value_here
It's just basic arithmetic, really
Since you know exactly how much TP/MP is used per skill, that is SO EASY to do...

want it additive?

damage_original + mp_cost_value_hereWant it as a multiplier?
Code:
damage_original*mp_cost_value_here
It's just basic arithmetic, really
Either way works, I just wanted to know the formula
That is the FORMULA. If you can't understand that, I suggest you study a bit more arithmetic... oh wait, no, algebra I mean.
how can i make a formula where the skill hits 3 random enemies.

the first get full damage, the second dmg/2 and the third dmg/3 

how can i set up this one?
how can i make a formula where the skill hits 3 random enemies.


the first get full damage, the second dmg/2 and the third dmg/3 


how can i set up this one?
That is rather difficult to do in the limited place of the damage formula.
You'll need a scripted function that will be called by the damage formula, checking and counting itself to return different damage values.


can that skill be used multiple times in the same combat turn, or can it be used only once per turn (for example, only one actor can have it)? If it is a spell that can be used by several mages or multiple times per turn, then the logic for checking the current damage value will be even more difficult...


If you really want such a skill, I suggest you make a script request topic for it, and give a more detailed description there.
You can do it via quite a few manipulations of the damage formula, but there might be a problem for when the skill doesn't hit 3 enemies / 3 times...
Hi. I'm trying to think of a formula that would simultaneously decrease the actor's current HP and add a small amount to their maximum HP. Let me explain a bit more clearly.

I want to simulate physical work in my project. So while a task tires the actor out (the damage to their HP), it also builds up their stamina in the long run (the increase in max HP).
a.hp -= value;a.add_param(0,VALUE_TO_ADD_TO_MAX_HP);damage_if_ever


Note: 0 is the id of the param maximum hp
I must say, seeing a minus sign in front of an equals sign is odd... but regardless, thank you for your help.
that is the shortcut operator for this:


a.hp = a.hp - value


most programming languages that I've used has those shortcut operators
is there a way to do a spell that does damage according to level?

ex:

30 + a.mat * Herolevel
What you wrote would become:

Code:
base + a.stat * a.level
[a.stat: a.mhp, a.mmp, a.hp, a.mp, a.atk, a.def, a.mat, a.mdf, a.luk, a.agi, a.level are the ones I know of]
oh, you're right, never seen level part... whops, thanks anyway.
I need somebody to doublecheck and/or correct this damage formula I'm working with.

Basically the idea is to create a system with Push attacks (you can see these in action in Shin Megami Tensei: Nocturne).  If an enemy has an elemental weakness (defined by me as a certain passive state - 38; there's a state for each element) when they are hit by a particular skill, they're inflicted with another state "Overwhelm" (State 36) which basically binds their movement, and lowers their EVA, and raises their PDR and MDR while the state is active.  This state wears off automatically in two turns. [[i'm using Yanfly's Passive States to accomplish this.  It seemed like the easiest way to do it.]]

Here's my formula:

 a.mat + a.mat * 20 - b.mdf * 10; if b.state?(38);b.add_state(36); end;

The state triggering is working fine in battle, but I think I maybe didn't set it up quite right.  Sometimes the skill seems to target an enemy other than the one in the targeting phase.  I don't know if the damage is being calculated properly out there at the front either.  Should it all be an if else?  If B State is 38 then do the damage and inflict state 36, otherwise just do the damage, end?  I'm not really sure about the syntax, so I would appreciate the help.
damage should always be the last part of the formula

Code:
if b.state?(38);b.add_state(36); end;a.mat + a.mat * 20 - b.mdf * 10
But how would one set up the formula so that there is X% chance of the second state being inflicted?  That's the bit that's always defeated me.
25% chance:

Code:
if b.state?(38);if rand(100)<25;then;b.add_state(36);end; end;a.mat + a.mat * 20 - b.mdf * 10
Note: less than 25 because random starts from 0 to value_inside_parenthesis - 1, so rand(100) will yield anything from 0-99... 0-24 is already 25 numbers 🙂
Thanks very much for this. Will try it out tomorrow.
One thing to be careful of --- enemies do not have a level.  Only players seem to.  So, any attack which increases by level will never increase for enemies.

Also, can I make a common event which takes, say, HP from the player and uses it to damage the enemy?  I'm thinking of a Dark Knight class which can absorb HP, but whose Curses require HP instead of MP...
@white - of course enemies don't have levels... 🙂

as for the question, you can even just use the damage formula for that...

for no life safety buffer (meaning the user can die etc):

Code:
a.hp-=value;damage_here

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-the-most-of-custom-formulae-part-1.1143/