ServUO Version
Publish 57
Ultima Expansion
Endless Journey
using System;
using Server.Engines.Quests;
using Server.Mobiles;

namespace Server.Items
{
public class TwistedWealdTele : Teleporter
{
[Constructable]
public TwistedWealdTele()
: base(new Point3D(2189, 1253, 0), Map.Ilshenar)
{
}

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

public override bool OnMoveOver(Mobile m)
{
if (m.NetState == null || !m.NetState.SupportsExpansion(Expansion.ML))
{
m.SendLocalizedMessage(1072608); // You must upgrade to the Mondain's Legacy expansion in order to enter here.
return true;
}
else if (!MondainsLegacy.TwistedWeald && (int)m.AccessLevel < (int)AccessLevel.GameMaster)
{
m.SendLocalizedMessage(1042753, "Twisted Weald"); // ~1_SOMETHING~ has been temporarily disabled.
return true;
}

if (m is PlayerMobile)
{
PlayerMobile player = (PlayerMobile)m;

if (QuestHelper.GetQuest(player, typeof(DreadhornQuest)) != null)
return base.OnMoveOver(m);

player.SendLocalizedMessage(1074274); // You dance in the fairy ring, but nothing happens.
}

return true;
}

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();
}
}
}
The above script is the TwistedWealdTeleporters.cs script. The teleporter items in the script above are only allowed to enter after receiving a quest called "DreadhornQuest". What I want is to know how to be able to enter forever when I complete some quest and not while I'm getting a quest. For example, the teleporter B is currently unavailable, but I would like to know how to be able to enter forever once I complete the specific request given by the NPC A.
 
You can try to play with account tags,for example,when a player complete your quest,this quest give the player's account a special tag.
After,on the OnMoveOver of your teleport,you can check the account tag,if the tag is not in his account,cannot use the teleport.
If you want the player repeat the quest to enter,just remove the tag when the player use the teleport in the OnMoveOver method.
When player complete the quest:
C#:
Account acct = from.Mobile.Account as Account;
acct.SetTag("YourQuest", "Completed");

And the OnMoveOver tag check:
C#:
i
public override bool OnMoveOver(Mobile m)
{
    Account acct = m.Mobile.Account as Account;
    if (!acct.GetTag("YourQuest") == "Completed")
    {
    from.SendMessage("Your need to complete YourQuest to use this teleport.");   
    return false;   
    }
    //Rest of the code
Make sure you got at top of teleport script:
C#:
using Server.Accounting;
If you want to player just get the quest and complete one time,forget about the "NotCompleted" tag.
 
Last edited:
You can try to play with account tags,for example,when a player complete your quest,this quest give the player's account a special tag.
After,on the OnMoveOver of your teleport,you can check the account tag,if the tag is not in his account,cannot use the teleport.
If you want the player repeat the quest to enter,just remove the tag when the player use the teleport in the OnMoveOver method.
When player complete the quest:
C#:
Account acct = from.Mobile.Account as Account;
acct.SetTag("YourQuest", "Completed");
When your player use the teleport:
C#:
Account acct = from.Mobile.Account as Account;
acct.SetTag("YourQuest", "NotCompleted");
And the OnMoveOver tag check:
C#:
if (acct.GetTag("YourQuest") == "NotCompleted")
{
from.SendMessage("Your need to complete YourQuest to use this teleport.");          
}
Make sure you got at top of teleport script:
C#:
using Server.Accounting;
If you want to player just get the quest and complete one time,forget about the "NotCompleted" tag.
Thank you very much for your detailed explanation. I understand to some extent, but I don't know how to apply it anywhere else except "OnMoveOver". I'm sorry for my lack of understanding. Can you show me an example of the application to the teleporter?
 
Back