![]() |
#1
|
|||
|
|||
![]()
http://buildingbrowsergames.com/tutorials/
On the above site is a tutorial for how to use PHP and SQL to make a browser game (including health and items that heal you). Would anybody know how to integrate this with the adoptables script? |
#2
|
|||
|
|||
![]()
I just finished a mod yesterday for usable items. It includes items for leveling, healing, resurrection, changing a reg pet to it's alt version & "breeding". Doing it required the addition of 2 new tables & adding fields to existing tables. There were 3 new pages created, many pages altered and major additions to the admin panel. It is currently running on the test server. Taking it live will require not only making all the above changes to the current database and uploading all the new or changed pages, but also then making changes to ALL the existing pets in the database.
Since usable items are designed very specific to the needs of the site and every item must be coded separately to work as it is supposed to work. I do not foresee a "general" mod being created because for it to be general enough for all sites to use everyone would want it modified in some way. Plus the changes needed in the database to the current pets would require a system simular to the one Brandon created for upgrading to the newest script as most of the people here would find making the changes manually well beyond their abilities. I can only recommend a lot of reading and learning or making good friends with a programmer to do it for you, because hiring someone to design the system for your site would be expensive with all the time involved. Sea |
#3
|
|||
|
|||
![]()
Oh, alright then. Could you give me some hints to just getting started on a basic health system, because I haven't upgraded my site anyway and I was planning on making a new site, so I can start from the beginning...
|
#4
|
|||
|
|||
![]()
Add a health field to your owned_adoptables table.. make it not null & give it a start point.. Mystic Grove start is 20
on another page for items this was added Code:
/* **************** Healing Spell ***************** */ } elseif ($do == "Healing") { // We are actually placing in or removing from Dorm... $article_title = "Healing Potion<br /><br />"; $article_content = "<center><img src='" . $itemimage . "'></center><br /><br /> With war comes valor, but also injuries and even death! The Healing Potion can not bring the dead back to life but it can help to sooth the pain and heal the injuries of those wounded in the Goodly Battle. The Healing Potion will help you Companion to recover from it's wounds up to 5 days sooner then what would happen naturally with time. It is useable only once and then it will disappear.<br /><br /> Which companion would you like to use the " . $type . " Potion on?<br /><br />"; $article_content = $article_content . "<div id='petdisplay' align='center'> <ul>"; // Now we choose a Companion or Item to use it on... $query = "SELECT * FROM " . $prefix . "owned_adoptables WHERE owner='$loggedinname' AND health < '20' AND health != '0' AND currentlevel = '6' AND item != 'yes'"; $result = mysql_query($query); $num = mysql_numrows($result); $i = 0; while ($i < $num) { //The item's ID $aid = @mysql_result($result, $i, "aid"); $name = @mysql_result($result, $i, "name"); $health = @mysql_result($result, $i, "health"); // Get the image for the adopt... $itemimage = getcurrentitemimage($id); $image = getcurrentimage($aid); $go = $name . "<a href='useitem.php?act=Healing&id=" . $id . "&aid=" . $aid . "'><img src='" . $image . "' border=0></a><b>Health: " . $health . "/20 "; //Loop out code $article_content = $article_content . "<li><h5><center>" . $go . " </center></h5></li>"; $i++; } $article_content = $article_content . "</ul></div><br /><div></div>"; Code:
/* **************** Healing Potion ***************** */ if ($isloggedin == "yes") { if ($act == "Healing") { if ($id == "" or !is_numeric($id)) { $article_title = $err_idnoexist; $article_content = $err_idnoexist_text; } else { $query = "DELETE FROM `adopts_owned_items` WHERE `aid`='$id'"; $result = mysql_query($query); // die(print_r($query)); // We have what appears to be a valid adoptable ID, so we pull the adoptable's information from the database... $query = "SELECT * FROM " . $prefix . "owned_adoptables WHERE aid='$aid'"; $result = mysql_query($query); $num = mysql_numrows($result); //Loop out code $i = 0; while ($i < 1) { $aid = @mysql_result($result, $i, "aid"); $name = @mysql_result($result, $i, "name"); $owner = @mysql_result($result, $i, "owner"); $health = @mysql_result($result, $i, "health"); $i++; } if ($health < "20") { // Now we see if the adoptable is dead. If it is, we do not heal... if ($health == "0") { $article_title = "This Companion is DEAD!"; $article_content = "<br /><br /> This Companion has died and is well beyound the abilities of this Healing Potion!"; } else { // Add health points to the total health of this adoptable... $newhealth = $health + 5; // Actually insert our health information into the database... $query = "UPDATE " . $prefix . "owned_adoptables SET health='" . $newhealth . "' WHERE aid='" . $aid . "'"; mysql_query($query); // End the if statement of healing $image = getcurrentimage($aid); $itemimage = getcurrentitemimage($id); $article_title = "Healing Potion"; $article_content = "<br /><br /><center><img src=" . $image . "><br /><br />The Healing Potion has eased " . $name . "'s pain and brought it's health up to " . $newhealth . "/20 !</center>"; } } else { // Adoptable is invalid, show an error... $article_title = $err_idnoexist; $article_content = $err_idnoexist_text; } } } } Sea |
#5
|
|||
|
|||
![]()
And I add an items table as well? You are amazing, Thanks so much XD
EDIT: What fields do I put in the items table and what settings do they have? |
#6
|
|||
|
|||
![]()
It is not just that easy, you also have to edit the my doadopt.php page to account for the health field. You will need some way for your users to make coin if you want them to actually pay for the items. The fields in the items table will depend on how you want the items to work. You will need to edit your admin.php so that you can add items in. All I did was give you a starting point.
Sea |
#7
|
|||
|
|||
![]()
I'm working on the shop mod for myself seeing as yours is donator only. I'm trying to convert Kisazeky's script. Thank you for the starting point, I really appreciate it. XD
|
#8
|
||||
|
||||
![]()
Careful Ashje, other scripts, especially those not done by professionals, may look like they incorporate nicely, but just pile up errors, and problems, that you will receive later on down the road.
Just a heads up mate. |
#9
|
|||
|
|||
![]()
Thanks for the heads up XD
|
#10
|
|||
|
|||
![]() Quote:
Sea |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mys v1.3.4 Item Shop Mod(s): NPC + Item Display + Tooltips | Kyttias | Mys v1.3.x Mods | 55 | 06-19-2020 11:21 AM |
Buy X of Item A to receive X of Item B | AndromedaKerova | Suggestions and Feature Requests | 0 | 11-09-2014 08:17 PM |
Forum integration? | Aasixx | Questions and Supports | 6 | 05-06-2012 03:01 PM |
User Integration | blueskyler | Questions and Supports | 3 | 12-19-2011 02:26 PM |
What's New? |
What's Hot? |
What's Popular? |