Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.3.x Mods

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2012, 04:33 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: 492,425
Hall of Famer is on a distinguished road
Default Gender Ratio Mod for v1.3.1

It is about time to upgrade some of my old Mods. This one is the simple Gender Ratio addon, which I have been thinking about whether to add into the official package. Lemme know if you want this to happen, it is really an easy modification anyway.

I've provided a zip file that contains all necessary modifications to make in your script file in order to get this to work. Incase you have a highly customized site, you may install this Mod manually by following the instruction below. To begin with, insert a new column into table prefix.adoptables as usual:

PHP Code:
'genderratio'INT11 ), default 50 
Since admin.php file does not exist nowadays, you need to go to the file /admincp/adopt.php to modify the form. To add the input field Genderratio into adoptables creation form, find the following code below:

PHP Code:
                            <p>
                            <
input name='page' type='hidden' id='page' value='createanadopt'>
                            <
input type='submit' name='Submit' value='Create This Adoptable'
                            </
p>
                            </
form>"; 
Add above

PHP Code:
                                  <p>The Gender Ratio of your adoptable is 
                          
<input name='genderratio' type='text' id='genderratio' size='6' maxlength='6'
                          <
p
The gender ratio input field can theoretically be added anywhere you like, just do not 'break' your form. As you have completed this very first step, go to admincp/adoptpost.php and find these lines:

PHP Code:
            $alternates $_POST["alternates"];
            
$altoutlevel $_POST["altoutlevel"];
            
$altchance $_POST["altchance"]; 
Add below:

PHP Code:
$genderratio $_POST["genderratio"]; 
Then find this database insert code you should be familiar with:

PHP Code:
$adopts->insert("adoptables", array("id" => NULL"type" => $name"class" => $class"description" => $description"eggimage" => $eggimage"whenisavail" => $cba,
                                                    
"alternates" => $alternates"altoutlevel" => $altoutlevel"altchance" => $altchance"cost" => $cost)); 
Replace by the following new line:

PHP Code:
                $adopts->insert("adoptables", array("id" => NULL"type" => $name"class" => $class"description" => $description"eggimage" => $eggimage"whenisavail" => $cba,
                                                    
"alternates" => $alternates"altoutlevel" => $altoutlevel"altchance" => $altchance"cost" => $cost"genderratio" => $genderratio)); 
The last thing to do, of course, is to manually update our doadopt.php file to enable gender ratio to work while a user is trying to adopt a pet. Find these lines that determine adoptables gender:

PHP Code:
                        $genders = array('f''m');
                        
$rand rand(0,1);
  
                        
$adopts->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $loggedinname"currentlevel" => 0"totalclicks" => 0"code" => $code
                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0)); 
Replace by the gender ratio generation code:
PHP Code:
                       if($tempgender $row->genderratio){
                            
$gender "f";
                            unset(
$tempgender);
                        }
                        else {
                            
$gender "m";
                            unset(
$tempgender);
                        }
  
                        
$adopts->insert("owned_adoptables", array("aid" => NULL"type" => $row->type"name" => $name"owner" => $loggedinname"currentlevel" => 0"totalclicks" => 0"code" => $code
                                        
"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"lastbred" => 0)); 
You are done with it, or almost. The below edit is not required, but for those who want pets gender ratio to take effect on breeding. To do this, you need to go to breeding.php and find the following lines:

PHP Code:
            $genders = array('f''m');
            
$genderrand rand(0,1); 
Replace with:

PHP Code:
            $genderratio = ($typerand == 0)?$female_species->genderratio:$male_species->genderratio;
            
$tempgender rand(099);
            if(
$tempgender $genderratio){
               
$gender "f";
            unset(
$tempgender);
            }
            else {
                
$gender "m";
                unset(
$tempgender);
            } 
Now we are all done, it is just this simple isnt it? Like I mentioned earlier I've uploaded a zip file containing all modified scripts for those who are running a fresh installation of Mysidia Adoptables. Note you can only use them if you have not heavily modified your script files. The install_genderratio.php file needs to be executed to insert the column genderratio(INT 11) automatically to your database, although you can again do it manually. Enjoy!
Attached Files
File Type: rar gender ratio mod.rar (16.0 KB, 17 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 04-16-2012, 10:05 AM
PokePets PokePets is offline
Premium Member
 
Join Date: Jun 2010
Posts: 228
Gender: Male
Credits: 22,553
PokePets
Default

Thaaanks *will use*
Reply With Quote
  #3  
Old 04-20-2012, 10:28 AM
Tequila's Avatar
Tequila Tequila is offline
The Grim One
 
Join Date: Jan 2009
Location: Souther Tier, New York State
Posts: 1,356
Gender: Female
Credits: 109,987
Tequila is on a distinguished road
Default

Trying to install this for CH, and I'm getting the following as an error:
Quote:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/u666097869/public_html/admincp/adopt.php on line 549
When I look the string up it's the following:
PHP Code:
"<input name='reward' type='checkbox' id='reward' value='yes'>"
Any idea?
__________________
Artist. Designer. Gamer. Mother.
[portfolio] [tarot] [Rune Hollow] [freebies]
Reply With Quote
  #4  
Old 04-20-2012, 10:39 AM
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: 492,425
Hall of Famer is on a distinguished road
Default

My goodness, what a mistake. I accidentally typed an arbitrary string(generated from strongpassword.com) into the /admincp/adopt.php file... *sigh* Now just download the new file and it should work nicely:
Attached Files
File Type: rar gender ratio mod.rar (16.0 KB, 13 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 04-20-2012, 10:58 AM
Tequila's Avatar
Tequila Tequila is offline
The Grim One
 
Join Date: Jan 2009
Location: Souther Tier, New York State
Posts: 1,356
Gender: Female
Credits: 109,987
Tequila is on a distinguished road
Default

Thanks, it works now. ;3
__________________
Artist. Designer. Gamer. Mother.
[portfolio] [tarot] [Rune Hollow] [freebies]
Reply With Quote
  #6  
Old 05-23-2012, 12:30 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 32,862
kristhasirah
Default

HI, i have a problem when it comes to breeding, the offspring dont have a gender, dont know if the problem is how i created the parents, or if is the code...
i usually create 2 adopts 1 100% female and 1 100% male. my site is based on pokemon, so in order to add the shiny version i do that, and works perfectly when adopting, but when it comes to breeding is like the code cant decide if the offspring is going to be male or female.... is there a way to fix that? right now i use the original breeding code, but i have to change some of the images manually, because it use the male image on a female.
__________________
Reply With Quote
  #7  
Old 05-23-2012, 01:19 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,424
SilverDragonTears is on a distinguished road
Default

You have to do the same thing to the breeding script that you did with the adopt script.
__________________

Check out SilvaTales
Reply With Quote
  #8  
Old 05-23-2012, 05:51 PM
kristhasirah's Avatar
kristhasirah kristhasirah is offline
Member
 
Join Date: Jan 2010
Location: In middle of the nothingness
Posts: 196
Gender: Female
Credits: 32,862
kristhasirah
Default

i did change it, i followed HoF instructions, and after that, the offspring dint get a gender. so i reverted the changes that i made to the breeding code.
__________________

Last edited by kristhasirah; 05-23-2012 at 05:55 PM.
Reply With Quote
  #9  
Old 05-23-2012, 06:11 PM
PTGigi's Avatar
PTGigi PTGigi is offline
Crazily Friendly~HoF
 
Join Date: Jul 2009
Location: Somewhere >.>
Posts: 370
Gender: Female
Credits: 31,238
PTGigi
Default

Quote:
This one is the simple Gender Ratio addon, which I have been thinking about whether to add into the official package. Lemme know if you want this to happen, it is really an easy modification anyway.
I think you should add it! (...because I completely forgot it wasn't built in already XD)
__________________


"I see now that the circumstances of one's birth are irrelevant; it is what you do with the gift of life that determines who you are."~Mewtwo
My Adoptables|Nuzlocke Webcomic
Reply With Quote
  #10  
Old 05-23-2012, 06:34 PM
MaximumRide's Avatar
MaximumRide MaximumRide is offline
THROW THE CHEESE!!
 
Join Date: Apr 2012
Location: Somewhere far away
Posts: 181
Gender: Female
Credits: 19,113
MaximumRide is on a distinguished road
Default

What does this do? :)
__________________
Please click these :3
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
Mys v1.3.4 Gender Ratio Mod for Mys v1.3.4 Hall of Famer Mys v1.3.x Mods 14 06-17-2020 08:20 PM
Mys v1.3.3 Gender Ratio Mod for Mys v1.3.3 Hall of Famer Mys v1.3.x Mods 17 05-23-2019 04:34 PM
Mys v1.3.2 Gender Ratio Mod for Mys v1.3.2 Hall of Famer Mys v1.3.x Mods 6 01-08-2013 03:02 PM
Hall of Famer's Gender Ratio Mod v1.2 Hall of Famer Mys v1.2.x Mods 45 04-02-2012 01:42 PM
gender ratio script maximillion Questions and Supports 16 06-27-2011 12:59 PM


All times are GMT -5. The time now is 03:21 PM.

Currently Active Users: 601 (0 members and 601 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 - 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