Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Suggestions and Feature Requests

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-09-2009, 04:36 AM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 10,073
Ashje
Default Item & Health Integration

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?
Reply With Quote
  #2  
Old 07-09-2009, 10:38 AM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 15,584
Seapyramid
Default RE: Item & Health Integration

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
Reply With Quote
  #3  
Old 07-09-2009, 10:48 PM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 10,073
Ashje
Default RE: Item & Health Integration

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...
Reply With Quote
  #4  
Old 07-09-2009, 11:47 PM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 15,584
Seapyramid
Default RE: Item & Health Integration

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 />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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 /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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>";
which sent info to another page.. this code

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 />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;
                  }
              }
          }
      }
to make it finally work & that is just the basic healing.

Sea
Reply With Quote
  #5  
Old 07-10-2009, 04:54 AM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 10,073
Ashje
Default RE: Item & Health Integration

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?
Reply With Quote
  #6  
Old 07-10-2009, 09:27 AM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 15,584
Seapyramid
Default RE: Item & Health Integration

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
Reply With Quote
  #7  
Old 07-10-2009, 06:29 PM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 10,073
Ashje
Default RE: Item & Health Integration

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
Reply With Quote
  #8  
Old 07-14-2009, 09:34 AM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 28,664
Bloodrun
Send a message via Yahoo to Bloodrun
Default RE: Item & Health Integration

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.
Reply With Quote
  #9  
Old 07-14-2009, 10:46 PM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 10,073
Ashje
Default RE: Item & Health Integration

Thanks for the heads up XD
Reply With Quote
  #10  
Old 10-08-2009, 12:55 PM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 15,584
Seapyramid
Default RE: Item & Health Integration

Quote:
Originally Posted by rolpete08
That is really great that including a health and items that can heal. so how to trace the error on some part on users to make coin if you want them to actually pay for the items?


_________________
Travel insurance quote
??? What?? This is NOT a working mod, just some ideas for someone who was trying to make their own. What you are asking makes no sense unless you have tried to just use these examples as a working mod & in that case you would have many errors.

Sea
Reply With Quote
Reply


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
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


All times are GMT -5. The time now is 12:13 PM.

Currently Active Users: 9784 (0 members and 9784 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