View Single Post
  #32  
Old 05-03-2017, 09:37 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,358
Abronsyth is on a distinguished road
Default

Ok, I made my own health system so I cannot garauntee that this will work, but here is my item function for health increasing items:
PHP Code:
 function items_health($item$adopt){
  
$mysidia Registry::get("mysidia");
  
$health $mysidia->db->select("owned_adoptables", array("health"), "aid ='{$adopt->aid}'")->fetchObject();
  
$addHealth $adopt->health $item->value;
      
//Check if the adoptable's health is already at maximum.    
  
if($adopt->health >= 100){
    
$note "Your pet is already fully healed! The {$item->itemname} was not used.";
  }
  
//Not at maximum, but don't go overboard!
  
elseif($addHealth 100){
    
$mysidia->db->update("owned_adoptables", array("health" => 100), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
    
$note "The {$item->itemname} fully healed your pet!";
    
$delitem $item->remove();
  }
  
//Not at maximum, won't go overboard. Proceed.
  
else{
    
$mysidia->db->update("owned_adoptables", array("health" => $addHealth), "aid ='{$adopt->aid}' and owner='{$item->owner}'");
    
$note "The {$item->itemname} raised your pet's health by {$item->value}! Their health is now at {$addHealth}.";
    
$delitem $item->remove();
  }
  return 
$note;

(also need to edit classes/class_privateitem, and add the function in the database)
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote