View Single Post
  #1  
Old 10-25-2009, 03:05 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 21,549
Arianna will become famous soon enough
Cool Giving pets a Gender

This is my first 'mod', and a small one at it. I hope you like it.
This mod is so your pets can have gender. I'd love to have a breeding system, but there's no way I'm going to be able to make that.

First what we're going to do is we're going to open 'myadopts.php'.
Find this part:
Code:
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$totalclicks=@mysql_result($result,$i,"totalclicks");
And change it to this:
Code:
$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$gender=@mysql_result($result,$i,"gender");
$totalclicks=@mysql_result($result,$i,"totalclicks");
Then, later down, you'll see something like this:
Code:
$article_title = $name."'s Statistics:";
$article_content = "<img src='".$image."'><br><br>
<b>Total Clicks: ".$totalclicks."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br></b>";
Change it to this:
Code:
$article_title = $name."'s Statistics:";
$article_content = "<img src='".$image."'><br><br>
<b>Total Clicks: ".$totalclicks."<br>
Gender: ".$gender."<br>
Current Level: ".$currentlevel."<br>
Next Level: ".$nloutput."<br></b>";
Great, so now we can show the gender. We're not done, though. Save this and open 'doadopt.php'.
Under this:
Code:
if($name == ""){
$name = $type;
}
Add this code:
Code:
//The gender mod
$tempgender = rand(0, 1);
if($tempgender == "0") {
$gender = "Female";
unset($tempgender);
}
else {
$gender = "Male";
unset($tempgender);
}
Now we're going to change this:
Code:
mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','notfortrade','no')");
To this:
Code:
mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','notfortrade','no','$gender')");
Last but not least, we need another column in our owned_adoptables table. Go in to it, and insert a column called 'gender'. Use the same kind of settings you'd use for a name, and insert the column.

You should be done. Try adopting a creature, and then viewing it's stats. You'll see which gender it is!


Please tell me what I messed up here. :) I know this has been done before, I just wanted to try it myself.

~Arianna[hr]
Also, I don't know how to put it in for already existing pets. Any help there?
Reply With Quote