Is there a way to make one variable equal to a batch of variables?

I'm trying to make a skill where every enemy's hp and mp get halved, so I made a variable for each enemy 1-8's hp and mp, then I realized that would take forever so I came here thanks! 🙂
No need for all that ^^.

Go into your skill editor in the database and use this formula. It will halve the targets HP by there current health.

hp / 2 This is HP Damage

mp / 2 This is MP Damage

I think these would only work as separate skills though, you can probably force an action when one of the skills are executed.

!
I tried the hp one and it said null 😮 Did  do it wrong, or do I need to put something else with it? I'm not good with formulas lol
It should not say null. Copy and paste the formula out of your skill.


It should be HP damage with

Code:
b.hp / 2
or MP damage with
Code:
b.mp / 2
It should not say null. Copy and paste the formula out of your skill.

It should be HP damage with

b.hp / 2or MP damage with
Code:
b.mp / 2
Ah, I forgot to specify a or b xD
Oh I forgot the "b" thanks, now could I do hp and mp at the same time?
do this

Code:
b.mp*=0.5;b.hp/2
This way it halves the mp then deals half hp as damage
Two issues with that ...


b.mp*=0.5 is going to potentially leave you with fractions. Either do this:

b.mp/=2;b.hp/2or this:
Code:
b.mp = (b.mp*0.5).to_i;b.hp/2

Also, I suspect the log/popup/whatever notification you have, would only show the hp damage.


This is working on the assumption that you put HP Damage as the type for the skill. If you put it as MP damage, you would need to reverse the formula:

Code:
b.hp/=2;b.mp/2
otherwise it's going to calculate half the hp, then take that amount off MP instead.
Also, I suspect the log/popup/whatever notification you have, would only show the hp damage.
yes, it would only show the damage to HP.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-make-one-variable-equal-to-a-batch-of-variables.33132/