Yanfly's SKill Cost Manager (custom cost help)

noelburgundy27

Aspiring Jack-of-All-Trades
Veteran
Joined
Oct 12, 2013
Messages
44
Reaction score
8
First Language
English
Primarily Uses
N/A
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?
 

Imemperor

Animaniac
Member
Joined
Oct 26, 2013
Messages
19
Reaction score
7
First Language
English
Primarily Uses
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?
 
Last edited by a moderator:

noelburgundy27

Aspiring Jack-of-All-Trades
Veteran
Joined
Oct 12, 2013
Messages
44
Reaction score
8
First Language
English
Primarily Uses
N/A
Problem is, it reads the variable as a string, so the variable name comes up instead.
 

Fonstw

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

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)
 

Attachments

Last edited by a moderator:

Fonstw

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

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
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...
 

noelburgundy27

Aspiring Jack-of-All-Trades
Veteran
Joined
Oct 12, 2013
Messages
44
Reaction score
8
First Language
English
Primarily Uses
N/A
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.
 

Fonstw

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

Xtreeme

Villager
Member
Joined
Jul 30, 2014
Messages
7
Reaction score
0
First Language
Danish
Primarily Uses
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>
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

noelburgundy27

Aspiring Jack-of-All-Trades
Veteran
Joined
Oct 12, 2013
Messages
44
Reaction score
8
First Language
English
Primarily Uses
N/A
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.
 

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

Latest Threads

Latest Posts

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,074
Members
137,578
Latest member
JamesLightning
Top