PDA

View Full Version : Evolution System: Perfect for a Pokemon or Digimon site


Hall of Famer
01-16-2011, 11:46 AM
Well this is my third custom script made for the adoptable engine. It is nowhere as useful as Arianna's gender and breeding system, but should be cool to use. The current script actually allows simple evolution through change of images, but it can cause serious problem since the type/species name of the adoptable isnt changed. My script solves this kind of problem, and it can be extended to multiple evolution stages and forms.


To begin with, you will need to insert the three following columns into Both the table adoptables and owned_adoptables through phpmyadmin. Failing to follow this step will cause fatal error on your adoptable site:


'evolution', VARCHAR( 10 )', default Null
'evolutionlevel', INT( 11 )', default 0
'evolutionform', VARCHAR( 40 )', default Null
After you've completed this, open admin.php and find the following codes:


<input type='submit' name='Submit' value='Create This Adoptable'>
</p>
<p>&nbsp; </p>
</form>";
Add above:


<p>
<p><strong>Evolution Settings:</strong></p>
<p>This section allows you to set if you want to enable evolution for your adoptable. </p>
<p><strong>
<input name='evolution' type='checkbox' id='evolution' value='yes'>
</strong>Enable Evolution</p>
<p>Adoptable evolution Information:</p>
<p>This adoptable evolves at lv:
<input name='evolutionlevel' type='text' id='evolutionlevel' size='6' maxlength='6'>
<br>
<p>The evolution form is:
<input name='evolutionform' type='text' id='evolutionform' size='20' maxlength='20'>
<br>
This should be good for admin control panel, you will now be able to define whether an adoptable can evolve. You may also decide its evolution level and evolution form through admincp.


Next, open nadopt.php and find the following lines:


$alternates = $_POST["alternates"];
$alternates = secure($alternates);

$altoutlevel = $_POST["altoutlevel"];
$altoutlevel = secure($altoutlevel);

$altchance = $_POST["altchance"];
$altchance = secure($altchance);
Add below:

$evolution= $_POST["evolution"];
$evolution = secure($evolution);

$evolutionlevel= $_POST["evolutionlevel"];
$evolutionlevel = secure($evolutionlevel);

$evolutionform= $_POST["evolutionform"];
$evolutionform = secure($evolutionform);
Find:


mysql_query("INSERT INTO ".$prefix."adoptables VALUES ('', '$name', '$description','$eggimage','$cba','$promocode', '$freqcond', '$number','$datecond','$date','$adoptscond','$maxn umcond','$morethannum','$usergroupcond','$usergrou ps','$alternates','$altoutlevel','$altchance')");

Replace with:


mysql_query("INSERT INTO ".$prefix."adoptables VALUES ('', '$name', '$description','$eggimage','$cba','$promocode', '$freqcond', '$number','$datecond','$date','$adoptscond','$maxn umcond','$morethannum','$usergroupcond','$usergrou ps','$alternates','$altoutlevel','$altchance','$ev olution','$evolutionlevel','$evolutionform')");

This makes it possible for you to create an adoptable, or you will get an error when creating an adoptable from admincp.


You will also need to modify the doadopts.php a little bit, find the following codes below:


$aid=@mysql_result($result,$i,"id"); //The adoptable's ID
$type=@mysql_result($result,$i,"type");
$description=@mysql_result($result,$i,"description");
$eggimage=@mysql_result($result,$i,"eggimage");
Add below:


$evolution=@mysql_result($result,$i,"evolution");
$evolutionlevel=@mysql_result($result,$i,"evolutionlevel");
$evolutionform=@mysql_result($result,$i,"evolutionform");
After this is done, search for the line that contains sql query:


mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no','$gender')");
Replace with this:

mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no','$gender','$evolution', '$evolutionlevel','$evolutionform')");
This is required for you to adopt a pet from adopt.php, failing to follow the step above will generate an error too, especially if you forget to update the sql query line.


Alright, we are approaching the very end of this script modification. Open your levelup.php, it is where the game is played. Find the following lines below:


if($newclicks >= $requiredclicks and $requiredclicks != 0 and $requiredclicks != ""){

// We need to level this adoptable up...

$query = "UPDATE ".$prefix."owned_adoptables SET currentlevel='".$nextlevel."' WHERE aid='".$id."'";
mysql_query($query);

Add below:


// the script below examines if an adoptable can evolve or not and executes if the conditions are met

if($evolution == "yes" and $nextlevel >= $evolutionlevel){
$newtype = $evolutionform;
$query = "UPDATE ".$prefix."owned_adoptables SET type='".$newtype."' WHERE aid='".$id."'";
mysql_query($query);
if($type == $name){
$query = "UPDATE ".$prefix."owned_adoptables SET name='".$newtype."' WHERE aid='".$id."'";
mysql_query($query);
}

//However, the evolution info is outdated, we will need to update it below:
$query = "SELECT * FROM ".$prefix."adoptables WHERE type='$evolutionform'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

$evolutionnew=@mysql_result($result,$i,"evolution");
$evolutionnewlevel=@mysql_result($result,$i,"evolutionlevel");
$evolutionnewform=@mysql_result($result,$i,"evolutionform");

$i++;
}

//Now it's time to update the evolution info to the next possible evolution
$query = "UPDATE ".$prefix."owned_adoptables SET evolution='".$evolutionnew."' WHERE aid='".$id."'";
mysql_query($query);
$query = "UPDATE ".$prefix."owned_adoptables SET evolutionlevel='".$evolutionnewlevel."' WHERE aid='".$id."'";
mysql_query($query);
$query = "UPDATE ".$prefix."owned_adoptables SET evolutionform='".$evolutionnewform."' WHERE aid='".$id."'";
mysql_query($query);
}
What it does is to evolve an adoptable if its evolution form exists, and the pet has reached its default evolution level. The script will also check if the species name(type) and individual name(name) are identical, and the individual name will be updated to species name if the answer is yes. The evolution info will be updated too, if your adoptable has multiple evolution stages(the limit is 2 for pokemon and 5 for digimon).

Alright, we are done with this evolution system, surprised? Yes, its always possible to edit the adoptable script to whatever you want it to be, just a matter of time and efforts. I will post two screenshots of how it works later, and the corresponding script files are attached at the end of this post. Do not download and use them if you have a heavily modified adoptable site, it only works for new users who have just installed Mys/RA version 1.10. They are also incompatible with RA v1.00. You will have to manually create database columns even if you use the files.

Hall of Famer

Kaeliah
01-16-2011, 11:49 AM
FIRST POST.

Nice, I have a feeling this mod will be VERY popular, even among non-pokemon/digimon sites.

Hall of Famer
01-16-2011, 11:54 AM
Thank you so much Kaeliah, I try to make more useful scripts than before. I am sure there's still a way to improve this script, and I will see what I can do with it. I may be working on an egg stage system, in which the eggs do not appear in levels. Users may be able to create multiple stages of eggs and click them until a baby pet is born(at lv.1 of course). The way to hatch an egg may be quite different from leveling up an adoptable too.

PokePets
01-16-2011, 12:05 PM
Another AMAZING OMGNESS mod from you =D!
You're the best ;P

*using*

Hall of Famer
01-16-2011, 12:13 PM
Thank you so much, Pokepet. Like I've stated before, this can even be extended to multiple evolution forms, nonlevel-based evolutions and even devolutions. Not everyone will find it useful though, since evolution is not required for many adoptable sites.

RoconzaArt
01-16-2011, 03:05 PM
It would be interesting to see this "multiple evolution forms" applied to a Digimon site since Digimon do a lot of multiple evolution forms. Then again if you did you like Digimon there would be a zillion evolution since digimon are not as limited in branching as pokemon.

Hall of Famer
01-16-2011, 03:29 PM
Well a problem with multiple evolution form is how to define the path of evolution. Its rather easy for Wurmple, which simply evolves into two different species randomly. For Gloom, the different evolution stones will have to be specified, thus an itemshop is needed. For Eevee, it will be even a lot more complicated. For the case of Digimon, I'd strongly advise you to create a column called Evolution Group, since there are way too many branches of preevolution and evolution forms.

RoconzaArt
01-16-2011, 03:40 PM
That's what makes Digimon so tricky since there most be a ton of evolution combos and even branching in some cases. Too much for a novice like my self. I like the idea of item base evolution cause it could be useful for Digimon too. Such as having crests and Digimon items used. That would be a pretty cool Digimon site if you could pull it off.

fadillzzz
01-22-2011, 09:40 PM
I wanted to install this, but what about all the adoptables that has already evolved using the old evolution system where it only change the image?

Hall of Famer
01-23-2011, 12:12 AM
lol interesting question. I dont think this will cause any glitches, since the script checks if the adoptable's level is above or equal to its evolution level or not. It will still evolve and get a species name change even if it is way above evolution level. It will be quite funny though if you have a lv.50 Charmander(whose current image is Charizard) evolves into lv.51 Charmeleon.

fadillzzz
01-23-2011, 01:42 AM
But after it evolves into charmeleon, it will evolves into Charizard, am I correct?

Hall of Famer
01-23-2011, 01:49 AM
Yeah, it will take another level though. Lets say you have a Charmander at lv.50, it will evolve into Charmeleon at lv.51 and then Charizard at lv.52. The evolution info will update too once your pokemon evolve, so this shouldnt be a problem.

fadillzzz
01-23-2011, 01:55 AM
Ok, thanks for clearing it up!
Nice mod btw... :smile:

Hall of Famer
01-23-2011, 01:57 AM
You are very welcome. I actually released a pokemon stats mod in premium members forum, but that one is incompatible with evolution system at this moment. Will have to modify it a little bit. XD

fadillzzz
01-23-2011, 01:59 AM
Hmm..that seems to be a nice mod, too bad I'm not a premium member
oh and btw, If I use this mod does that mean I have to add more types to the adopts_adoptables table? (the evolution type)

Hall of Famer
01-23-2011, 02:00 AM
Well nope, this one only defines level-based evolution. I will add item, trade and happiness/mood based evolution in future.

fadillzzz
01-23-2011, 02:16 AM
I think I'll just try the mod on my site, and get back to you if there's any problem

Hall of Famer
01-23-2011, 02:20 AM
Alright, lemme know if you have any problems with this mod. Thanks for using it.

RoconzaArt
01-24-2011, 07:32 PM
Just curious what if a pokemon levels twice like like Bulbasaur? Sure I can make it Ivysuar at 16 but what about Venusaur at 36?

Hall of Famer
01-24-2011, 09:47 PM
Well just enter the evolution info(the fields 'evolution', 'evolutionlevel' and 'evolutionform') for Ivysaur too. This script automatically updates evolution info once your adoptables evolve, so it can actually evolve infinite times.

RoconzaArt
01-26-2011, 02:01 AM
So your saying make a new adopt for Ivysaur and place it's evolution info like you did Bulbasaur?

Hall of Famer
01-27-2011, 04:08 AM
Well I will show you an example of how to do multiple stage evolution for adoptables. It is quite easy though, but maybe a tutorial is gonna help. I may also post solutions for other possible evolution approaches in premium members forum, such as item and trade based evolution.

fadillzzz
01-27-2011, 07:31 AM
So your saying make a new adopt for Ivysaur and place it's evolution info like you did Bulbasaur?
If we need to do so, doesn't that mean we need to add more rows to the levels table as well...?

RoconzaArt
01-27-2011, 07:53 AM
I asked HOF over user messages and he told me this:

All you have to do is to create a new adoptable called Ivysaur, enter its evolution info as you did for Bulbasaur. Just keep in mind you enter the evolution level to be 32 and evolution form to be Venusaur, or your Ivysaur evolves into Ivysaur again. XD

Remember to enter the correct evolution info for Ivysaur. Remember for Bulbasaur, the evolution level is set to be 16 and its evolution form is Ivysaur. For Ivysaur, just repeat the same steps of creating an adoptable in acp, and change the evolution level from 16 to 32 while evolution form from Ivysaur to Venusaur. This should work for you.

So if I got this right you just make a new adopt (Ivysaur) and enter it's evolution, (Venusaur, and lvl at 36) the same way way you did as Bulbasaur. Then again create new adoptable (Venusaur) and it automatically changes the name?

Did I get that right Hall of Famer?

Hall of Famer
01-27-2011, 08:26 AM
Yes, this is the way it is supposed to work. Also make sure you do not make a mistake when entering information for Venusaur, or the image will not show.

fadillzzz
01-27-2011, 09:50 AM
So....uh just to be clear, we really DO need to add new levels to the _levels table?
(for Ivysaur and Venusaur)

RoconzaArt
01-27-2011, 10:13 AM
OK I tested this:

I made a Bulbasaur, made it's evolution Ivysaur at lvl 1 (for a test).

Made a new adopt Ivysaur

Added one lvl

Adopted Bulbasaur

Clicked it and got a X for the image but it's name did change to Ivysaur just not the picture.

I did this about 3 times with the same conclusion.

Hall of Famer
01-27-2011, 10:43 AM
umm thats not supposed to be the conclusion at all! There must be some wrong settings for the image url of Ivysaur and Venusaur on your site. Can you show me a screenshot of your Ivysaur and Venusaur in prefix_adoptables, and prefix_owned_adoptables table? I'd like to see what went wrong. A possible reason is that you did not create levels for Ivysaur and Venusaur, which did cause a similar problem on my site before.

RoconzaArt
01-27-2011, 11:13 AM
A possible reason is that you did not create levels for Ivysaur and Venusaur, which did cause a similar problem on my site before.

This was the problem I didn't know that Ivysaur neede to have the same ammounts of lvls in this case Ivysaur need a lvl 16.

Make a Ivysaur give it 16 levels so when bulbasaur hits 16 you get a lvl 16 Ivysaur?

Question does the evolution pick up gender and alt picture as well? I noticed it retains it's name I was wondering if the other do to.

Hall of Famer
01-27-2011, 12:45 PM
Yeah, you will need to create levels for Ivysaur and Venusaur too in order for the script to work properly. Since the only things that change are your pet's species name and evolution info upon evolving, its gender, altimages and any other attributes should retain.

PTGigi
01-27-2011, 12:55 PM
Just a quick note (it's kinda funny XD) if you search "Mysidia Adoptables" on Google this thread appears BEFORE the actual forums XD

Hall of Famer
01-27-2011, 12:58 PM
lol yeah, wonder why this happens. It is a hot thread anyway, people ask and discuss lots of questions and issues here. XD

PTGigi
01-31-2011, 01:58 PM
Just a quick question I thought of while adding adoptables in school today.

Would this evolution system break the "user can only have ____ of this adoptable?" Meaning if I have a Fire Starter Mew that can only be adopted twice, the user could get more of this adoptable by evolving the Fire Starter Mew to a Dark Fire Mew. :catfish:

Hall of Famer
01-31-2011, 03:13 PM
Good question, Gigi. Unfortunately this is indeed a problem for my evolution system, I do have a solution for my pokemon site though. It defines a new concept called egg pokemon, which is crucial for breeding system I am working on for Pokemansion. A good example is Eeveelution, who all have the same egg pokemon, Eevee. The usage of egg pokemon can be extended to adoption, as you can set a limit based on adoptables with the same egg pokemon. It may sound a little bit complicated, but hopefully you understand what I am saying. You will love this idea once breeding becomes available. XD

PTGigi
01-31-2011, 03:34 PM
I think I get it :smile: So (simply X3) I just make a new variable that states the lowest evolution form and make it check that? :meow:

Hall of Famer
01-31-2011, 03:41 PM
Yeah, you get the point gigi. Actually you can do more than that with breeding system, since it will allow your evolved pokemon to give birth to their corresponding egg pokemon/baby pokemon. For instance, Venusaur's offspring are supposed to be Bulbasaur, not Venusaur. ^^

Lunaria
02-11-2011, 05:34 PM
Thanks, this is very helpful!

Hall of Famer
02-15-2011, 06:20 PM
You are very welcome, I hope you like it. I will make an updated version of this evolution system once Mys v1.2.0 is available.