Mysidia Adoptables Support Forum  

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

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-09-2009, 11:47 PM
Seapyramid Seapyramid is offline
Premium Member
 
Join Date: Feb 2009
Posts: 373
Gender: Female
Credits: 21,419
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
 


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 07:05 PM.

Currently Active Users: 3203 (0 members and 3203 guests)
Threads: 4,081, Posts: 32,032, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636