bala1412

Member
ServUO Version
Publish 57
Ultima Expansion
Endless Journey
public class SkillTotalTeleporter : Teleporter
{
private SkillName m_Skill;
private double m_Required;
private string m_MessageString;
private int m_MessageNumber;

[Constructable]
public SkillTotalTeleporter()
{ }

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

[CommandProperty(AccessLevel.GameMaster)]
public SkillName Skill
{
get { return m_Skill; }
set
{
m_Skill = value;
InvalidateProperties();
}
}

[CommandProperty(AccessLevel.GameMaster)]
public double Required
{
get { return m_Required; }
set
{
m_Required = value;
InvalidateProperties();
}
}

[CommandProperty(AccessLevel.GameMaster)]
public string MessageString
{
get { return m_MessageString; }
set
{
m_MessageString = value;
InvalidateProperties();
}
}

[CommandProperty(AccessLevel.GameMaster)]
public int MessageNumber
{
get { return m_MessageNumber; }
set
{
m_MessageNumber = value;
InvalidateProperties();
}
}

public override bool CanTeleport(Mobile m)
{
if (!base.CanTeleport(m))
{
return false;
}

int sktotal = m.SkillsTotal/10;

if (sktotal < m_Required)
{
if (m.BeginAction(this))
{
if (m_MessageString != null)
{
m.Send(new UnicodeMessage(Serial, ItemID, MessageType.Regular, 0x3B2, 3, "ENU", null, m_MessageString));
}
else if (m_MessageNumber != 0)
{
m.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, m_MessageNumber, null, ""));
}

Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerStateCallback(EndMessageLock), m);
}

return false;
}

return true;
}

public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);

int skillIndex = (int)m_Skill;
string skillName;

if (skillIndex >= 0 && skillIndex < SkillInfo.Table.Length)
{
skillName = SkillInfo.Table[skillIndex].Name;
}
else
{
skillName = "(Invalid)";
}

list.Add(1060661, "{0}\t{1:F1}", skillName, m_Required);

if (m_MessageString != null)
{
list.Add(1060662, "Message\t{0}", m_MessageString);
}
else if (m_MessageNumber != 0)
{
list.Add(1060662, "Message\t#{0}", m_MessageNumber);
}
}

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

writer.Write(0); // version

writer.Write((int)m_Skill);
writer.Write(m_Required);
writer.Write(m_MessageString);
writer.Write(m_MessageNumber);
}

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

int version = reader.ReadInt();

switch (version)
{
case 0:
{
m_Skill = (SkillName)reader.ReadInt();
m_Required = reader.ReadDouble();
m_MessageString = reader.ReadString();
m_MessageNumber = reader.ReadInt();

break;
}
}
}

private void EndMessageLock(object state)
{
((Mobile)state).EndAction(this);
}
}
Telepor.jpgTeleport1.jpg
I'm using the teleporter of the script above. But when you step on the teleporter with the game master account, a message appears on the teleporter, and when you step on the teleporter with the user account, it appears as a system message on the lower left. Is there a way to get a message on the teleporter like a game master account?
 
You can try this,depending on "when" you need the message:

C#:
this.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Your message");
 
You can try this,depending on "when" you need the message:

C#:
this.PublicOverheadMessage(MessageType.Regular, 0x3B2, true, "Your message");
We found the cause of the error. I didn't know there's a way Thank you for letting me know!
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back