- Joined
- Dec 2, 2015
- Messages
- 73
- Reaction score
- 12
- First Language
- Spanish
- Primarily Uses
- RMMZ
Hi!
Before anything sorry for my english, this is a difficult dubt and I will try my best to be understood. Please excuse my english and ask me anything (and correct me) if it's not clear enough.
I'm trying to create "Goblin Punch" similar to FF9 Version in MZ:
I created a formula, but I need to make a value absolute to make it work (I don't know if this is how it is said in english |x|).
My formula is the next one, but I still didn't know the exact value of the base damage (20 in the original), so let's call it just "base damage" until then:
or
I'll try to explain, as I said I'm trying to use the original formula. I know I can substitute so many variables in just one long formula, but I wanted to cut it to explain, and ask for help.
First is to determine "g", that is the base in the original formula, what is the min number of times "c" will repeat if levels are equals (so It's different each time you hit, but always is c*g)
I needed a random between "g" and "g"+"g"/8, so I made a Math random of "g"/8 and then add "g".
The hard part is the second: suppose "c" is the 100% I needed to transform the differences between the levels into a percentage, the problem is that I need to make this value "h" (a.level-b.level) as an absolute, because I can't know what is bigger to be first, and I don't know how to set it in the formulae [I used the bars because it's how mathematically is written, but I don't know if this is right].
Once I have the difference, aka "h" as an absolute value I can transform it into a percentage 100-[h*10].
Here I have my second question: if the difference is 1, the effectiveness of the atack is 90% "c", if the difference is 10, the effectiveness of the atack is 0% "c". What if the difference is 11? will it heal? Is there anyway to set negative numbers as 0?
Then I added +1, because I don't like the "no-damage" pop up, so 1 damage is always good.
In resume:
Before anything sorry for my english, this is a difficult dubt and I will try my best to be understood. Please excuse my english and ask me anything (and correct me) if it's not clear enough.
I'm trying to create "Goblin Punch" similar to FF9 Version in MZ:
I have VS Enemy levels, so I can use a.level and b.level in the formulae.The damage dealt increases the closer the caster's level is to the target's. It is also affected by the caster's strength and the target's Defense, as well as any status effects.
I created a formula, but I need to make a value absolute to make it work (I don't know if this is how it is said in english |x|).
My formula is the next one, but I still didn't know the exact value of the base damage (20 in the original), so let's call it just "base damage" until then:
Code:
c = base damage ;
g = a.atm+a.level ;
e = (g/8) + 1 ;
d = Math.randomInt(e) + g ;
h = |a.level-b.level| ;
f = 100-(h*10) ;
a.level==b.level ? c*d : c*(f/100)+1
Code:
a.level==b.level ? 20*Math.randomInt((a.atm+a.level/8) + 1) + a.atm+a.level : 20*(100-(|a.level-b.level|*10)/100)+1
First is to determine "g", that is the base in the original formula, what is the min number of times "c" will repeat if levels are equals (so It's different each time you hit, but always is c*g)
I needed a random between "g" and "g"+"g"/8, so I made a Math random of "g"/8 and then add "g".
The hard part is the second: suppose "c" is the 100% I needed to transform the differences between the levels into a percentage, the problem is that I need to make this value "h" (a.level-b.level) as an absolute, because I can't know what is bigger to be first, and I don't know how to set it in the formulae [I used the bars because it's how mathematically is written, but I don't know if this is right].
Once I have the difference, aka "h" as an absolute value I can transform it into a percentage 100-[h*10].
Here I have my second question: if the difference is 1, the effectiveness of the atack is 90% "c", if the difference is 10, the effectiveness of the atack is 0% "c". What if the difference is 11? will it heal? Is there anyway to set negative numbers as 0?
Then I added +1, because I don't like the "no-damage" pop up, so 1 damage is always good.
In resume:
- How can I set an absolute value in formula?
- How can I transform a negative value into 0?
Last edited: