Alternate Images for Genders

Forum
Last Post
Threads / Messages
Is it possible, to write this function for Mys 1.3.3 ?
This would be very, very nice :)

I think, I have to study this new (cyrillic :bucktard:) version :happyc:

Thanks a lot :jay:
 
Last edited:
I had a go at this but there seems to be no doadopt.php in 1.3.4.

I found something similar to the code inside classes/class_adoptable.php

PHP:
	public function getGender(){
	    $genders = array('f', 'm');
		$rand = rand(0,1);
		return $genders[$rand];
	}

But there was no:
// Adoption complete, show the user a confirmation screen...

I kept looking and finally found something close to that line in view/adoptview.php

I'm not sure if the code should go here or in class_adoptable.
 
Ok, I've given up after over a week of failing. If someone could get this working for 1.3.4, that would be awesome.
 
Well looking for $genders = array('f', 'm'); was definitely key, still! It's also in classes/class_promocode.php and classes/class_stockadopt.php, of course, for adoptables acquired through promo codes and shops. Take note, where you found it in classes/class_adoptables.php has it inside a function. This function is being run in adopt.php - and this is where we'll have to implement the changes for this particular type of acquiring a pet (from the /adopts page, where available pets are shown).

So let's get started!

Alternate Gender Mod for Mysidia v1.3.4
We're going to opening up adopt.php first. Inside the index function, after $gender = $adopt->getGender(); add:
PHP:
switch($gender){
                case "m": 
                	$alts = "yes";
                    break;
                default: 
                    $alts = "no";
            }

That's all you need to do here, since it's using the function in classes/class_adoptables.php. However, these next two pages don't, so they'll require an extra couple steps.

Now in classes/class_stockadopt.php, inside function append($owner = ""), find $rand = rand(0,1), and afterward add in -
PHP:
$petgender = $genders[$rand];
    switch($petgender){
                case "m": 
                  $alts = "yes";
                    break;
                default: 
                    $alts = "no";
            }
Immediately after this is where the data is being entered into the database. Find inside this $mysidia->db->insert query "gender" => $genders[$rand] and change it to:
PHP:
"gender" => $petgender

Of course, make sure there is still a comma after it. Wouldn't want any errors, would we? ^^;

Now go do exactly the same thing you just did above inside classes/class_promocode.php as well! This time you can find the $rand to add code after inside function execute().

All done.

But please pay attention to two details, as seen here when creating an adoptable:
help1_by_kyttias-d8932pq.png


Changing this number will not change the gender ratio, as the gender is determined at birth with a random generator. There is no 'chance' of alternates happening now, they will only happen based on gender at the pet's creation.

If you make a gender changing potion, this will not change the pet's image. So if you plan on making a function for such an item, remember to change the alt image, not just the gender marker. Check out this mod for further instructions.

Keep in mind that this gender alternate image mod cannot affect the EGG or LEVEL 0 image. My pets do not hatch from eggs, so I must keep this in mind and supply a neutral, gender-less image for tiny baby pets, that will last at least until their first click/visit.

Lastly, the code is currently set for the "default" gender to be female. So, if female, use the base image. If male, use the alternate image. If you want this to be the other way around, change case "m": to case "f": in all three switch statements. This is universal for all pets!

ALSO!!!! Hey HoF/IntoRain, if you stop by this thread -- what would have to be done to make these changes go through immediately at egg/0 level?
 
Last edited:
Oh so Kyttias is giving a try on this idea, sounds intriguing. ^^ I replied to your message on AIM, it will be easy and possible to edit the alternate image system so it will start to work at lv.0. I think there is a method in class Adoptable that generates an owned adoptable's primary or alternate form, you can try applying this method when an owned adoptable is adopted at the first place, rather than when it hits lv.1.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top