Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-02-2014, 05:11 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,158
Hwona is on a distinguished road
Default Personality System

Please save back ups before using this modification!

How to make a random-generating personality system


1. Go to the "owned_adoptables" table in your database(PHPMyadmin). Click the "structure" tab at the top of the page. When it brings you to the next page, scroll down until you see this:

Press "Go".
You'll be brought to this:

Set the values to match the example above and press "Save".

2. Go to the "adopt.php" file and find this:
$gender = $adopt->getGender();
Under that, put:
PHP Code:
 $personalities = array('personality1''personality2''personality3');
           
shuffle($personalities);
foreach (
$personalities as $personality) {
    
$adoptablepersonality "$personality";

Find this:
PHP Code:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $gender"lastbred" => 0)); 
Replace with:
PHP Code:
$mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $adopt->getType(), "name" => $name"owner" => $mysidia->user->username"currentlevel" => 0"totalclicks" => 0"code" => $code"imageurl" => NULL"usealternates" => $alts"tradestatus" => 'fortrade'"isfrozen" => 'no'"personality" => $adoptablepersonality"gender" => $gender"lastbred" => 0)); 
3. Go to the "breeding.php" file and find this:
$offspringID = $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num + 1;
Under that, put:
PHP Code:
 $personalities = array('personality1''personality2''personality3');
           
shuffle($personalities);
foreach (
$personalities as $personality) {
    
$adoptablepersonality "$personality";

Under that, put:
PHP Code:
 $mysidia->db->update("owned_adoptables",array("personality" => $adoptablepersonality),"aid = $offspringID"); 
4. Go to the "shop.php" file and find this:
$adoptid = $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num + 1;
Under that, add:
PHP Code:
 $personalities = array('personality1''personality2''personality3');
           
shuffle($personalities);
foreach (
$personalities as $personality) {
    
$adoptablepersonality "$personality";

Under that, put:
PHP Code:
$mysidia->db->update("owned_adoptables",array("personality" => $adoptablepersonality),"aid = $adoptid"); 
5. Go to your "class_promocode.php" file(in the "classes" folder) and find this(in the "execute" function):
switch($this->type){
case "Adopt":
Below that, add:
PHP Code:
$personalities = array('personality1''personality2''personality3');
           
shuffle($personalities);
foreach (
$personalities as $personality) {
    
$adoptablepersonality "$personality";

Find this:
PHP Code:
 $mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $this->reward"name" => $this->reward"owner" => $this->user"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                           
"imageurl" => NULL"usealternates" => 'no'"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0)); 
Replace with:
PHP Code:
 $mysidia->db->insert("owned_adoptables", array("aid" => NULL"type" => $this->reward"name" => $this->reward"owner" => $this->user"currentlevel" => 0"totalclicks" => 0"code" => $code
                                                           
"imageurl" => NULL"usealternates" => 'no'"tradestatus" => 'fortrade'"isfrozen" => 'no'"gender" => $genders[$rand], "lastbred" => 0"personality" => $adoptablepersonality, )); 
6. Go back to the "adopt.php" file.
Under this:
Add:
$mysidia->db->update("owned_adoptables",array("personality" =>"personality4"),"aid = $adoptid");
Go to your site's ACP and create a free adopt-page adopt. Adopt that pet once. Delete the adopted pet and the species. Then, go back to the "adopt.php" file and delete the code you just added


Done!
If you want to display the personality on the levelup page:
__________________

Last edited by Hwona; 07-02-2014 at 05:25 PM.
Reply With Quote
  #2  
Old 07-02-2014, 05:11 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,158
Hwona is on a distinguished road
Default Displaying Personality On Levelup Page

This post will cover how to display an adoptable's personality on its click page


1. Go to the "class_ownedadoptable.php" file(inside the "classes" folder). There, at the top, there's a bunch of "protected" variables. Add this below them:
protected $adoptablepersonality;
Add this function to the list of functions below:
public function getAdoptPersonality(){
return $this->personality;
}

2. Got to the "levelup.php" file. On line 29, there should be something like this:
$ip = secure($_SERVER['REMOTE_ADDR']);
Under that with this:
$adoptablepersonality = $this->adopt->getAdoptPersonality();
On line 33, there's a piece of code like this:
PHP Code:
$message = ($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest
Replace that with:
PHP Code:
$message "<div id='personality'>Personality: {$adoptablepersonality}</div>";
$message $message .= (($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest); 
Replace lines 38 and 39, which should contain something like this:
PHP Code:
$document->setTitle($mysidia->lang->frozen_title);
            
$document->addLangvar($mysidia->lang->frozen); 
With:
PHP Code:
    $message $message .= "
<div id='stats'>
Personality: 
{$adoptablepersonality}
</div><br>
We're sorry, but you cannot add clicks to this adoptable at this time because its owner has chosen to freeze it.  Frozen adoptables do not accept new clicks and do not level up.  Thanks anyway for the click though, but the owner of this adoptable wants to keep this adoptable young so it will not be counted."
;
            
$document->setTitle($mysidia->lang->frozen_title);
            
$document->addLangvar($message); 
On line 41, there should be:
else{
Under that, put:
PHP Code:
$message $message .= "<br><text align ='center'><div id='clickpagelink'><a href='{$mysidia->path->getAbsolute()}levelup/click/{$this->adopt->getAdoptID()}'>Click here to visit {$adoptablename}</a><br></div>"
On line 67, there should be something like this:
$document->add($summary);
Under that, put:
$document->addLangvar($message);

I plan on editing the code to allow different personalities to have different chances of being selected. :3
__________________

Last edited by Hwona; 07-02-2014 at 05:18 PM.
Reply With Quote
  #3  
Old 07-02-2014, 05:12 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,158
Hwona is on a distinguished road
Default

Reserved for future
__________________
Reply With Quote
  #4  
Old 07-02-2014, 07:10 PM
Missy Master's Avatar
Missy Master Missy Master is offline
Pet-Sim.Online
 
Join Date: Jan 2010
Posts: 475
Gender: Unknown/Other
Credits: 44,512
Missy Master is an unknown quantity at this point
Default

Oh my this is exciting!! Really cool you made this!! :)
Reply With Quote
  #5  
Old 07-03-2014, 02:18 AM
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: 327,385
Hall of Famer is on a distinguished road
Default

Looks interesting. ^^ One quick suggestion though, why not uploaded all files that you've edited for this mods for new users to download and use quickly? I always provide that as an option for users running fresh installation sites.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 07-03-2014, 09:27 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,158
Hwona is on a distinguished road
Default

^Sure! It'll be a lot of files to upload, but I can make it work. :3 Do you know how to insert content into the levelup.php file? From what I know, the two recent mods I made are compatible with the newest version other than the fact that displaying the stats on the click page can't be done the same way... do you know how to do this?
__________________
Reply With Quote
  #7  
Old 07-07-2014, 02:39 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,949
Kyttias is on a distinguished road
Default

I've managed to get it to work somewhat! But because I'm using four stats, instead of this in levelup.php:
Code:
$message = "<div id='personality'>Personality: {$adoptablepersonality}</div>";
I'm using just:
Code:
$message = "<div id='personality'>Personality: {$this->adopt->personality}</div>";
(For example, anyway.) Which means I'm not even calling back to the edits made in class_ownedadoptable.php.

I really like how on your site, once you reload the page, rather than throwing an error that you've already levelled up the adoptable, it shows a nice profile page for it. How are you getting the species name to show? I can't seem to find where that variable is stored.
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
  #8  
Old 07-07-2014, 09:17 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,158
Hwona is on a distinguished road
Default

^Great! Wait, aren't you using v.1.3.4? How'd you get it to work there? The species thing should be there...
__________________
Reply With Quote
  #9  
Old 07-07-2014, 06:07 PM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 86,949
Kyttias is on a distinguished road
Default

Yeah, I've got 1.3.4, and... Well, I got it to display, but... all that's on that page is an error message that the pet has already been fed... and now something that displays it's personality. I'll have to build an entire page for it to replace the 'already been fed' message, I guess. I wish it was cool like yours and showed a whole profile. I'm not sure what variable holds the species name, though. I can't seem to find it. I thought it was 'type' but that didn't manage to write anything.

On your Spring theme where you add in the mod for 1.3.3 levelup.php page (which I don't want to copy over to 1.3.4 and accidentally break everything somehow, for obvious reasons - but I can still glean enough information from it to replicate what I need) you don't seem to have the species on the list of things displayed, but, on your actual site, you do. o3o~?
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.

Last edited by Kyttias; 07-07-2014 at 06:20 PM.
Reply With Quote
  #10  
Old 07-07-2014, 06:51 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,158
Hwona is on a distinguished road
Default

Yeah, don't copy anything over to v.1.3.4 - I've no experience working with it, and right now, I'm still trying to figure out how to display stuff on the click page. And yes, the "type" variable is the thing that gets the species...

Actually, can you give me the link of one of your site's pets?
__________________

Last edited by Hwona; 07-07-2014 at 06:54 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

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
Pets with Personality? Kyttias Suggestions and Feature Requests 24 07-04-2014 03:03 PM
Anyone Want to Have a Stat System Hwona Feedback and Suggestions 12 06-30-2014 09:30 AM
Abandon system bokkun Mys v1.1.x Mods 30 11-16-2010 10:19 PM
Trade System? SieghartZeke Questions and Supports 1 12-28-2009 07:06 AM
Evolution system? Hall of Famer Questions and Supports 10 11-05-2009 05:54 PM


All times are GMT -5. The time now is 08:10 AM.

Currently Active Users: 439 (0 members and 439 guests)
Threads: 4,080, Posts: 32,024, 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