Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
@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,682
Reaction score
3,005
First Language
Tagalog
Primarily Uses
RMVXA
This is indeed quite the wrong place for it though :)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,734
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
248
Reaction score
76
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

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,305
Reaction score
11,734
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
248
Reaction score
76
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
248
Reaction score
76
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,760
Reaction score
949
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
6,170
Reaction score
7,377
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
46
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
722
Reaction score
558
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
6,170
Reaction score
7,377
First Language
Indonesian
Primarily Uses
RMVXA
Your question might be better if you create a new thread for more visibility than asking it here.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
507
Reaction score
13
First Language
english
Primarily Uses
RMVXA
What would be the setup for an if statement for a skill that compares the users and targets attack/m.atk/hp and then do damage based on the outcome. For example I am trying to make a skill that is based on the users attack vs the targets attack. If the user has higher attack then the skill does double the damage, but it only does half if the targets attack is higher.
 

Latest Threads

Latest Profile Posts

Zaj
Okay anothe stupid question from me. Why is when everyone's explaining the scripts in the scriptlets, it chnge into green. how do i know when do i code without knowing whether its turning green or not
So I realized that I really just don't have enough time to make videos. However I don't mind clicking stream and just letting people watch me work on my game. I don't really have a good microphone... okay it's a $20 headset so it's terrible, and I have no web cam. So the stream would largely be royalty free music and me working, with minor interaction. I guess the question is, would that actually interest anybody?
Child base test two, flappin' their arms like it's VX Ace.
ChildTest-02.gif
Zaj
Hi quick question. Is it possible for me to make a custom VXAce script without learning some bulkiness of Ruby?

Forum statistics

Threads
111,325
Messages
1,060,201
Members
144,638
Latest member
Larshpe
Top