How to make the most of custom formulae. Part #1

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,670
Reaction score
2,992
First Language
Tagalog
Primarily Uses
@Kes uhm, I replied to this, in which he explicitly stated he wanted to know the MV version of the formula

 i cant seem to find something like this in MV thread so im trying my luck here.. anyways will the formula work on MV or just ace alone? do you know what formula to be used in mv? i have a mech class type.. and i have like 2-3 mech characters..
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,670
Reaction score
2,992
First Language
Tagalog
Primarily Uses
This is indeed quite the wrong place for it though :)
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,634
Reaction score
10,932
First Language
English
Primarily Uses
RMVXA
I'm trying to write a formula which increases the damage done by 1% for every decrease of 1% in the user's HP. What I have so far is this:


a.atk *4 - b.def * 2 + ((a.atk*4 - b.def * 2) * (a.mhp - a.hp)/a.mhp)

However, this produces zero damage and I can't see what my mistake is.
Can anyone enlighten me?
Thanks.
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
Hm, I do know that Ruby is a bit picky with spacing, so try and see if you should put some more spaces between your numbers and operators.

Anyway, this formula seems to be written correctly. The only way this formula should get a 0 is if you were trying to test this against an enemy with very high defense. For example, if a has 10 attack and b has 5 defense, that should be (40)-(10) which becomes a minimum of 30 damage, but b should need about 20 defense (40) to negate that attack.

Also, here's an alternate way to write your formula: (a.atk * 4 - b.def * 2) * (1 + (a.mhp - a.hp) / a.mhp)
 
  • Like
Reactions: Kes

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,634
Reaction score
10,932
First Language
English
Primarily Uses
RMVXA
@Harosata Arrghhh! It was a spacing issue. I must have been really tired when I typed that. Thank you for suggesting that.

Just out of curiosity I tried your version and it returned no more damage when the actor had 1HP than when he had 200. Multiplying the (a.mhp - a.hp) / a.mhp) by 1 is bound to give less than multiplying it by a.atk * 4 - b.def * 2 isn't it?
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
Hm, I'm pretty certain that your damage formula is (damage * 1) + (damage * 1 * percent), and if math/Excel serves correctly, I could rewrite that as damage * (1+ (1*percent)). Because if your HP is full, that should be damage + (damage * 1/1) or damage * 2.

Hm, I would say that the biggest problem with writing formulas is that some variables can convert the semi-answers to an integer instead of a float. Probably have to put a few .to_f in there so that results become more accurate.
 

gorggi70

Warper
Member
Joined
Nov 6, 2017
Messages
2
Reaction score
1
First Language
English
Primarily Uses
Other
Oh thank you great guide! Keep up the good work
 

Harosata

Dramatic Lightning's BFF
Veteran
Joined
Aug 20, 2015
Messages
246
Reaction score
70
First Language
English
Primarily Uses
RMVXA
Hm, a thought just occurred to me. State Resist [state] is a feature you'd normally give to ensure that a state is not added to a battler, and state_resist?(state_id) is its method. Now, I'd imagine that if there is an enemy resistant poison but you use a bomb to give them an illness, the formula could be written as:

if b.state_resist?(POISON); b.add_state(ILLNESS); end; 0

And yet consider this:

b.state_resist?(SMALL) ? 1000 : 10


This is a skilled called Stomp and it will deal a lot of damage if the target is small. That's right, we don't actually use a SMALL state but instead use it as a racial property by making the target Resist that state. This applies to both Actors and Enemies as well as anything linked to them, which would include Classes, Weapons, Armor and States. In other words, if we apply Shrink which has a State Resist[SMALL] in it, the affected target will return true for state_resist?(SMALL)

Now, here's another example, a purchased skill for everyone:
a.state_resist?(BEASTMAN) ? 100 : 75

Now, we can ideally give this to the Beastman member of our party for maximum damage. However, we can also transform into a "Beastman" or equip Beastman claws to also qualify for that higher damage.

And finally, something like Waltz, a dance between man and woman in the form of:
a.state_resist?(FEMALE) != b.state_resist?(FEMALE) ? b.add_state(CHARM) : b.add_state(CONFUSE)

Which can become a bit ridiculous if you have your male dancer dress up as a female to charm the majority of male enemies or if you have to transform all those enemies into girls first.

...I will admit, you can use notetags instead, but I figure this is an interesting way if you are uncomfortable with notetags. Also, you can use this method on the map (Entering a girls-only slumber party with disguises or chopping wood with an appropriate ax without having to check each individual equipment) but this topic isn't for that.

---

Theoretically, that should also qualify for other Features, but since most rates are multiplicative, I do not think it is easy to use State Rate to measure how Evil you are.
 

BCj

Veteran
Veteran
Joined
Jun 19, 2014
Messages
1,455
Reaction score
703
First Language
Dutch
Primarily Uses
N/A
Is it possible to have a sort of voidform state?

E.g. you use voidform, you gain let's say, 100 mana points, you can spend those mana points on anything that's linked to the voidform skill category, but the 100 mana depletes per turn?

Or:
You pop voidform, can use unlimited skills in voidform skill category for 4 turns, then it drops off and you go back to normal mode?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,718
Reaction score
5,398
First Language
Indonesian
Primarily Uses
RMVXA
I think the question deserve their own thread? not sure if custom formula alone could deal with it
 

Starke

Veteran
Veteran
Joined
May 12, 2012
Messages
44
Reaction score
12
First Language
Portuguese
Primarily Uses
RMVXA
This has been INCREDIBLY helpful for me. Just saved me hours and hours of testing. Thank you so much xD
 

kaukusaki

Awesome Programmer Extraordinaire
Veteran
Joined
Jun 27, 2013
Messages
672
Reaction score
496
First Language
English
Primarily Uses
RMVXA
Im trying to figure out how to make a mp draining heal hp. I'm probably over thinking it and after a week i can't get it working
Am i overlooking something?
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
4,718
Reaction score
5,398
First Language
Indonesian
Primarily Uses
RMVXA
Your question might be better if you create a new thread for more visibility than asking it here.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

40 card deck size, the plugin seems more sluggish.
Village theme I composed for a commission!
Stream will be live shortly with some Haunting Ground! Feel free to drop by!
welp, the stock market went down by 7% because of corona today. Time to buy stocks?
Man, being able to edit my game WHILE testplaying it is like the most convenient thing EVER. Thank you, MV...it even makes up for the OGG thing. Well, almost.

Forum statistics

Threads
94,560
Messages
921,889
Members
124,423
Latest member
Detulovnoc
Top