Yvan Major
Member
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:
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
}
}
}
}