Evolution System: Perfect for a Pokemon or Digimon site

Forum
Last Post
Threads / Messages

Hall of Famer

Administrator
Staff member
Administrator
Joined
Dec 15, 2008
Messages
4,563
Points
48
Location
United States
Mysidian Dollar
214,216
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:

PHP:
'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:

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

PHP:
<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:

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

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

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

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

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

PHP:
mysql_query("INSERT INTO ".$prefix."adoptables VALUES ('', '$name', '$description','$eggimage','$cba','$promocode', '$freqcond', '$number','$datecond','$date','$adoptscond','$maxnumcond','$morethannum','$usergroupcond','$usergroups','$alternates','$altoutlevel','$altchance')");
Replace with:

PHP:
mysql_query("INSERT INTO ".$prefix."adoptables VALUES ('', '$name', '$description','$eggimage','$cba','$promocode', '$freqcond', '$number','$datecond','$date','$adoptscond','$maxnumcond','$morethannum','$usergroupcond','$usergroups','$alternates','$altoutlevel','$altchance','$evolution','$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:

PHP:
$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:

PHP:
$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:

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

PHP:
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:

PHP:
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:

PHP:
// 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
 

Attachments

  • admin.php
    79.3 KB · Views: 5
  • nadopt.php
    10.2 KB · Views: 6
  • doadopt.php
    7.6 KB · Views: 5
  • levelup.php
    12 KB · Views: 6
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.
 
Another AMAZING OMGNESS mod from you =D!
You're the best ;P

*using*
 
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.
 
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.
 
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.
 
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.
 
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?
 
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.
 
But after it evolves into charmeleon, it will evolves into Charizard, am I correct?
 
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.
 
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
 
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)
 
Well nope, this one only defines level-based evolution. I will add item, trade and happiness/mood based evolution in future.
 
I think I'll just try the mod on my site, and get back to you if there's any problem
 
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.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,267
Messages
33,049
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top