Yanfly's SKill Cost Manager (custom cost help)

http://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/skill-cost-manager/

Yanfly's Skill Cost Manager uses a tag <custom cost: |string|> which displays the new string as the cost.

I have a skill whose cost is dependent on character's level: self.level * 3

If I type that in the cost string, it will display as the algorithm itself "self.level * 3" and not the result (an integer).

How can I make it show the value of self.level * 3?
Haven't played around with the skill cost manager yet, but here's my 2 cent.

It's still going to cost MP, not user levels, right? Just that the MP cost is self.level * 3?

So make a variable that calculates self.level * 3 and add the tag <mp cost: whatever_variable>

Would that work?
Problem is, it reads the variable as a string, so the variable name comes up instead.
To reply to this, I shall LITERALLY refer to the script, which you should've read closely first! (PLEASE people!!!)

Lines 118 till 120 say: 

# <custom cost: string># If you decide to have a custom cost for your game, insert this notetag to# change what displays in the skill menu visually.A.K.A.: If you type <custom cost: 3×lvl MP>, the skill cost will show "3×lvl MP" in white.

122 till 124: 

# <custom cost colour: x># This is the "Window" skin text colour used for the custom cost. By default,# it is text colour 0, which is the white colour.Meaning that if you type <custom cost colour: 23> it will show in the default 'MP'-colour.

Now we actually make the cost 3× the level in MP value: 

Lines 142 till 148: 

# <custom cost perform># string# string# </custom cost perform># Sets how the custom cost payment is done with an eval function using the# strings in between. The strings are a part of one line even if in the notebox# they are on separate lines.In this case we want to put: 

<custom cost perform>

 self.mp -= self.level * 3

</custom cost perform>

Still keeping up?  😛

At last we want the game to know, that the skill can ONLY be used, when the MP is actually 3×level or over, otherwise the skill won't be usable at all!

Let's see what 134 till 140 say..: 

# <custom cost requirement># string# string# </custom cost requirement># Sets the custom cost requirement of the skill with an eval function using the# strings in between. The strings are a part of one line even if in the notebox# they are on separate lines.As I said, we want the skill to work when the MP is 3×level or over, so we put: 

<custom cost requirement>

 self.mp >= self.level * 3

</custom cost requirement>

And we're done.

If you've done it right, it should look like this in the editor: 

editor sample.BMP

And like this in-game: 

game sample a.BMP

(after casting, the lv.3 character loses 3×3=9 MP, and thus has 53-9=44 MP:

game sample b.BMP)
While we're here, does anyone know how to handle variables in raw script code?

'cause putting "variable[1]" or "var[1]" or "v[1]" doesn't seem to work with me.

(sorry for the nooby question though)
character's level: self.level * 3
One question: where did you get the idea that in the coded environment. "self" is the actor?
I haven't checked the script itself yet, but I don't think that self is the actor there, it will probably be some other class that has no level value...
While we're here, does anyone know how to handle variables in raw script code?

'cause putting "variable[1]" or "var[1]" or "v[1]" doesn't seem to work with me.

(sorry for the nooby question though)
' v[1] ' is expressed as  ' $game_variables[1] '

One question: where did you get the idea that in the coded environment. "self" is the actor?

I haven't checked the script itself yet, but I don't think that self is the actor there, it will probably be some other class that has no level value...
Yanfly's algorithm involved the use of 'self' in the notetags e.g. (self.mp). Since I was dealing with notetags, I thought that maybe it could be applied.

It was all based on assumption.

Looks like I got my solution in the other forum. Someone made an additional patch and it worked the way I wanted it too, which involves some doo-hicky mentioned above by Fonstw. Patch was made by estriole.

Link to Script Here. Just skip the ad.

The patch allows using a formula to form the digits you want. In essence, it can transform during battle.

i.e. A skill whose cost depends on a ( $game_variables[1] * self.level ). The script makes it possible to show the resulting data. Normally, it would just print a string. Now, it will evaluate the data returned by the formula with the help of the patch.
One question: where did you get the idea that in the coded environment. "self" is the actor?

I haven't checked the script itself yet, but I don't think that self is the actor there, it will probably be some other class that has no level value...
I know it usually doesn't work, but with this script it does work like that, I have checked it.
' v[1] ' is expressed as  ' $game_variables[1] '
Hehe, thank you...
Okay guys, how do I define hp cost from a variable, this does not work

<custom cost perform>

 self.hp -= $game_variables[3] 

</custom cost perform>
Xtreeme, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


If you have a problem, please open a new topic for it - very often something that looks similiar has different causes.
Forgive me, mod, but I want to try answering this to help satisfy. I was in a similar predicament before.

 Alright, Extreeme.... Add a semi-colon at the end of each string.

self.hp -= $game_variables[3];

Note the semi-colon. Yeah.

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-skill-cost-manager-custom-cost-help.19902/