- ServUO Version
- Publish Unknown
- Ultima Expansion
- None
Ok so I have an Item it insta tames a creature. The creature is on the water now when you double click the item you target the creature bam insta tame works fine, but what i would like is that the creature would then be moved right next to you, because you would be on a boat of course. here is code. doesnt have to be super complex just need said creature to when targeted and sucessful it moved next to the control master.
THIS is in testing phase so stil playing around with it.
THIS is in testing phase so stil playing around with it.
item code:
using System;
using Server.Network;
using Server.Prompts;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
public class GoldenCoral : Item
{
[Constructable]
public GoldenCoral() : base(0xB14C)
{
Weight = 1.0;
Name = "a piece of golden coral";
}
public GoldenCoral(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);
int version = reader.ReadInt();
}
public override void OnDoubleClick(Mobile from)
{
if ( !IsChildOf( from.Backpack ) )
{
from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
}
else
{
from.SendMessage("Target the animal or beast you wish to instantly tame.");
from.Target = new CoralTarget(this);
}
}
}
public class CoralTarget : Target
{
private GoldenCoral m_Coral;
public CoralTarget( GoldenCoral coral = null) : base(15, false, TargetFlags.None )
{
if (coral != null)
{
m_Coral = coral;
}
}
protected override void OnTarget(Mobile from, object target)
{
if (target is BaseTameable)
{
BaseTameable t = (BaseTameable)target;
//if (t.ControlMaster != null)
//{
//from.SendMessage("That pet belongs to someone else!");
//}
if ( !t.Controlled || t.ControlMaster != from || t.IsBonded == false )
{
from.SendLocalizedMessage( 1063737 ); // You can only use this gem on a tamed pet that you own.
}
else if (t.Tamable == false)
{
from.SendMessage("That creature cannot be tamed!");
}
else
{
t.RawStr = t.RawStr / 2;
t.RawInt = t.RawInt / 2;
t.RawDex = t.RawDex / 2;
t.HitsMaxSeed = t.HitsMaxSeed / 2;
t.Hits = t.Hits / 2;
t.Controlled = true;
t.ControlMaster = from;
from.SendMessage("You have instantly tamed your target.");
if (m_Coral != null)
{
m_Coral.Delete(); // Delete the coral
}
}
}
if (target is DeepSeaSahuagin)
{
DeepSeaSahuagin d = (DeepSeaSahuagin)target;
if (d.ControlMaster != null)
{
from.SendMessage("That pet belongs to someone else!");
}
else
{
d.Controlled = true;
d.ControlMaster = from;
from.SendMessage("You have instantly tamed your target.");
if (m_Coral != null)
{
m_Coral.Delete(); // Delete the coral
}
}
}
else
{
from.SendMessage("That is not a valid target.");
}
}
}
}