Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 04-24-2012, 06:08 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 84,124
SilverDragonTears is on a distinguished road
Default breed multiple clutches

Possible? To breed more than one baby?
__________________

Check out SilvaTales
Reply With Quote
  #2  
Old 04-24-2012, 07:03 PM
AlexC's Avatar
AlexC AlexC is offline
Moderator
 
Join Date: Dec 2009
Location: Canada
Posts: 753
Gender: Unknown/Other
Credits: 68,626
AlexC is an unknown quantity at this point
Default

want, want, want. This would be pretty darn cool.
__________________
Reply With Quote
  #3  
Old 04-24-2012, 07:18 PM
Aasixx's Avatar
Aasixx Aasixx is offline
.. your friendly geek. c:
 
Join Date: Nov 2011
Location: somewhere ur not.
Posts: 191
Gender: Female
Credits: 28,226
Aasixx is on a distinguished road
Default

I would love this as well.. o3o I hope it's possible.
Reply With Quote
  #4  
Old 04-24-2012, 07:30 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 84,124
SilverDragonTears is on a distinguished road
Default

Welllll.... I could always take a look at it myself then since you guys are interested. I'm just sooooo busy >.> Maybe I can just post my thoughts and hopefully get some help with it. *Stares at Hoffie*
__________________

Check out SilvaTales
Reply With Quote
  #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: 392,547
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
  #6  
Old 04-24-2012, 08:04 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 84,124
SilverDragonTears is on a distinguished road
Default

Ok it told me my dragons had 4 babies... but I only got two eggs?

Here's what I have....Also can I show the images of each new baby? I know how to show one but not the others?

Code:
else {
        $num = mt_rand(1, 5);
        for($i = 0;$i<$num;$i++){
			// we choose the type!
			$types = array($female->type, $male->type);
			$typerand = rand(0,1);		
			
			// we choose the gender
                        $tempgender = rand(0, 99);
                        if($tempgender < $row->genderratio) {
                        $gender = "f";
                        $alts = "yes";    
                        unset($tempgender);
                        }
                        else {
                        $gender = "m";
                        $alts = "no";          
                        unset($tempgender);
                        }

$salt = passgenerator(10, 0);
$aid = passgenerator(5, 0);				
            $code = codegen(10, 0);

			

			$time = time();

            $bredtemp = rand(0,100);
            if($bredtemp <= "50"){

            $article_content = "<center>
<img src='http://taleofdragons.net/get/".$maleid.".gif'><br>
<img src='http://taleofdragons.net/get/".$femaleid.".gif'><br>
These two don't seem very interested in each other right now. Try again in a week."; 
    
}    
else{
	        $adopts->insert("owned_adoptables", array("aid" => $aid, "type" => $types[$typerand], "name" => $aid, "owner" => $loggedinname, "currentlevel" => 0, "totalclicks" => 0, "code" => $code, 
			                "imageurl" => NULL, "usealternates" => $alts, "tradestatus" => 'notfortrade', "isfrozen" => 'no', "gender" => $gender, "lastbred" => 0, "date" => $date, "father" => $maleid, "mother" => $femaleid));
						
        } // the end of for loop
			$article_content = "
            <center>
<img src='http://taleofdragons.net/get/".$maleid.".gif'><br>
<img src='http://taleofdragons.net/get/".$femaleid.".gif'></center><br>".$imageurl."Congratulations! Breeding is successful,  you have acquired {$num} babies from breeding!<br>
<a href='myadopts.php?act=stats&id=".$aid."'><img src='http://taleofdragons.net/get/".$aid.".gif'></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
    } //this bracket ends the else where we find the male/female id's
}
__________________

Check out SilvaTales

Last edited by SilverDragonTears; 04-24-2012 at 08:17 PM.
Reply With Quote
  #7  
Old 04-24-2012, 08:16 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: 392,547
Hall of Famer is on a distinguished road
Default

This is weird... Lets troubleshoot by editing this line:

PHP Code:
            $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)); 
to

PHP Code:
            $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)) or die("Failed to create baby dragons..."); 
Lemme know if you get an error message that terminates the script.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #8  
Old 04-24-2012, 08:20 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 84,124
SilverDragonTears is on a distinguished road
Default

Nope no error...but said I had 3 babies but looked in my lair and I have none. I posted my script in my last post. Bred again and said I had 3 eggs but only 1 in my lair.
__________________

Check out SilvaTales
Reply With Quote
  #9  
Old 04-24-2012, 08:28 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 84,124
SilverDragonTears is on a distinguished road
Default

Maybe it has something to do with the types? Like maybe the ones I can't see are the other types?
__________________

Check out SilvaTales
Reply With Quote
  #10  
Old 04-24-2012, 08:36 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: 392,547
Hall of Famer is on a distinguished road
Default

Well I see, looks like it is because of the way you modify your code. XD You only get 0 or 1 baby from the last two tries because you have this 'breeding chance' settings. Here:

PHP Code:
$bredtemp rand(0,100); 
            if(
$bredtemp <= "50"){ 
            
$article_content "<center> <img src='http://taleofdragons.net/get/".$maleid.".gif'><br> <img src='http://taleofdragons.net/get/".$femaleid.".gif'><br> These two don't seem very interested in each other right now. Try again in a week."
     } 
According to this, the $bredtemp generates a number between 0 to 100, but only when this random number is below 50 will breeding actually occur. For this reason you wont get 3 dragons unless the variable $bredtemp gets a random number below 50 everytime. See the logic? Since each time breeding has 50% chance to succeed, it makes perfect sense why you get 1 out of 3 last time, and 2 out of 4 the first time. The script will work normally if you remove the 'breeding chance' code.
__________________


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


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 03:48 AM.

Currently Active Users: 862 (0 members and 862 guests)
Threads: 4,080, Posts: 32,024, 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 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636