Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Mys v1.1.x Mods

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-16-2011, 12:46 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 490,148
Hall of Famer is on a distinguished road
Default Evolution System: Perfect for a Pokemon or Digimon site

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 Code:
'evolution'VARCHAR10 )', default Null 
'
evolutionlevel', INT( 11 )', default 0  
'evolutionform'VARCHAR40 )', default Null 
After you've completed this, open admin.php and find the following codes:

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

PHP Code:
<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 Code:
$alternates $_POST["alternates"];
$alternates secure($alternates);

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

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

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

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

PHP Code:
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 Code:
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 Code:
$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 Code:
$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 Code:
mysql_query("INSERT INTO ".$prefix."owned_adoptables VALUES ('', '$type', '$name','$loggedinname','0','0', '$code', '','$alts','fortrade','no','$gender')"); 
Replace with this:

PHP Code:
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 Code:
if($newclicks >= $requiredclicks and $requiredclicks != 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 Code:
// 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
Attached Files
File Type: php admin.php (79.3 KB, 5 views)
File Type: php nadopt.php (10.2 KB, 6 views)
File Type: php doadopt.php (7.6 KB, 5 views)
File Type: php levelup.php (12.0 KB, 6 views)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pokemon adoptables Ashe Art Gallery 2 09-19-2012 10:56 AM
The Pokémon Ranch - Online Pokémon Rpg Alaric Adoptables Buzz 3 05-23-2012 02:16 AM
pokemon mods (evolution) Nemesis Questions and Supports 3 05-11-2012 04:03 PM
evolution system for 1.2.x? sensacion Questions and Supports 2 07-06-2011 12:49 PM
Evolution system? Hall of Famer Questions and Supports 10 11-05-2009 06:54 PM


All times are GMT -5. The time now is 11:04 AM.

Currently Active Users: 695 (0 members and 695 guests)
Threads: 4,081, Posts: 32,032, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636