Home
Help
Search
Calendar
Login
Register
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Click here to join us on IRC (#charas on irc.freenode.net)!
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Successful Hit Ratio
« previous
next »
Print
Pages: [
1
]
Author
Topic: Successful Hit Ratio (Read 2165 times)
aboutasoandthis
Exemplar
Posts: 1,915
Talking sucks.
Successful Hit Ratio
«
on:
August 20, 2006, 01:58:45 PM »
Anyone with a CBS, or knows how to make one please help.
I have new battle mechanics in my DBS and I'm trying to set up successful hit ratios. The mechanics are based on the DBS, but they're split up. That might sound confusing. I guess the easiest way to put it would be to do things like...splitting up the original "Intelligence" stat, into Magic and Magic Defense. This makes it easier for me to do things like having "Shell" as a condition, while leaving the original Magic stat alone.
===============================
Now, here's the question. I do not have a "Speed" stat in my game at all. I only have Evasion, Accuracy, and Magic Evasion as stats.
What would be the best way to set up a Successful Hit Percentage using those stats?
I can't just use the original Speed stat because that's an important part of my coding. If I mess with it at all, my entire battle system would get messed up.
I've already set up all of the Variables and Common Events to do this. I just need to put the Algorithms in the right Common Event to do this.
I have a decent understanding of programming. I should be able to follow whatever you post.
If you understood this.
Logged
My pokemon bring all the nerds to the yard, and they're like you wanna trade cards? Darn right, I wanna trade cards, I could trade this, but not my charizard.
Raen Ryong
Skyrunner of Dragonia
Associate
Posts: 130
Raen Ryong... Skyrunner. Dragonic Soveriegn entity...
(No subject)
«
Reply #1 on:
August 20, 2006, 02:59:19 PM »
If I understood correctly...
I'd say something along the lines of;
%Hit = 2a - b
Where a = accuracy
and b = evasion/magic evasion
That way you get a lot more hits than misses: it's very frustrating to play a game where you miss most of the time.
That way if we hypothetically test two people, each with 50 accuracy and evasion, they both have 50% chance of hitting each other;
%Hit = 2a - b
%Hit = (2*50) - 50
%Hit = 50%
So people with equal accuracy and evasion have 50% chance of hitting each other. I believe this to be the best way.
Logged
Raen Ryong...
Skyrunner of Dragonia...
Guardian of all worlds...
Hoard and covet not, but be brave and free. Quest always after knowledge and slowly learn to know what science cannot see. Seek and strive for learning, be temperate and wise, for skill and wisdom only will help us to survive.
aboutasoandthis
Exemplar
Posts: 1,915
Talking sucks.
Almost Perfect
«
Reply #2 on:
August 20, 2006, 03:17:25 PM »
That works great. My only problem now is, to make it a percentage. I want the stat to go up to 255 since it's an actual stat. Thanks for understanding it.
Logged
My pokemon bring all the nerds to the yard, and they're like you wanna trade cards? Darn right, I wanna trade cards, I could trade this, but not my charizard.
Meiscool-2
Sage
Posts: 7,030
If you support n00bs, you support communism.
(No subject)
«
Reply #3 on:
August 20, 2006, 03:23:01 PM »
You'll have to use Random Varibles for the %. Say the % is 50, then you'll make a random varible 0-1. If it's 1, you hit, if it's 0, you miss. There are ways to shorten this, which you should be able to find yourself.
As for the stat, go ahead and make it 255. I'm sure you'll still find enemies in the game with 255 evade.
Logged
Most Recent:
________________________
Old Stuff:
Raen Ryong
Skyrunner of Dragonia
Associate
Posts: 130
Raen Ryong... Skyrunner. Dragonic Soveriegn entity...
(No subject)
«
Reply #4 on:
August 20, 2006, 04:28:00 PM »
Ah, a percentage? This should work:
The result of the equation should come between 1-100, if it's outside of those boundaries simply correct it;
Fork Optn: Variable [...], <= 0
Set Variable [...], 0
EDIT: This line of coding fixed
Fork Optn: Variable [...], => 100
Set Variable [...] 100
Now,
When you're reading whether the attack is successful as a percentage...
Set Variable [0002:Random Number], Random 1-100
Fork Optn: Variable [0002:Random Number] <= [0001:Hit Chance]
EDIT: This line of coding fixed
<> Attack Hits
: ELSE CASE
<> Attack Fails
: END CASE
<> ...
That basically means that the higher the hit chance, the more chance that it will be LESS OR EQUAL TO the random number... did that make sense? It did in my head
So, example:
Hit chance = 44
Random Number = 56
The attack MISSES, but it has a 44% chance of hitting so that's hardly surprising.
Hit chance = 12
Random Number = 2
The attack HITS, but as there are only 12 numbers it would succeed on, that's a 12% chance.
Hit chance = 98
Random Number = 99
The attack MISSES, but it is hardly likely as there is only a 2% chance of missing (2 numbers out of 100)...
Hit chance = 0 (If it goes below 0)
Random Number = 1
Below 0 Hit Chance can never be triggered.
If you understood this, then this should solve your percentage problem.
Logged
Raen Ryong...
Skyrunner of Dragonia...
Guardian of all worlds...
Hoard and covet not, but be brave and free. Quest always after knowledge and slowly learn to know what science cannot see. Seek and strive for learning, be temperate and wise, for skill and wisdom only will help us to survive.
aboutasoandthis
Exemplar
Posts: 1,915
Talking sucks.
Yeah.
«
Reply #5 on:
August 20, 2006, 04:39:11 PM »
I actually knew how to program percentages in RPG Maker. I can even do square roots. :p What I'm going for is this:
Your Accuracy is let's say, 234 and their Evasion rate is 138. How would you make a percentage out of that?
I'm thinking this way. You do the normal 2a-b thing, then you do the normal percentage thing.
(2a-b) is what percent of 255? Then
that
will be the percentage. That's what I'm trying to do.
Any Ideas?
None of the equations, that were here before, work.
Logged
My pokemon bring all the nerds to the yard, and they're like you wanna trade cards? Darn right, I wanna trade cards, I could trade this, but not my charizard.
Raen Ryong
Skyrunner of Dragonia
Associate
Posts: 130
Raen Ryong... Skyrunner. Dragonic Soveriegn entity...
(No subject)
«
Reply #6 on:
August 21, 2006, 08:53:19 AM »
Well, if you use the (2a-b), it'll end up as;
(2 * 234) - 138 = 330, which the variables would convert to 100%. However, if you wanted it as a percentage of 255, I guess you'd use maths;
((2a-b)/255)*100
So there, it turns out:
((2 * 234 - 138)/255) * 100
= (330/255) * 100
= 129.4%
Obviously that would mean a guaranteed hit, so if you were using the aforementioned equations you'd want to convert it to 100.
I just noticed a problem with the equations I gave you earlier. I accidently put the Hit Chance and Random Number Variables the wrong way around in the Fork Conditions. I'll correct that now.
So, to summarise:
To calculate something as a percentage of another,
You divide by that "another",
And then multiply by 100.
((2a-b)/255) * 100 <--- As a % of 255
Logged
Raen Ryong...
Skyrunner of Dragonia...
Guardian of all worlds...
Hoard and covet not, but be brave and free. Quest always after knowledge and slowly learn to know what science cannot see. Seek and strive for learning, be temperate and wise, for skill and wisdom only will help us to survive.
aboutasoandthis
Exemplar
Posts: 1,915
Talking sucks.
That almost works...
«
Reply #7 on:
August 21, 2006, 10:52:32 AM »
This is a big flaw I have with the equation. Let's say your Accuracy is 255 and your target's Evasion is 255. First a=255 and b=255. A is multiplied by 2 to make 510. Subtract the second 255 to make 255 as your answer. In your equation, you divide that by 255 to get 1. Then you multiply that by 100.
This means you have a 100% chance of hitting the opponent when both of you have perfect scores in your areas.
That's not right. I'm thinking maybe to change that 100% to an 85. Or, I could go the easy way and use Algorithmate. It'll take a long time to make the conditional branches as that is 255*255 different branches...
EDIT=
I went back to school today and completely figured it out. :p It's the same equation used to make grades in my school.
a=your accuracy
b=your accuracy+opponents evasion
(a/(a+b))*200
Let me explain. My biggest problem came from having small stats in the beginning of the game because of low levels. The 2a-b thing doesn't work. Let's say your accuracy is 10 and their evasion rate is 14. The 2a-b would come out to be 6.
With this new version, you have an 83 percent chance of hitting the opponent. Which one sounds more realistic? The 200 is actually supposed to be 100 to make it a percentage, but I multiplied it by two to get some extra hits in. Now I don't have to make the 65,025 conditional branches anymore!
Logged
My pokemon bring all the nerds to the yard, and they're like you wanna trade cards? Darn right, I wanna trade cards, I could trade this, but not my charizard.
Print
Pages: [
1
]
« previous
next »
Charas-Project
»
Game Creation
»
Requests
»
RPG Maker Programming
»
Successful Hit Ratio