Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-24-2012, 07:48 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 616,987
Hall of Famer is on a distinguished road
Default

I think this question was asked before when breeding first became available for Mys v1.2.0. The trick is here from breeding.php:

PHP Code:
        else {
            
// we choose the type!
            
$types = array($female->type$male->type);
            
$typerand rand(0,1);        
            
            
// we choose the gender
            
$genders = array('f''m');
            
$genderrand rand(0,1);                
            
$code codegen(100);

            
// MESSY - I'm blanking out on how to find the actual alt status stuff right now, any help would be lovely.
            
$alts getaltstatus($female_species->id00);

            
$time time();
            
$adopts->insert("owned_adoptables", array("aid" => NULL"type" => $types[$typerand], "name" => $types[$typerand], "owner" => $loggedinname"currentlevel" => 0"totalclicks" => 0"code" => $code
                            
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$genderrand], "lastbred" => 0));
                        
            
$article_content "Congratulations! Breeding is successful, you have acquired a baby {$types[$typerand]} from breeding center.
            <br><a href='myadopts.php'>Manage your new 
{$types[$typerand]} now!</a></p>";

            
$adopts->update("owned_adoptables", array("lastbred" => $time), "aid = '{$femaleid}'");
            
$adopts->update("owned_adoptables", array("lastbred" => $time), "aid = '{$maleid}'");
        
        } 
// we end the place where it goes on if the levels are ok 
Assume the number of babies is a random variable ranging from 1 to 5, you can do the following:

PHP Code:
      else {
        
$num mt_rand(15);
        for(
$i 0;$i<$num;$i++){
            
// we choose the type!
            
$types = array($female->type$male->type);
            
$typerand rand(0,1);        
            
            
// we choose the gender
            
$genders = array('f''m');
            
$genderrand rand(0,1);                
            
$code codegen(100);

            
// MESSY - I'm blanking out on how to find the actual alt status stuff right now, any help would be lovely.
            
$alts getaltstatus($female_species->id00);

            
$time time();
            
$adopts->insert("owned_adoptables", array("aid" =>  NULL"type" => $types[$typerand], "name" => $types[$typerand],  "owner" => $loggedinname"currentlevel" => 0"totalclicks" =>  0"code" => $code
                            
"imageurl" => NULL"usealternates" =>  $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender"  => $genders[$genderrand], "lastbred" => 0));
                        
        } 
// the end of for loop
            
$article_content "Congratulations! Breeding is successful,  your pets have produced {$num} babies from breeding!";
            
$adopts->update("owned_adoptables", array("lastbred" => $time), "aid = '{$femaleid}'");
            
$adopts->update("owned_adoptables", array("lastbred" => $time), "aid = '{$maleid}'");
      } 
// we end the place where it goes on if the levels are ok 
This way the script will randomly produce 1-5 babies depending on what you get from the random number generator. You can easily make it to whatever number it can go up to. You can also do database integration by creating a new field in table prefix.adoptables that stores the number of babies a specific species can produce. It can get quite tricky for interspecies breeding though, so I do not recommend it at this moment.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create Breed adopt Question Phoeniix Questions and Supports 4 02-04-2015 01:28 AM
Question: How to breed with Males of other Players Missy Master Questions and Supports 2 04-05-2013 03:40 PM
Multiple Outcomes Abronsyth Questions and Supports 11 05-17-2012 04:15 PM
Breed Only Adopt SilverDragonTears Questions and Supports 3 10-05-2011 02:35 PM
Multiple multiple outcomes..? Quillink Suggestions and Feature Requests 5 05-31-2009 07:14 AM


All times are GMT -5. The time now is 09:39 PM.

Currently Active Users: 3695 (0 members and 3695 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636