zerodowned
Sorceror
I'm working on the vet reward, Crystal Portal.
Trying to script it so for each location I can just add StartTeleport and it will teleport the player's pets where the player is going.
It's compiling and teleporting the player without any problems but not the pet.
Trying to script it so for each location I can just add StartTeleport and it will teleport the player's pets where the player is going.
It's compiling and teleporting the player without any problems but not the pet.
Code:
using System;
using Server;
using Server.Network;
using Server.Mobiles;
using Server.Spells;
namespace Server.Items
{
public class CrystalPortal : Item
{
private Point3D m_PointDest;
private Map m_MapDest;
[CommandProperty( AccessLevel.GameMaster )]
public Point3D PointDest
{
get { return m_PointDest; }
set { m_PointDest = value; InvalidateProperties(); }
}
[CommandProperty( AccessLevel.GameMaster )]
public Map MapDest
{
get { return m_MapDest; }
set { m_MapDest = value; InvalidateProperties(); }
}
[Constructable]
public CrystalPortal() : base()
{
ItemID= 18059;
Name= "Crystal Portal";
}
public CrystalPortal( 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 virtual void StartTeleport( Mobile m )
{
Map map = m_MapDest;
if ( map == null || map == Map.Internal )
map = m.Map;
Point3D p = m_PointDest;
if ( p == Point3D.Zero )
p = m.Location;
Server.Mobiles.BaseCreature.TeleportPets( m, p, map );
}
public override bool HandlesOnSpeech{ get{ return true; } }
/////// Begin Speech Entries //////
public override void OnSpeech( SpeechEventArgs e )
{
if (!e.Handled && e.Mobile.InRange(this.Location, 2))
{
PlayerMobile pm = e.Mobile as PlayerMobile;
if (e.Speech.ToLower() == "Britain Mint")
{
e.Handled = true;
e.Mobile.MoveToWorld( new Point3D( 1434, 1699, 2 ), Map.Trammel );
StartTeleport( pm );
}
}
}
}
}