Skills question

Hello! I recently started using RPG maker MV and have two questions about skills.

First is Holy Nova type of attack which both attack enemies and heal party.

-skill deal damage to all enemies based on its formula

-then skill heal party by percentage of their max HP

  • so first part is normal multi target magic attack
  • For healing part I set common effect under events -common event ->change HP ->whole party->increase
Now if I choose constant value spell work as intended but if I choose variable I don't know how to proceed further.

Common Event- Change HP:Entire Party, + {constant} THIS WORK - spell deal damage than heal party for constant value

Common Event- Change HP:Entire Party, + {variable} I'M STUCK HERE

What should be done in control variable window to make spell restore percentage or formula based amount of HP? To what values should I set variable operation and/or operand? Have I missed some obvious step?Or this can't be done?





Other question: I'm trying to make berserker type class. I gave him enrage type buff but without losing control :att buff and def debuff for few turns.

Now I want to give him some special attacks which are usable only when he is enraged. Is it possible to make skills like that which are usable only when character is inflicted by some state?
For Holy Nova, make it an HP damage skill and then write the following for your damage formula:

Code:
$gameParty.battleMembers().forEach(function(member) { member.gainHp(member.mhp * 0.1); }); DAMAGE FORMULA HERE

This will heal each party member for 10% of their HP and then deal [formula] damage to all enemies.

For your Enrage buff, it would be easier to do this using a plugin like Yanfly's buffs & states core, but if you really want to do a pluginless implementation of this:

Make a state called Enrage, with whatever turn duration/removal settings you want to set. Make a skill that adds the Enrage state and targets the user.

You then need to make a troop event with its activation trigger set to "Turn End" and Span set to "Turn". In this event, make a conditional branch for the berserker actor having the Enrage state (you'll have to do one for each actor if you have a class selection option in your game) with an else branch: in the true branch, do a "Learn Skill" command, and in the else do a "Forget Skill" command. That way, they'll only have the skill in their list if they're Enraged, and will lose it when they're not.
Common Event- Change HP:Entire Party, + {variable} I'M STUCK HERE

What should be done in control variable window to make spell restore percentage or formula based amount of HP? To what values should I set variable operation and/or operand? Have I missed some obvious step?Or this can't be done?
You need to store each individual character's max HP in a separate variable. Then, for each one, divide by the amount you want them to be healed for. Like, if you want them to be healed for 25% HP, divide their max HP variable by 4. Then, add the restore party HP for each individual character, instead of the whole party, otherwise they all get healed by the same amount instead of percentages based on their own max. HP.

Other question: I'm trying to make berserker type class. I gave him enrage type buff but without losing control :att buff and def debuff for few turns.

Now I want to give him some special attacks which are usable only when he is enraged. Is it possible to make skills like that which are usable only when character is inflicted by some state?
Have a Common Event run at the end of each battle turn that checks whether or not the character is inflicted with the Enrage state. If he is, have it add the skills to the character. If he's not, have the event remove them.
Thank you very much.
Both skills now work flawlessly.
Just one more question: I see that damage formula is way more powerful tool than I thought.

$gameParty.battleMembers().forEach(function(member) { member.gainHp(member.mhp * 0.1); }); DAMAGE FORMULA
It work great but I have no idea why and how does it work.
Is there any tutorial/documentation where I can learn more about it? I would be glad to learn more.
I cover this in my Jump into Javascript series: https://forums.rpgmakerweb.com/inde...lanation-of-the-default-js-files-in-mv.74928/

But for a quick explanation:

$gameParty is a global variable holding all party data and representing an instance of Game_Party. battleMembers() is a function of that class which returns, as an array, all members of the party who are currently participating in battles.

Because the return value is an array, we can use functions of Array.prototype on it. forEach is one such function, which iterates through all elements of an array and applies the supplied function to it. We track which party member we're currently dealing with by giving the function for forEach a parameter, which in this case we've called "member". Inside this block, member will return the Game_Actor associated with the party member currently under consideration.

Because we've got a Game_Actor in the block, we can use functions of that class, such as gainHp, which causes the actor in question to gain an amount of HP equal to the argument given to it. If we want to regain 10% HP, we just multiply the member's maximum HP, which we can get via the mhp property, by 0.1. The semicolon ends the statement, and then we can define the damage formula. The damage formula always needs to come last in the formula box because the final statement is the one that will determine how much damage/healing the skill does.
Awesome! Thank you so much.

Original thread: https://forums.rpgmakerweb.com/threads/skills-question.75742/