Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2011, 06:46 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,222
Hall of Famer is on a distinguished road
Default Hall of Famer's Gender Ratio Mod v1.2

Well it is finally time to upgrade my old Mods to Mys v1.2.x compatible version. The first one I am doing is this Gender Ratio Mod, since its rather simple. The evolution Mod will be done after I complete ACP-Integration for Itemshop, it will use the plugin system just like Kaeliah's Multi-Adopt Image engine.

To start off, I am assuming you guys/gals know how to add columns in tables? Well it does not matter if you dont, just run the script called install_genderratio.php on your site and delete it. Anyway create a new column at the end of table prefix.adoptables:

PHP Code:
'genderratio'INT11 )', default 50 
Next, go to admin.php and find the following lines:

PHP Code:
                                            <p>Alternate Outcomes Selection Information:</p>
                                            <
p>
                                                
Start using the alternate outcome at level number
                                                <
input name='altoutlevel' type='text' id='altoutlevel' size='6' maxlength='6'>
                                                <
br />
                                                (Use 
Level 0 to have the alternate outcome be used from birthThis will not affect the first egg image.)
                                            </
p>
                                            <
p>
                                                
The alternate outcome has a chance of 1 in 
                                                
<input name='altchance' type='text' id='altchance' size='6' maxlength='6'>
                                                
of being selected.<br />
                                                (
Here you can select the chance that the alternate images for this adoptable are used
                                                
So, for an equal chance of using say male or female images
                                                
put 2 in the box to have a 1 out of 2 or 50chance of using the alternate image
                                                If 
you want to have the alternate images be rare images, use a higher number
                                                
like 100 for a 1 out of 100 chance of using the alternates.)
                                            </
p>
                                            <
p>
                                                <
input type='submit' name='Submit' value='Create This Adoptable'
                                            </
p>
                                        </
form>"; 
Replace with:

PHP Code:
 <p>Alternate Outcomes Selection Information:</p>
                                            <
p>
                                                
Start using the alternate outcome at level number
                                                <
input  name='altoutlevel' type='text' id='altoutlevel' size='6'  maxlength='6'>
                                                <
br />
                                                (Use 
Level 0 to have the  alternate outcome be used from birthThis will not affect the first /  egg image.)
                                            </
p>
                                            <
p>
                                                
The alternate outcome has a chance of 1 in 
                                                
<input name='altchance' type='text' id='altchance' size='6' maxlength='6'>
                                                
of being selected.<br />
                                                (
Here you can select the  chance that the alternate images for this adoptable are used
                                                
So, for an equal chance of using say male or female images
                                                
put 2 in the box to have  a 1 out of 2 or 50chance of using the alternate image
                                                If 
you want to have the alternate images be rare images, use a higher number
                                                
like 100 for a 1 out of 100 chance of using the alternates.)
                                            </
p>
                          <
p>The Gender Ratio of your adoptable is 
                          
<input name='genderratio' type='text' id='genderratio' size='6' maxlength='6'
                          <
p>
                                            <
p>
                                                <
input type='submit' name='Submit' value='Create This Adoptable'
                                            </
p>
                                        </
form>"; 
Now you will have to edit nadopt.php to ensure the value entered for genderratio will appear in database. Find:

PHP Code:
        $alternates $_POST["alternates"];
        
$altoutlevel $_POST["altoutlevel"];
        
$altchance $_POST["altchance"]; 
Add below:
PHP Code:
        $genderratio $_POST["genderratio"]; 
Also in nadopt.php, find the following codes:

PHP Code:
            runquery("INSERT INTO {$prefix}adoptables VALUES ('', '{$name}', '{$class}' ,'{$description}','{$eggimage}','{$cba}','{$promocode}', '{$freqcond}', '{$number}','{$datecond}','{$date}','{$adoptscond}','{$maxnumcond}','{$morethannum}','{$usergroupcond}','{$usergroups}','{$alternates}','{$altoutlevel}','{$altchance}', '{$cost}')"); 
Replace with:

PHP Code:
            runquery("INSERT INTO {$prefix}adoptables VALUES ('',  '{$name}', '{$class}'  ,'{$description}','{$eggimage}','{$cba}','{$promocode}', '{$freqcond}',  '{$number}','{$datecond}','{$date}','{$adoptscond}','{$maxnumcond}','{$morethannum}','{$usergroupcond}','{$usergroups}','{$alternates}','{$altoutlevel}','{$altchance}',  '{$cost}', '{$genderratio}')"); 
You are done with nadopt.php, but the game is not over yet. We have yet to add the gender generation script. To do this, open doadopt.php and find the following lines:

PHP Code:
                        $genders = array('f''m');
                        
$rand rand(0,1);
                        
                        
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('', '{$row['type']}', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no', '$genders[$rand]','0')"); 
Replace the entire text with:

PHP Code:
$tempgender rand(099);
if(
$tempgender $row['genderratio']) {
$gender "f";
unset(
$tempgender);
}
else {
$gender "m";
unset(
$tempgender);
}
runquery("INSERT INTO {$prefix}owned_adoptables VALUES ('',  '{$row['type']}', '$name','$loggedinname','0','0', '$code',  '','$alts','fortrade','no', '$gender','0')"); 
This should do the trick. I've uploaded the file install_genderratio.php, run it on your site to add column genderration in only one step. Note the range of gender ration is between 0 to 100. A gender ratio of 0 means the adoptable is 100% male, a gender ratio of 100 means the adoptable is 100% female. The adoptable has equal chance to be male or female if the value is set to be 50.

Hall of Famer
Attached Files
File Type: php install_genderratio.php (487 Bytes, 17 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 08-28-2011, 09:36 AM
Linkin-Dreamer's Avatar
Linkin-Dreamer Linkin-Dreamer is offline
The Chamomile Tea Drinker
 
Join Date: Aug 2011
Posts: 43
Gender: Female
Credits: 5,151
Linkin-Dreamer is on a distinguished road
Default

:O Neat! I might use this, it looks really good!
Reply With Quote
  #3  
Old 08-28-2011, 05:47 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,414
SilverDragonTears is on a distinguished road
Default

Wait what's the difference with this and the current gender ratio?
__________________

Check out SilvaTales
Reply With Quote
  #4  
Old 08-28-2011, 06:17 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,222
Hall of Famer is on a distinguished road
Default

umm there is no gender ratio feature for an official release. I am assuming you are talking about the old gender ratio script I made for Mys v1.1.x? Well there aint a big difference, just this one is for Mys v1.2.x and the old one may not be compatible with latest release.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #5  
Old 08-28-2011, 06:26 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,414
SilverDragonTears is on a distinguished road
Default

oh what's it do?
__________________

Check out SilvaTales
Reply With Quote
  #6  
Old 08-28-2011, 06:30 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,222
Hall of Famer is on a distinguished road
Default

With the gender ratio script you can set the ratio of male and female for a certain species, it can even be 100% male or 100% female.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #7  
Old 08-28-2011, 06:31 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,414
SilverDragonTears is on a distinguished road
Default

ohhhhhhhhhhhh nice!!
__________________

Check out SilvaTales
Reply With Quote
  #8  
Old 08-28-2011, 06:50 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,222
Hall of Famer is on a distinguished road
Default

Thanks for your comment, you are again more than welcome to test the code on your site to see if it works for you.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #9  
Old 08-28-2011, 06:57 PM
SilverDragonTears's Avatar
SilverDragonTears SilverDragonTears is offline
I am your Nemesis.
 
Join Date: Jun 2011
Posts: 1,113
Gender: Female
Credits: 97,414
SilverDragonTears is on a distinguished road
Default

I will eventually... .I don't think I have use for it at the moment... but I'm sure I will soon.
__________________

Check out SilvaTales
Reply With Quote
  #10  
Old 08-29-2011, 05:51 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,222
Hall of Famer is on a distinguished road
Default

Alright, you may use it at anytime you want. There is a chance that I may update the script once Mys v1.3.0 is released. Also the Gender Ratio Mod v1.2 fixed a flaw in the old script. It may take some time to explain, I will tell you if you want to.
__________________


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
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
Mys v1.3.1 Gender Ratio Mod for v1.3.1 Hall of Famer Mys v1.3.x Mods 15 08-17-2012 04:25 AM
Hall of Famer's gender ratio system Hall of Famer Mys v1.1.x Mods 34 01-25-2011 02:19 AM


All times are GMT -5. The time now is 12:16 AM.

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