View Full Version : Random Breeding
SilverDragonTears
09-17-2011, 10:34 PM
How can I make it so breeding is random meaning a 50% chance of producing offspring.
Hall of Famer
09-18-2011, 07:34 AM
So you want breeding to have 50% chance of success and 50% chance of failure? You may want to use the mt_rand() function to generate random number at equal chance, a typical way of doing this is:
$rand = mt_rand(0,1); //Generate a random number between 0 and 1
if($rand == 0){
// codes to execute for successful breeding.
}
else{
// shows an error message saying breeding has failed.
}
Hopefully this is the correct interpretation of your request.
SilverDragonTears
09-18-2011, 01:31 PM
Where do I put this?
Nemesis
09-18-2011, 01:39 PM
what about having liters? lol
AlexC
09-18-2011, 01:44 PM
oh god, I'd love the chance to have litters. You could enter in an amount, say there is a random chance of your pet having between 0-4 babies maybe?
Hall of Famer
09-18-2011, 05:25 PM
Well massive baby production was not brought into our attention before since normally you do not want your members to have a huge number of adoptables through breeding, especially for rare species. I may create a Mod for that someday, but again be careful with this possible feature since it can potentially ruin your site.
@ Silverdragontears: In your breeding.php file of course. Do you have a modified version of that script file already? If so, please send me the content of your breeding.php file through PM so I can tell you where to add these random number generation lines.
Nemesis
09-18-2011, 11:49 PM
LOLOLOLOLOLOLOLOLLOL
"Massive Baby Production" HOF that killed me
XD XD XD
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.