Skill user's data

Fonstw

Lv.14 Jackrabbit
Member
Joined
Nov 6, 2013
Messages
20
Reaction score
1
First Language
Dutch
Primarily Uses
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!
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,712
First Language
English
Primarily Uses
RMVXA
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.
 
Last edited by a moderator:

Fonstw

Lv.14 Jackrabbit
Member
Joined
Nov 6, 2013
Messages
20
Reaction score
1
First Language
Dutch
Primarily Uses
      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.
 
Last edited by a moderator:

Fonstw

Lv.14 Jackrabbit
Member
Joined
Nov 6, 2013
Messages
20
Reaction score
1
First Language
Dutch
Primarily Uses
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!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top