Register for your free account! | Forgot your password?

You last visited: Today at 10:07

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

Advertisement



Lottery

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

Reply
 
Old   #1
 
InsomniacPro's Avatar
 
elite*gold: 0
Join Date: Feb 2014
Posts: 397
Received Thanks: 205
Lottery

So I'm in the process of coding a lottery system. The problem I'm having is that I can only think of a way to pick items at completely random. I can't figure out how to pick an item on chance. Basically all I'm doing is picking a group of entries with all the same chance value, and picking an item out of there. This is working completely random instead of chance so it kind of messes it up and beefs up the lotto. Any suggestions?
InsomniacPro is offline  
Old 02/18/2014, 12:31   #2
 
abdoumatrix's Avatar
 
elite*gold: 0
Join Date: Jul 2008
Posts: 874
Received Thanks: 239
try something like this i used for using random spell


most sources use list
abdoumatrix is offline  
Old 02/18/2014, 12:31   #3
 
elite*gold: 0
Join Date: Feb 2006
Posts: 726
Received Thanks: 271
Well create a chance method.

Have the chance percent as an argument, then perform your random calculations, and return if it was a success or failure.
Almost every source in the released section has one of these systems, take a look.
Should be rather easy to create one yourself.
Aceking is offline  
Old 02/18/2014, 17:23   #4
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
Something like this?
Code:
	ConquerItem SelectItem()
	{
		while (true)
		{
			foreach (byte key; in m_lotteryItems.keys) // ConquerItemCollection[byte] m_lotteryItems;
			{
				import dconquer.calculations;
				if (ChanceSuccess(key))
					return new ConquerItem(m_lotteryItems[key].SelectRandomItem());
			}
		}
		return null;
	}
ChanceSuccess:
Code:
bool ChanceSuccess(byte chance)
{
	import std.random;
	import dconquer.core.generators;

	if (chance >= 100)
		return true;
	auto rn = uniform(0, chance, RandomGenerator);
        return (rn < chance);
}
Super Aids is offline  
Old 02/19/2014, 04:18   #5
 
elite*gold: 0
Join Date: May 2011
Posts: 648
Received Thanks: 413
a while(true) loop without a sleep? Fishy.
Y u k i is offline  
Old 02/19/2014, 05:15   #6
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,211
Received Thanks: 4,114
Quote:
Originally Posted by Y u k i View Post
a while(true) loop without a sleep? Fishy.
It's also written in D, hinting he's working on a conquer online server source written in D.
Spirited is offline  
Old 02/19/2014, 05:23   #7
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Quote:
Originally Posted by Spirited Fang View Post
It's also written in D, hinting he's working on a conquer online server source written in D.
Explains my confusion on a couple keywords :P
_DreadNought_ is offline  
Old 02/19/2014, 17:39   #8
 
Super Aids's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
@Yuki, if you had a bit common sense you'd figure out that it probably wouldn't run infinite, because the rates on items aren't 0% and that some items might have high rates so it would probably only run 1-3 times.

If it makes you happy this could be used:
Code:
import core.thread;
Thread.sleep(dur!("msecs")( 1 ));
@fang I was, although I've considering writing a new.
Super Aids is offline  
Reply


Similar Threads Similar Threads
[HELP] Lottery
05/28/2010 - EO PServer Hosting - 8 Replies
I recently noticed that the lottery on my server doesn't work at all. You can teleport there and open a chest but you won't get any item and it seems there is an infinite amount of times u can enter. I looked at the DB and following the cq_action trail it seems to be missing an action "9511161" not sure if this is normal or anything but my lottery definitely doesn't work. Anyone got any ideas?
if can be done? lottery.
02/17/2010 - Eudemons Online - 17 Replies
wounder if u can make like a packet grabber hack with know memory codes address so when u put the arrow over the lottery box it reades the address and tells what it is .so u can then pick what u want out of lottery i also believe if u wait the box constanly changes whats in them like every 20 secs thats why so random but i had a freind grab the same brown box at 8:29 and 29 sec to his clock and both times he got +12 2soc item but this was back like 4 patches ago.any ideas.
Lottery for 30k!!!!
05/23/2009 - CO2 Guides & Templates - 115 Replies
Hi guys, I've been with Elitepvpers for quite a while now and this is my first topic. As u all know with the new release of lottery tickets u can buy 1 card each day. (3 cards of the same set makes one set = Lottery ticket = 1/3 Exp Ball or 1 Time lotto!) 1 Card costs 10,000 Gold. Heres a way to do lotto with 30k as much as u like! 1.Create a new character 2.Give the noob 10k 3.Get a card with the 10k
The Lottery
09/04/2007 - Conquer Online 2 - 8 Replies
Hiya Guys never made many contributions to the site and although this one might sound like another poor effort of a post it genuinly worked for me. I found a DB recently and decided that the only real way for me to get rich was to gamble it, stupid i know but i discovered something very quickly, First things first. 1) Always pick the same box Now in my process i started randoming boxes and havent ever gotten anything decent but once i started selecting only one box the cycle started ...
Lottery
09/02/2007 - Eudemons Online - 2 Replies
Well some people belive lottery is luck...i dont. Who chooses the same box? and who chooses diffrent boxes every time they go in? Ok next time you got 900EP's and you can go in the lottery 20 times... Pick your first char go in and pick random boxes each time... then with the other char pick the same box over and over... tried it...same box is the best i belive when you do the same box your picking out all the s*it stuff to get to the good stuff...like me "Mage Tinna, Warrior Cute,...



All times are GMT +2. The time now is 10:07.


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.