Thread: Mys 1.3.4 Simple NPC Battle
View Single Post
  #2  
Old 07-01-2016, 11:39 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,561
Abronsyth is on a distinguished road
Default

P.4: Trophies
Alright, finally ready for this!
Trophies are just another little extra thing that gives users more reason to engage in the battle system. I add extra incentive by rearranging my stats page to display based on number of trophies instead of clicks.

The battle code up above is already set up to add trophies, so no need to worry about that. We do have to set up the database, though.

Database
Go into phpMyAdmin, prefix_ownedadoptables, and add one new row with the following data:
Name Type Collation Null Default
trophies varchar(10) latin1_swedish_ci No 0

Displaying
Good job! Now in a file where you want to display the number of trophies (such as on the myadopts page, etc), you just need to include this to call it:
PHP Code:
$trophies $mysidia->db->select("owned_adoptables", array("trophies"), "aid = '{$adopt->getAdoptID()}'")->fetchColumn(); 
and this to display it:
PHP Code:
{$trophies
Stats Page
If you want to use the stats page to show adopts based on trophies instead of clicks there is just a minor adjustment to make.

Go to stats.php and change the FIRST line starting with "$stmt = " and replace that line with this:
PHP Code:
$stmt $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY trophies DESC LIMIT 10"); 
Now go into view/statsview.php...we have some things here to change so it actually displays the trophies.

Where you see the line $table->buildHeaders...replace it with this:
PHP Code:
$table->buildHeaders("Image""Name""Owner""Total Clicks""Trophies"); 
Now, scroll down to find this line:
PHP Code:
$cells->add(new String($adopt->getTotalClicks())); 
And add this right under it:
PHP Code:
$cells->add(new TCell($adopt->getTrophies())); 
That's it! You might also want to change the lang_stats.php file so that it reflects the changes.

P.5: Extras
You can add extra depth to this by creating other stats, such as health, battle skill, etc! Check out Dinocanid's health and mood mod, which could pair with this very nicely!
http://mysidiaadoptables.com/forum/s...ead.php?t=5263
__________________
My Mods Site (1.3.4, 2020 Mods)

Last edited by Abronsyth; 11-26-2016 at 08:28 AM.
Reply With Quote