Skill user's data

Hello RPG Maker community!

I am trying to get a skill to cost equal to the caster's level times 5. The effect of the skill will be, to heal the ally's HP equal to the caster's level times 10.

I tried using the damage formula like so:

a.mp >= a.level * 5 ? a.mp -= a.level * 5 && b.hp += a.level * 10 : 0 But that healed 0, and used up ALL the MP!

Then I tried to use Yanfly's Skill Cost Manager, and tried to do this:

<custom cost requirement>user.mp >= user.level * 5</custom cost requirement><custom cost perform>user.mp -= user.level * 5</custom cost perform>User refers to the Scene_Skill script, standard included in RPG VX Ace:

#-------------------------------------------------------------------------- # * Get Skill's User #-------------------------------------------------------------------------- def user @actor endAll I get is the following error message (before I even selected the skill itself):

Untitled.png

I understand that "user" does not exist in the current context (when showing the skill in the skill-menu, in-battle)

Although, I really don't know what else to use.

Yes, I am new to Ruby and scripting in RPG Maker, but not to programming with other languages.

If anyone could help me out, that would be much appreciated!
Instead of user, have you tried self? In other words, does it work if you used self.mp >= self.level * 5 for the cost requirement (and similar for the perform line)

Edit: I should add, mine is for the skill cost manager script. Ksjp17's solution (below mine) is for the damage formula.
A couple of things I don't understand with your formula

Why have you got

      a.mp >= a.level * 5 ?

What is the if statement doing in this context?

Also I do not understand why you have &&

Try this instead

a.mp -= a.level * 5; b.hp-= a.level * 10

EDIT

Perhaps I should have said this explicitly, but the MP cost box in the main part of the skill tab should be set at 0 for that formula to work, otherwise it will probably deduct whatever is there as well.
      a.mp >= a.level * 5 ?

Why have you got
Because it makes sure that I can't cast the skill as long as I don't have enough MP, ergo: I have 35 MP, skill costs 50, then it should skip tha whole formula.

EDIT: Also, I tried "a.mp -= a.level * 5; b.hp-= a.level * 10", and (again) it takes all MP and all HP.
Instead of user, have you tried self? In other words, does it work if you used self.mp >= self.level * 5 for the cost requirement (and similar for the perform line)
Hm. Why didn't I think of that 😉

But it worked, thank a lot!

Original thread: https://forums.rpgmakerweb.com/threads/skill-users-data.41850/