Charas-Project

Game Creation => Requests => RPG Maker Programming => Topic started by: Prpl_Mage on July 19, 2006, 08:55:06 PM

Title: How to create, a chance code?
Post by: Prpl_Mage on July 19, 2006, 08:55:06 PM
Well I´ve been working hard and long trying to create a CBS, it´s not going that well but I´m getting the knowledge and I got the basics.

But one thing that has been bugging me is the Accuracy and Evasion along with Critical hits. I just can´t figure out a working code that can be programed.

Well someone helped me with a steal system for the DBS, and he said that the variable called "Chance" decides how big the chance is to steal something. That made me think a bit.

So now I´m just trying to figure out a working code of numbers or whatever that can aid me in this matter.

The code for the stealing was:
-------------
<>Branch: Var[###Chance] is 2 or more
 <>Steal continues, ani, message item+...
 <>Variable Oper:[###Chance] -, 6
 <>

 :Else Handler:
--<>Same thing but fail ani, mess...
--<>Variable Oper:[###Chance]+, 1
--<>

   :End
---<>
----------------------------------------------------

So if anyone can help me get some light to this matter I´d be gratefull.

Any help at all is appreciated actually.
Title:
Post by: Meiscool-2 on July 19, 2006, 09:11:05 PM
 
Title:
Post by: Prpl_Mage on July 19, 2006, 09:21:07 PM
So it is that simple? Just change that to: Between 1 and 4' and there is 25% chance ect.?

Well now I feel stupid.

Thanks for the help Meis.
Title:
Post by: WarxePB on July 19, 2006, 10:27:53 PM
You also have to use a branch/fork to check the outcome. But yeah, just use the Random function and some math, and you'll have your chance.
Title:
Post by: MrMister on July 19, 2006, 10:47:52 PM
Teehee.
Prpl_Mage is a RPG Maker noob.
Title:
Post by: Prpl_Mage on July 20, 2006, 07:20:48 AM
I tried it out today and the random encounters works.

The crit chance run smoothly, it was just to do it as in the original.
And I got my ABS to work more or less. Still needs to be taken care of but still, the idea works.

But I still have some problems finding a good way of fixing the acc and eva. If accuracy is 15 and the evasion is 16...Just how big chance should I have actually hit the guy?
Well that´s probably something that will be solved later on.
Title:
Post by: DragonBlaze on July 20, 2006, 02:27:17 PM
A good way to figure in those types of things would be to just make an algorithm that figures in the stat with the random number.

An algorithm like that would look something like this.

(a * c + a * r) / (e + r / c)

Where a = accrecy
r = random
e = evasion
and c is a constant

So if accrecty is 15 and evasion is 16, lets say the constant is 5 and the random is 1- 10, it could look something like this.

(15 * 7 + 15 * 5) / (16 + 5 / 7)

180 / 3

= 60% chance of hitting.

Now that algorithm isn't really the best, but I think you get the idea. Just experiment with differant math expressions until you come up with one that works good for how you want your evasion to go.