Hall of Famer's Evolution Mod v1.2

Forum
Last Post
Threads / Messages

Hall of Famer

Administrator
Staff member
Administrator
Joined
Dec 15, 2008
Messages
4,564
Points
48
Location
United States
Mysidian Dollar
214,223
Well its been a long time since the old evolution script for Mys v1.1 was designed. I eventually decided to make a new one, which has its codes completely rewritten compared to the old program. I've included an installer in order to make you guys/gals lives easier, it is also more flexible for admins to manage evolution lines through ACP.

So what are the differences between Evolution Mod v1.2 and the old script released for Mys v1.1:
1. The entire script is redesigned, with much more advanced PHP codes that I'd hardly recommend to absolute beginners. Of course, it optimizes site performance to a certain extent. Installation becomes much easier for Evolution system, as it was indeed a pain back in the old days.
2. The new script introduces a concept called Evolution Line, it can be rather useful for long series evolution line and multi-evolution outcome branches in future. Also adoptables can have a certain percentage of chance to evolve or not even when their evolution conditions are all met. Apparently the admins decide the difficulty for evolution to occur.
3. The old script inserts many columns into table prefix.adoptables and prefix.owned_adoptables, which causes fatal errors while upgrading Mys and incompatibility issues with other scripts. Evolution Mod v1.2, on the other hand, creates a new table and does not interfere with any existing tables. Incompatibility with other Mods should not be a problem this time.
4. The new script introduces different approaches of evolution system, compared to merely level-based evolution. The trade-based evolution will be made available soon, and item-based evolution will also become possible once Mys v1.3.0 is released to public. There is even possibility for Trade - Item evolution integration, and time-based evolution if you dont mind using Cronjobs.
5. Powerful Admin Control Panel for Evolution system. Admins can create, edit and delete an evolution line at will, the product itself can be turned off and on(simply enable/disable the plugin through ACP or PHPmyadmin). I've also provided a section called FAQs for users to read as manual, they should pretty much explain what you can do with Evolution Mod V1.2.


Alright, let us begin. First of all you need to add the following three functions to your inc/functions.php file. They can be placed anywhere, and Id recommend the very end of your script file:

PHP:
function pluginenabled($plug) {
$query = "SELECT * FROM {$GLOBALS['prefix']}acp_hooks WHERE pluginname='{$plug}'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
  switch($row['pluginstatus']){
  case "1":
  $plugin = "enabled";
  break;
  default:
  $plugin = "disabled";
  }
return $plugin;  
}

function checkevolution($adopt, $level, $item, $trade, $gender){

$query = "SELECT * FROM {$GLOBALS['prefix']}adoptables_evolution WHERE preevoform='{$adopt}'";
$result = runquery($query);
$row = mysql_fetch_array($result);
$randnum = mt_rand(0,99);
switch($row['evotype']){
  case "level":
  $canevolve = ($level >= $row['requiredlevel'] and $row['evochance'] > $randnum)?yes:no;
  break;
  case "item":
  $canevolve = ($item == $row['requireditem'] and $row['evochance'] > $randnum)?yes:no;
  break;
  case "trade":
  $canevolve = ($trade == "true" and $row['evochance'] > $randnum)?yes:no;
  break;
  default:
  $canevolve = "no";
}

// Check the gender restriction setting
if($row['requiredgender'] != "no" and $row['requiredgender'] != $gender){
$canevolve = "no";
}
return $canevolve;

}

function execevolution($id, $adopt){
$result = runquery("SELECT * FROM {$GLOBALS['prefix']}adoptables_evolution WHERE preevoform='{$adopt}'");
$row = mysql_fetch_array($result);
$result2 = runquery("SELECT * FROM {$GLOBALS['prefix']}owned_adoptables WHERE aid='{$id}'");
$row2 = mysql_fetch_array($result2);
// Update adoptables type to the evolution form
if($row2['type'] == $row2['name']){
runquery("UPDATE {$GLOBALS['prefix']}owned_adoptables SET name='{$row['postevoform']}' WHERE aid = '{$id}'");
}
runquery("UPDATE {$GLOBALS['prefix']}owned_adoptables SET type='{$row['postevoform']}' WHERE aid = '{$id}'");
$message = "Congratulations! Your {$adopt} has successfully evolved into {$row['postevoform']}.";
return $message;
}
?>
The next thing to do is to modify the level increment engine a little bit. Find the following line in your levelup.php:

PHP:
    runquery("UPDATE {$prefix}owned_adoptables SET currentlevel='{$nextlevel}' WHERE aid='{$id}'");
Add below:
PHP:
      if(pluginenabled("Evolution Mod v1.2 by Hall of Famer") == "enabled"){
        $item = "";
        $trade = "false";
        switch(checkevolution($owned_adoptable['type'], $nextlevel, $item, $trade ,$owned_adoptable['gender'])){
          case "yes":
          // Evolution Checkpoint passed, the process shall begin!
          $message = execevolution($owned_adoptable['aid'],$owned_adoptable['type']);
          $evolution = "true";
          break;
          default:
          $message = "evolution does not occur...";
          $evolution = "false";        
        }                  
      }
This should pretty much do the job already. If you want to notice your users of their adoptables evolution, you may add this line to levelup.php too. Place it somewhere around line 150-160:

PHP:
    if($evolution == "true"){
    $article_content = $article_content . "<div align='center'><br />Congratulations! Your adoptable {$owned_adoptable['name']} has evolved.</div>";
    }
For those of you interested in Trade based Evolution system, simply copy/paste the following codes below to your redeem.php at around line 225:

PHP:
        // Trade Evolution Script Here:
        if(pluginenabled("Evolution Mod v1.2 by Hall of Famer") == "enabled"){
        $item = "";
        $trade = "true";
        $result5 = runquery("SELECT * FROM {$prefix}owned_adoptables WHERE aid = '{$row['adoptabledesired']}'");
        $adoptdesired = mysql_fetch_array($result5);
        switch(checkevolution($adoptdesired['type'], $adoptdesired['currentlevel'], $item, $trade , $adoptdesired['gender'])){
          case "yes":
          // Evolution Checkpoint passed, the process shall begin!
          $message = execevolution($adoptdesired['aid'],$adoptdesired['type']);
          $evolution = "true";
          break;
          default:
          $message = "evolution does not occur...";
          $evolution = "false";        
        }                  
      }
Similarly, the user can be notified of his/her adoptables evolution by adding the following lines to near the bottom of redeem.php:

PHP:
        if($evolution == "true"){
        $article_content = $article_content . "<div align='center'><br />Congratulations! Your adoptable {$adoptdesired['name']} has evolved.</div>";
        }
So we are done with script modification already, isnt it easy this time? Well you will still need to download the following two script files I've uploaded, and make sure to run install_evolution.php script so the new table prefix.adoptables_evolution will be added into your database. Now have fun everyone, I am a bit tired already since its 2AM...

Hall of Famer
 

Attachments

  • admin_evolution.php
    12.4 KB · Views: 30
  • install_evolution.php
    1.2 KB · Views: 25
  • levelup.php
    6.4 KB · Views: 14
  • redeem.php
    14.6 KB · Views: 21
Thanks for the support, guys. I remember the old Evolution script was used by many users, it seems that most members here nowadays do not build pokemon sites anymore so they may not find it quite useful. Still, the idea of evolution can work out for any types of adoptables sites.

I removed functions.php from attachment since it is not compatible with Mys v1.2.4. I will reupload a new file later this week.
 
I installed, but this;
Required Adoptables Gender:(Enter f or m if only female or male adoptables can evolve)

What do I have to insert when both gender can evolve? I can't leave it empty, I get an error.
It works when I insert no, that's okay then?
 
Last edited:
Thanks for the support, guys. I remember the old Evolution script was used by many users, it seems that most members here nowadays do not build pokemon sites anymore so they may not find it quite useful. Still, the idea of evolution can work out for any types of adoptables sites.

Are you kidding me? This is amazing!
 
Thank you so much for saying that. I actually have a new version of the Evolution Mod for Mys v1.3.x, I plan to make it public a few days after the official release of Mys v1.3.0. The new version includes integration with item/itemshop, I may revise the old procedural codes into OOP if I have time. Right now there's no need to release a Mod for Mys v1.3.x since you cant use it on Mys v1.2.x sites.
 
Not sure if this is the right place to ask, but is item based evolution completed now with Mys V1.3.1? Or is it not ready yet as of now?:eek: (if it is I'm sorry I missed the thread><;) I'm planning on giving an online friend a promo item that will trigger a special stage for an adoptable, it's for her birthday.

If this function is not available as of now then I was thinking of a way to work around it; such as to set the amount of clicks required to an incredibly high number so that it can't be reached on a short term basis without the use of an item; or set an alternate image to have a really low probability (such as 1/5000) so that it usually can't be reached without the use of an item. Not sure if these methods will be safe or have any negative effects on a long term basis though:eek: (if there's anyone who can enlighten me, please do;w;)
 
Well this script is not compatible with Mys v1.3.x yet. I plan to release a new version of the evolution script someday, probably in August.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,274
Messages
33,113
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top