Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Hall of Famer's gender ratio system
Well this one is based on Arianna's gender mod. As far as I know, Kaeliah already has a gender ratio/chance system before I made this one, so I do not take any credits for this script. Dont forget to credit Arianna though, she was the first one to bring up this excellent gender idea that Rusnak Adoptables were originally, lacking.
Before you proceed, make sure you you have Arianna's gender system on your script already. Her thread can be found here: http://www.rusnakweb.com/forum/showthread.php?tid=1367&page=1 It is rather straight forward to follow Arianna's mod-installation guide, so I wont explain much. The script simply defines a new variable Gender, which is a random number that has 50-50 chance of being male or female. The myadopts.php also displays an adoptable's gender. For those of you who do not know how to add a gender column to the 'owned_adoptables' table, I've attached this screenshot below for you to follow the instruction. Shouldnt be hard though, there's no coding involved: Alright lets get started on this gender ratio system. Before we proceed, it is necessary to add a new column called 'genderratio' to the table adoptables. Its strongly advised that you add it to the last column. After this is done, go to admin.php and find the codes below: PHP Code:
PHP Code:
You can see that we add codes for gender ratio in admin control panel, so you will be able to define gender ratio in acp instead of going all the way to PHPmyadmin. You will have to modify nadopt.php next, otherwise you will not be able to create new adoptables! In nadopt.php, find: PHP Code:
PHP Code:
PHP Code:
PHP Code:
Alright now we are done with nadopt.php. This isnt over yet, we will have to add codes for the actual gender ratio system. In doadopt.php, find: PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
PHP Code:
So yes, we are all set now. Isnt this easy? Well there is a flaw in this code that the gender ratio is actually not 50-50 when you set the gender ratio to be 50. This is because there are actually 101 integers between 0 to 100. One way to solve this problem is to use another if-else statement that deals with gender ratio = 50, another way is to increase the gender ratio maximum from 100 to 1000, or even 10000. This may sound confusing, but please give a try if you are an aspiring coder. Also, keep in mind that this is actually female gender ratio, not male gender ratio. A gender ratio of 80 typically tells us that you have 80% chance to get female adoptable, and 20% chance of getting male adoptable. Similarly, a gender ratio of 15 means that you only have 15% chance to get a female adoptable. What if you enter a gender ratio above 100? Well, if you actually look into the codes I wrote, I define it as genderless and such cases may exist for adoptables like Magnemite and Shellder in pokemon series. Make good use of it if you can. Here is an example of my genderless Magnemite: Thats the end of it. Sorry I wrote a lot, and thanks for taking the time and trouble to go through the entire article. I hope it helps. Hall of Famer |
#2
|
||||
|
||||
RE: Hall of Famer's gender ratio system
Oh very nice :D I was wondering how to do something like this and thought out a not very good way to do it XD Nice of you to think of a better way. :D I'll be sure to test this out when I can get the time, thank you very much! =3
__________________
"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 |
#3
|
||||
|
||||
RE: Hall of Famer's gender ratio system
You are very welcome, glad you like it. ^^
Like I've pointed out before, there's still a small problem with the formula used to calculate gender ratio. There are 101 integers between 0 to 100, not 100. Because of this, it is impossible to achieve 50-50 chance for male or female adoptables(it will be 51-50 instead). There are ways to fix this I am sure, and one easy approach is to set the range of Gender ratio to be 0-99 or 1-100, but then it will lead to confusion of the definition of Gender Ratio. *sigh* Also if you are running a pokemon site and you want genderless pokemon such as Magnemite, the script does a good job for you. All you have to do is to enter a gender ratio outside of the range 0-100. I did 101 for my pokemon such as Magnemite and Voltorb, but you can even try 1000 if you want to. The adoptable you get will always be genderless then. |
#4
|
||||
|
||||
RE: Hall of Famer's gender ratio system
Quote:
__________________
"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 |
#5
|
||||
|
||||
RE: Hall of Famer's gender ratio system
Well yeah, a Pokemon trainer. XD
And you are welcome, just use my script if its available for public. I am actually not even half as good as Kaeliah when it comes to PHP coding, and if you ever encounter glitches please lemme know. |
#6
|
||||
|
||||
RE: Hall of Famer's gender ratio system
Quick question, to get an all female or all male you use 0 and 100 right? 0 for all male and 100 for all female?
Also couldn't you change $tempgender = rand(0, 100); to $tempgender = rand(1, 100); to erase the 50-51 problem? =3 (not sure just started PHP X3)
__________________
"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 |
#7
|
||||
|
||||
RE: Hall of Famer's gender ratio system
Quote:
Well yeah, you can technically change that to as simple as 0 to 9. The problem is that most people are used to the idea of having a range of ratio/percentage between 0 to 100, but sure you can do that. ^^ |
#8
|
||||
|
||||
RE: Hall of Famer's gender ratio system
Oh btw, Arianna's gender mod is added in RA version 1.1, so you do not have to install any pre-requisites if you use RA version 1.1. Simply follow the rest of the steps as I provided a few weeks ago and you should have a fully functioning gender ratio system. ^^
Merry Christmas everyone! Hall of Famer |
#9
|
||||
|
||||
I'm getting this error:
Quote:
Last edited by RoconzaArt; 01-24-2011 at 02:17 AM. |
#10
|
||||
|
||||
Can you show me the tables prefix_adoptables and prefix_owned_adoptables from phpmyadmin? My initial guess is that your table structure is different so the sql query lines must be modified to account for this change.
__________________
Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site. |
|
|
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 HP system | Hall of Famer | Mys v1.1.x Mods | 13 | 04-25-2012 08:08 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 |
What's New? |
What's Hot? |
What's Popular? |