Hi, i am trying to make a Pet Bonding Potion OSI style but named "Artificial Life" that i want to be craftable since my server will have mostly all skills up-gradable to 120. I know i will have more to customize to make it craftable :)

If anyone able to tell me where i am wrong it would be much appreciated.

Got an error in script:

Code:
Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
Errors:
+ Customs/PetBondingPotion.cs:
    CS0534: Line 51: 'Server.Items.ArtificialLife' does not implement inherited
abstract member 'Server.Items.BasePotion.Drink(Server.Mobile)'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Code:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;

namespace Server.Items
{
   public class BondingTarget : Target
   {
      private ArtificialLife m_Potion;

      public BondingTarget( ArtificialLife potion ) : base( 1, false, TargetFlags.None )
      {
         m_Potion = potion;
      }

      protected override void OnTarget( Mobile from, object target )
      {
         if ( target is BaseCreature )
         {
            BaseCreature t = ( BaseCreature ) target;

            if ( t.IsBonded == true )
            {
               from.SendMessage( "That pet is already bonded!" );
            }
            else if ( t.ControlMaster != from )
            {
               from.SendMessage( "That is not your pet!" );
            }
            else 
            
               {

            t.IsBonded = !t.IsBonded;
            from.SendMessage( "You bond with the pet!" );

                  m_Potion.Delete(); // Delete the potion
               }
           
         }
         else
         {
            from.SendMessage( "That is not a valid traget." ); 
         }
      }
   }

   public class ArtificialLife : BasePotion
   {
            [Constructable]
      public ArtificialLife() : base( 0xF04, PotionEffect.PetRes )
      {
         Weight = 1.0; 
         LootType = LootType.Blessed;
       Hue = 1170;
      }

      public ArtificialLife( Serial serial ) : base( serial )
      {
      }

      public override void Serialize( GenericWriter writer )
      {
         base.Serialize( writer );

         writer.Write( (int) 0 ); // version
      }

      public override void Deserialize( GenericReader reader )
      {
         base.Deserialize( reader );
         LootType = LootType.Blessed;

         int version = reader.ReadInt();
      }

      public override bool DisplayLootType{ get{ return false; } }

      public override void OnDoubleClick( Mobile from ) // Override double click of the potion to call our target
      {
          if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
          {
              from.SendMessage("This does not belong to you!!");
              return;
          }
         if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack
         {
             from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
         }
         else
         {
            from.SendMessage( "Choose the pet you wish to bond with." ); 
            from.Target = new BondingTarget( this ); // Call our target
          }
      }   
   }
}
 
I didnt test it but Visual Studio told me that you didnt implement the Drink method.
Looking at other potions (especially the explosion ones) made me think that you should simply rename your OnDoubleClick method to Drink (same parameter)
 
Why are you making it a actual potion (BasePotion)? You could make it a item to avoid hassling with the basepotion code. Then just add the item to Scripts\Services\Craft\DefAlchemy.cs to be able to craft it with alchemy.
 
Yvan I think the Drink method is just the Use method for potions, take a look at the explosion potions :)
 
Why are you making it a actual potion (BasePotion)? You could make it a item to avoid hassling with the basepotion code. Then just add the item to Scripts\Services\Craft\DefAlchemy.cs to be able to craft it with alchemy.

Really dont know, just trying to add customs that are working the same as the repo.
 
I couldn't find any video or text showing the exact process in which the pet bonding potion work. My understanding is that you double click the item (Pet Bonding Potion). Giving you a target cursor which you then click on the pet you want to bond to you. At which point it either bonds the pet or present a gump asking you if that is in fact the pet you want to bond yes/no(not sure if there is a gump on the osi version). If yes it changes the mobiles bonded to true (and that its bonded to you.) then it deletes the item (potion). If no, nothing happens.
Just because it has potion in its name doesn't necessarily mean that it's a potion in the code. ;)

I recommend googling something like "Pet Bonding Deed Site:www.runuo.com" (without the "") There is lots of examples of this. You may even find a script that works plug and play with servuo/modern runuo.
Then just change its name and itemid. :) If you get any errors feel free to ask for help.
 
Last edited:
Yes the script i submitted at the very first come from the Pet Bonding Deed idea. I just want the compile items like ServUO Repo does. I just dont like to add items "customs" that i know it can compile like the rest of the item set. I am working the BaseArtificialLife.cs so it should compile correctly or i will resubmit. I think for the server stability its always better but i may be wrong.
 
Back