Help with a particular skill cost formula string

shiori4me

Veteran
Veteran
Joined
Nov 26, 2013
Messages
196
Reaction score
6
First Language
English
Primarily Uses
I'm using Yanfly Skill Cost Manager http://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/skill-cost-manager/

I'm asking for what the normal ruby code would be for this to see if it's compatible with this script

(I would use Mr. Bubble Blood Magic but that doesn't support custom formulas, like skill exp affecting the cost of a skill and whatnot)

I'm trying to make it so that a skill will cost HP if state 26 Blood Magic is on, and will cost MP if state 26 is off.

I'm thinking something like

<custom cost perform>(self.hp -= (10 * self.xstat.hpc) / 100 if self.state(26)?) (self.mp -= (10 * self.xstat.mpc) / 100 if !self.state(26)?)</custom cost perform>in the comment box.

Mind you, self.hp -= (10 * self.xstat.hpc) / 100 and self.mp -= (10 * self.xstat.mpc) / 100 do work individually.

Don't mind the xstat.hpc and the xstat.mpc. Those are custom stats from Crystal's Extra Stats that mean HP Cost and MP Cost because I was having problems with the integer function of the regular mcr and whatnot and are irrelevant to my question.

How would I go about what I'm trying to make?
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
What is the script you're using? Please post a link.


I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
VX Ace thread? If you're talking about THIS thread, I moved it from there to here, because it's to do with a custom script ;)
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
Mind you, self.hp -= (10 * self.xstat.hpc) / 100 and self.mp -= (10 * self.xstat.mpc) / 100 do work individually.


How would I go about what I'm trying to make?
You first have to describe what you want to try to make, because you didn't even assign an operand between the two parts that work individually. If you want both single parts executed, then you need to tell the engine that they are two different commands - placing them in the same line without anything between them doesn't tell that to the engine...
 

shiori4me

Veteran
Veteran
Joined
Nov 26, 2013
Messages
196
Reaction score
6
First Language
English
Primarily Uses
I don't know what to put between them.

That part was to say that the mp and hp cost function work on their own.

self.hp -= (10 * self.xstat.hpc) / 100 

means

subtract HP by amount of (10 x HP Cost {which is defaultly 100, meaning 100%}) / 100

and

self.mp -= (10 * self.xstat.mpc) / 100

means

subtract MP by amount of (10 x MP Cost {which is defaultly 100, meaning 100%}) / 100

I want to make it so that if if the user has state 26 applied, the equation self.mp -= (10 * self.xstat.mpc) / 100 is applied, and if it is not applied, then self.hp -= (10 * self.xstat.hpc) / 100

self.state?(26) self.hp -= (10 * self.xstat.hpc) / 100 : self.mp -= (10 * self.xstat.mpc)does not work

Not even

<custom cost perform>a.state?(16) hp -= 100 : mp -= 20</custom cost perform>to simplify and test. 

Do you know how to do this?

Edit-

Turns out that

<custom cost perform>if self.state?(26) ; self.hp -= (10 * self.xstat.hpc) / 100; else; self.mp -= (10 * self.xstat.mpc) / 100; end;</custom cost perform> works.

But, what if I wanted multiple conditions? Like

if self.state?(26) or self.state?(27) or self.state?(30); self.hp -= (10 * self.xstat.hpc) / 100; end; if self.state?(31); self.tp -= (10 * self.xstat.tpc); else; self.mp -= (10 * self.xstat.mpc) / 100;end;meaning if you have the blood magic states of 26, 27, or 29, then it uses the HP Cost formula, and if you have state 31 then it uses the TP Cost formula, and elsewise it uses the MP Cost formula. 

You see, when I put in this code, using that end in the middle to divide them makes it out like 2 different conditions, where state 26 is active so it costs the user 10 HP, but state 31 is inactive so it also costs the user 10 MP, ultimately costing me 10 HP and 10 MP.

How would I make it so that it's 

If this then that and if this then that but elsewise then that
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
Your original formula is wrong because it's like this: (formula1)(formula2) it doesn't make sense... since ; is like a manual line break, it now worked... XD...


as for the second query, I think you want an elsif

Code:
if self.state?(26) or self.state?(27) or self.state?(30); self.hp -= (10 * self.xstat.hpc) / 100; elsif self.state?(31); self.tp -= (10 * self.xstat.tpc); else; self.mp -= (10 * self.xstat.mpc) / 100;end;
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

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
How many parameters is 'too many'??

Forum statistics

Threads
105,864
Messages
1,017,056
Members
137,573
Latest member
nikisknight
Top