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 01-25-2014, 10:07 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,722
Hall of Famer is on a distinguished road
Default Gender Ratio Mod for Mys v1.3.4

Well since I've had some new users requesting this plugin, I decide that its necessary to make a Mys v1.3.4 compatible version of the Gender Ratio Mod. I've included an rar file at the end of this post for you to download the files, make sure to enter the directory /install and execute the file /install/genderratio.php so that the column genderratio will be inserted successfully into the database.

Incase you cannot use the default files I have provided for some reason, I am writing a simple guide for manual installation of this Mod. It is quite easy, and requires less script edits than the older version.


Anyway, to begin with, insert the column genderratio into your table prefix.adoptables. Its type is INT, default value should be 50:

PHP Code:
'genderratio'INT11 ), default 50 
After this is done, go to your script file /admincp/view/adoptview.php, and find the following code:

PHP Code:
        $adoptForm->add($basicInfo);
        
$adoptForm->add($shopSettings);
        
$adoptForm->add($conditions);
        
$adoptForm->add($miscellaneous);
        
$adoptForm->add(new Button("Create this Adoptable""submit""submit"));
        
$document->add($adoptForm); 
Add above:(it actually does not matter if you mistakenly inserted these lines below instead, thats the beauty of OOP and GUI!)
PHP Code:
        $miscellaneous->add(new Comment("The Gender Ratio of your adoptable is "FALSE));
        
$miscellaneous->add(new TextField("genderratio"50)); 
Before closing this file, find the sql insertion query for prefix.adoptables at:
PHP Code:
            $mysidia->db->insert("adoptables", array("id" =>  NULL"type" => $mysidia->input->post("type"), "class" =>  $mysidia->input->post("class"), "description" =>  $mysidia->input->post("description"), "eggimage" => $eggimage,  "whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" =>  $mysidia->input->post("alternates"), "altoutlevel" =>  $mysidia->input->post("altoutlevel"), "altchance" =>  $mysidia->input->post("altchance"), "shop" =>  $mysidia->input->post("shop"), "cost" =>  $mysidia->input->post("cost"))); 
Okay now go to admincp/adopt.php, and replace this chunk of code with:
PHP Code:
            $mysidia->db->insert("adoptables", array("id" =>  NULL"type" => $mysidia->input->post("type"), "class" =>  $mysidia->input->post("class"), "description" =>  $mysidia->input->post("description"), "eggimage" => $eggimage,  "whenisavail" => $mysidia->input->post("cba"),
                                                     
"alternates" =>  $mysidia->input->post("alternates"), "altoutlevel" =>  $mysidia->input->post("altoutlevel"), "altchance" =>  $mysidia->input->post("altchance"), "shop" =>  $mysidia->input->post("shop"), "cost" =>  $mysidia->input->post("cost"), "genderratio" =>  $mysidia->input->post("genderratio"))); 
You may now close this /admincp/adopt.php file. The very next thing to do is to open a file located at /classes/class_adoptable.php. First of all, find a list of properties for this class at:
PHP Code:
    protected $id;
    protected 
$type;
    protected 
$class;
    protected 
$description;
    protected 
$eggimage;
    protected 
$whenisavail;
    protected 
$alternates;
    protected 
$altoutlevel;
    protected 
$altchance;
    protected 
$shop;
    protected 
$cost;  
    protected 
$conditions;
    protected 
$levels
Replace by:
PHP Code:
    protected $id;
    protected 
$type;
    protected 
$class;
    protected 
$description;
    protected 
$eggimage;
    protected 
$whenisavail;
    protected 
$alternates;
    protected 
$altoutlevel;
    protected 
$altchance;
    protected 
$shop;
    protected 
$cost;  
    protected 
$genderratio;
    protected 
$conditions;
    protected 
$levels
Perfect, we only have one last thing to do before this is all completed. Find the gender determination code at:
PHP Code:
    public function getGender(){
        
$genders = array('f''m');
        
$rand rand(0,1);
        return 
$genders[$rand];
    } 
Replace by:
PHP Code:
    public function getGenderRatio(){
        return 
$this->genderratio;
    }
    
    public function 
getGender(){        
        
$genderNumber rand(099);
        if(
$genderNumber $this->genderratio$gender "f";
        else 
$gender "m";
        return 
$gender;        
    } 
The only difference between the Mys v1.3.3 and v1.3.4 version is that the adopt.php file in ACP is now split into two separate files. For this reason, you need to edit two files, not just one. Some users may have figured it out on their own, its a good thing.

This is a reusable method, which means that both adopt.php and breeding.php can make use of it without writing the same block of code twice. Another reason why OOP pwns.


So this marks the end of manual installation process, its a lot simpler than last time isnt it? Anyway I hope you enjoy the Mods I am making for the script, I've decided to work on a few more new plugins for the script in the next few days. Lemme know if you have any suggestions to make, please do lemme know.
Attached Files
File Type: rar gender ratio mod v1.3.4.rar (6.3 KB, 24 views)
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #2  
Old 10-04-2014, 03:29 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 22,743
parayna is on a distinguished road
Default

I have a few questions :3

1) So does this allow for there to be, approximately, a 50% chance of a male or female to be produced? (I am not clear on it, I searched for previous ones of this Mod and finally found it in the 1.1.x section XD And i just wanna clarify)

2) (This is a general question) For the alternate images, is the first image generally a male one and, if you enable an alternate image, is the alternate generally a female one? Because on my site the males and females have different images and I don't want a male with a female image and vice versa XD

3) Will this addon use the alternate image system? (As stated above, by detecting if the image is supposed to be male or female, I dunno if I explained that right...) And then it, like, makes a female have the female image and male have the male image?

Thank you ^_^
Reply With Quote
  #3  
Old 10-05-2014, 10:29 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,722
Hall of Famer is on a distinguished road
Default

@ Parayna:

1. Just enter the value 50 in gender ratio field whenever you are filling adoptable creation form, and you will get half-half chance for male and female.

2. Nope, the alternate images have nothing to do with this mod nor the gender system at this stage. In Mys v1.4.0 alternate images can be configured to be gender-specific, but for the current version it's not possible.

3. I think I sorta already answered this question above.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #4  
Old 10-05-2014, 01:44 PM
parayna's Avatar
parayna parayna is offline
Member
 
Join Date: May 2013
Location: Devon, UK
Posts: 342
Gender: Female
Credits: 22,743
parayna is on a distinguished road
Default

Oh, OK! Thank you! ^_^ I might use this then :3
Reply With Quote
  #5  
Old 11-20-2014, 05:06 AM
AndromedaKerova's Avatar
AndromedaKerova AndromedaKerova is offline
ChibiFur Queen
 
Join Date: Nov 2014
Location: England
Posts: 83
Gender: Female
Credits: 4,272
AndromedaKerova is on a distinguished road
Default

I installed this on my site. It works perfectly. The test pet was meant to be 100% female and it certainly happens as intended.

It requires the number to be set as 100. I assume a number lower than 50 means it has a higher chance of being male.
Seems to me that the number actually means "chances of being female"
__________________
Failing at being normal since 1990.
Reply With Quote
  #6  
Old 11-22-2014, 01:09 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,722
Hall of Famer is on a distinguished road
Default

Yup, the gender ratio number is chance of being female. So 100 = all female, 0 = all male, and 50 = half/half.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #7  
Old 12-04-2014, 12:23 PM
AndromedaKerova's Avatar
AndromedaKerova AndromedaKerova is offline
ChibiFur Queen
 
Join Date: Nov 2014
Location: England
Posts: 83
Gender: Female
Credits: 4,272
AndromedaKerova is on a distinguished road
Default

Apparently it doesn't work like that. I set 0 for an all male species and it comes out random gender still.

*Edit*
Apparently setting it to 100 isn't 100% for females either.

It used to work, at least for female only species.
Maybe something in the code is having trouble?
__________________
Failing at being normal since 1990.

Last edited by AndromedaKerova; 12-04-2014 at 12:55 PM.
Reply With Quote
  #8  
Old 04-22-2015, 12:17 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,871
kristhasirah
Default

for those that have this mod running, this mod don't affect the adopts in the adopts shop so if you want to have it working on the adoptshops too, you must find in the /classes/class_stockadopt.php this:
PHP Code:
$genders = array('f''m');
      
$rand rand(0,1); 
and replace it with this:
PHP Code:
$genderNumber rand(099);
if(
$genderNumber $this->genderratio$gender "f";
else 
$gender "m"
in the $mysidia->db->insert change this:
PHP Code:
"gender" => $genders[$rand], 
for this:
PHP Code:
"gender" =>  $gender
Dont know if this is the correct way of doing it, but i have test it in my site and is working.

just in case... probably wont make to much of a change but add
PHP Code:
 Protected $genderratio
down of
PHP Code:
public $owner
in the same class_stockadopt.php
__________________
Reply With Quote
  #9  
Old 05-01-2015, 10:57 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,871
kristhasirah
Default

Need a little help... I tried adding the option of genderless like the code for 2.x.x, but i can't figure out... And i really need it for my site pokeponies(upgraded the site to the new version)...i think i have the idea... But cant make it work...
__________________
Reply With Quote
  #10  
Old 05-01-2015, 11:45 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 111,492
Kyttias is on a distinguished road
Default

Hmm, could you get a link to the genderless code from that version? How genderless are we talking? Like... actually still a gender but not shown, or 'other' from birthday and entirely unable to breed? I'm not positive just how many errors (or not) such a thing might cause. x'D I've made my breeding entirely genderless and, for a while, had all pet genders hidden from view entirely, though still technically stored.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
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.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 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 05:44 AM.

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