Register for your free account! | Forgot your password?

You last visited: Today at 14:47

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Rate Problem.

Discussion on Rate Problem. within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
LordGragen.'s Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 606
Received Thanks: 67
Rate Problem.

hey guys i have a question i like to ask,

i am using the rate system in my project for example if this monster get killed he have 5% chance to drope the stone.

but some how the % system is not working proper. if i put 5% idk why it will drope the stone every 5 kills or maybe 7 or idk 4.

and should not drop to fast , here is the system i use

Code:
if (Name == "StoneStealer" && ServerBase.Kernel.Rate(5))
kernel.cs

Code:
public static Random Random = new Random();
kernel.cs

Code:
 public static bool Rate(int value)
        {
            return value > Random.Next() % 100;
        }
        public static bool Rate(int value, int discriminant)
        {
            return value > Random.Next() % discriminant;
        }
        public static bool Rate(ulong value)
        {
            return Rate((int)value);
LordGragen. is offline  
Old 03/22/2013, 21:49   #2
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 239
I'm not sure but could some thing like this help?

abdoumatrix is offline  
Thanks
1 User
Old 03/22/2013, 22:16   #3
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,376
Try making an easily breakpointed method to calculate it and also ensure you are not running the percentage chance calculation more than once (some sources do a loop for item drops. You don't want to check for 5 percent droprate 5 times in a row or you'll have an issue)

Currently you have a poor way of handling things for a number of reasons.

#1: You can never use lower than 1 percent droprates (1 percent is pretty high... 100 mobs can be killed very quickly)
#2: The random value is always a whole number


Decimal calculations are more costly but here's a quick example that pops to mind.


Code:
public static bool percentSuccess(double chance)
{
var decChance = chance * .01;//convert to percentage chance to compare.
var randomVal = Random.NextDouble();
return decChance > randomVal;
}

Breakpoint the return statement to see if it returns results you would expect and then just streamline it to be

return (chance * .01) > Random.NextDouble();
pro4never is offline  
Thanks
1 User
Old 03/23/2013, 23:16   #4
 
LordGragen.'s Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 606
Received Thanks: 67
thank you, gona try time to fix.
LordGragen. is offline  
Old 03/27/2013, 07:15   #5
 
LordGragen.'s Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 606
Received Thanks: 67
okay so here is what i did, please let me know if i am doing something wrong.
sorry my English is not perfect so i am trying to collect every detail as much as i can.


so on kernel i added

Code:
 public static bool percentSuccess(double chance)
        {
            var decChance = chance * .01;
            var randomVal = Random.NextDouble();
            return decChance > randomVal;
        }
and for monster

Code:
if (Name == "DeadWarrior" && ServerBase.Kernel.percentSuccess(5.0))
i started using 5.0 from 5 but idk if thats make any different. am i missing anything else.
LordGragen. is offline  
Reply


Similar Threads Similar Threads
RappelzSro[Exp:700x/Party Exp Rate:750x/Gold Drop Rate:60x/Alchemy Rate:20x/
05/27/2012 - SRO PServer Advertising - 3 Replies
Greetings. Welcome to Rappelz-Sro Online Server Info Client Version: 1.001 Exp Rate: 700x Party Exp Rate: 750x Gold Drop Rate: 60x
Sox Drop Rate Problem Help Me
03/06/2012 - SRO Private Server - 2 Replies
USE SRO_VT_SHARD DECLARE @RATE INT SET @RATE = 950000 update _RefDropClassSel_RareEquip set ProbGroup1 = ProbGroup1*@RATE update _RefDropClassSel_RareEquip set ProbGroup2 = ProbGroup2*@RATE update _RefDropClassSel_RareEquip set ProbGroup3 = ProbGroup3*@RATE update _RefDropClassSel_RareEquip set ProbGroup4 = ProbGroup4*@RATE update _RefDropClassSel_RareEquip set ProbGroup5 = ProbGroup5*@RATE update _RefDropClassSel_RareEquip set ProbGroup6 = ProbGroup6*@RATE update...
[PROBLEM] Compose Rate!
11/07/2011 - EO PServer Hosting - 11 Replies
Hello guys! So, i have been used the compose rate query, and my rates are 20 - 25. But in the game are 1 by 1 the rate. Someone knows what because? Regards!
TBM rate problem?
02/25/2011 - Main - 7 Replies
hallo, ich habe mir im sro tbm 2 chars gekauft und habe jeweils 2 mal +1 bekommen und ich habe ihm auch 2 mal +1 gegeben aber i-wie wird das nur 1 mal angezeigt :O btw die chars kommen von der gleichen person! wenn das hier die falsche area ist für die frage dann sry :D ich habe sonst nirgens eine geignete gefunden ^^



All times are GMT +1. The time now is 14:47.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.