Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Mys v1.1.x Mods (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=20)
-   -   Breeding System - Complete! (http://www.mysidiaadoptables.com/forum/showthread.php?t=1156)

Kaeliah 12-09-2010 09:21 PM

RE: Breeding System - Complete!
 
The only way I know to do a time variable is by Cronjobs. But you could have it so a female needs so many more clicks before it can breed again. Just as an idea to throw out there.

Plague 12-10-2010 02:54 PM

RE: Breeding System - Complete!
 
That actually sounds like a fantastic idea. It would create more variety and require the user to actively play more to try to re-breed desired creatures. Other games seem to go off the time variable, but it's like I breed all my creatures, got nothing, I'll sign on in a week when I can breed them again. And that route, for me any way, gets boring after awhile.

RoconzaArt 01-16-2011 12:12 PM

What do I add to make it so let's say I make a cat and a dog but they can't breed with each other only there own species?

Hall of Famer 01-16-2011 01:22 PM

I wonder how you define the pet types on your site, but you may try this. Now find the following lines:

PHP Code:

if ($male_level OR $female_level 2){ //this is if they can't breed
            
$article_content $article_content."Sorry, one of your adoptables don't have the minimum level to breed. Keep feeding them so they can grow.";    
        } 

Add below:

PHP Code:

else if ($male_type != $female_type){
//this examines if they are not the same species
$article_content $article_content."Sorry, a cat cant breed with a dog, please select again!";


Basically you will have to define the condition for breeding to occur. You may delete some of the lines in the else statement, since there's no need for the script to decide the species of your baby pet through random variables. You may just leave it like this too, it is not likely to cause you any fatal errors anyway. Keep in mind that you will have to modify the script significantly if you actually define cat and dog as a category, or a class/object.

Hall of Famer

RoconzaArt 01-16-2011 03:01 PM

Thank you you HOF the code works great. I want to code away to add adoptable to a group like "dogs", "cats" and etc so that different dog breed can breed with each other but not with things like foxes or cats. To put it in a pokemon fans example like how in pokemon only pokemon in the same set groups (monster, water, fairy, etc) can breed.

I just need to do some studying.

Hall of Famer 01-16-2011 03:07 PM

Well this is what I thought right from the beginning. To do this, you will need to create a new database column called 'group' in the table adoptable and owned_adoptables. The group can have two values, namely cat and dog. The script will check if the adoptables belong to the same species group, and execute the codes for both cases. It will require a lot more work, and you may need to modify nadopt.php and doadopt.php too.

Rozel 01-30-2011 06:23 PM

Hi. I was wondering about some sort of limitation, and saw on the last page about having to get more clicks before you can breed again. That'd be lovely, but I don't know if that's been worked on or not at the moment XD It says that it was said back in November 2010, a little while ago, still curious if it's being worked on. Otherwise I'd like to request that. :P

Kaeliah 01-30-2011 08:08 PM

You may want to contact Arianna and ask. :smile: I know she's working on a breeding script, but I'm not sure if it's an upgrade of this one or a completely different one.

Rozel 01-30-2011 10:18 PM

Okay, I shall do that. 83

Hall of Famer 01-30-2011 10:42 PM

umm I am sure Arianna is quite busy at this moment, but maybe it wont hurt to ask.

Rozel 01-31-2011 11:23 AM

Yeah, she said she could not right now. ^^;

nobackseat 02-06-2011 01:03 PM

I realize this is an old post, but I wanted to touch on some of the techniques here, and hope that it will help any other developers.

PHP Code:

$article_content $article_content."<p>Select 

PHP has the capability built in to append a variable to itself, and it is much easier than reiterating the variable.

PHP Code:

$article_content .= "<p>Select 

Memory resource in this application is tremendous.

There are some simple things here that may seem insignificant, it can make a huge impact.

PHP Code:

$femaleid $_POST['female'];
$maleid $_POST['male'];
$breed $_POST['breed'];

$femaleid secure($femaleid);
$maleid secure($maleid);
$breed secure($breed); 

to


PHP Code:

$femaleid secure$_POST'female' ] );
$maleid    secure$_POST'male' ] );
$breed     secure$_POST'breed' ] ); 


PHP Code:

        $num mysql_num_rows($result);

        
// Loop Out code < this will loop so you select all the rows and not just one
        
$i 0;
        while (
$i $num){ 


to


PHP Code:

// Loop Out code < this will loop so you select all the rows and not just one
$i 0;
while ( 
$i mysql_num_rows$result ) ) {



This is of course, only if you are using it once, and don't need the $num variable anywhere else.

And lastly,

Quote:

$i++;
to
Quote:

++$i;
But that is just me being extremely picky.

The reason for the above is, it is pre-incrementing and it doesn't create a memory reference.

The only difference between the two is, the last one doesn't increment until the end of the string, so in some cases it is not acceptable.

But anyways, yeah. This is not criticizing, I am just offering some tips.

NBS

Hall of Famer 02-06-2011 01:19 PM

Well Arianna has made a new version of Breeding system in this Mys v1.2.0 we are currently developing. I dont see a need to post it atm, but you can assume this one is obsolete.

elfhome 02-08-2011 10:19 AM

I am using this one just to give it a test and I really like it. I can't wait to see the final version in the newest release!


All times are GMT -5. The time now is 05:17 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.