Jump to content

Weigh down a certain option when randomizing?


Cory94bailly

Recommended Posts

$maps = $_POST['maps'];
$mlg = array("Capture the Flag on Highrise", "Demolition on Highrise", "Search and Destroy on Highrise", "Capture the Flag on Invasion", "Demolition on Invasion", "Search and Destroy on Invasion", "Search and Destroy on Karachi", "Capture the Flag on Scrapyard", "Demolition on Scrapyard", "Search and Destroy on Scrapyard", "Capture the Flag on Terminal", "Demolition on Terminal", "Search and Destroy on Terminal");
$mlg_amount = "12"; //Make sure you take the # of MLG setups and subtract 1! (13 MLG setups = 12.)

$i=0;
while($i<$maps)
{
$i++;
echo $mlg[rand(0,$mlg_amount)];
echo "<br />";
}

 

Yes, I know.. It could be better but I am lazy and I made this when I was extremely tired.

 

How could I possibly weigh a certain option more?

 

I would guess obviously putting the same options in more than once would work but how would I go on making it like "$map_scrapyard = '30';", 30 being 30%?

 

Any ideas?

 

If more code is needed, I can do that.. (Also, if anyone is willing to help me clean-up the code, please tell me.. I think I have alot of un-needed code)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.