sano

Member
ServUO Version
Publish 57
Ultima Expansion
Time Of Legends
hello folks. im trying to disable "you cant cast that in town" at all and allow all spells to be cast everywhere,
i modified SpellHelper.cs:
by commenting this


SpellHelper.cs::
        public static bool CheckTown(Point3D loc, Mobile caster)
        {
            if (IsTown(loc, caster))
            {
                caster.SendLocalizedMessage(500946); // You cannot cast this in town!
                return false;
            }

            return true;
        }

also replaced this
C#:
else if (SpellHelper.CheckTown(p, this.Caster) && this.CheckSequence())

to
C#:
else if (this.CheckSequence())
in every spell which was asking for that.

everything compiled without errors but im still not able to cast in town. any suggestions please? want to disable that option at all.
 
You don't necessarily need to edit all the spells to remove those lines if you just force the CheckTown method to always return true.

The other part of the puzzle is in regions, spells have an OnCastInTown method you'll need to remove or force it to return true (you will need to check any spells that override the method too, and remove the overrides, etc)

So, if you force CheckTown and OnCastInTown to return true, you don't need to change any of the other related code, because it will simply never be reached.
 
You don't necessarily need to edit all the spells to remove those lines if you just force the CheckTown method to always return true.

The other part of the puzzle is in regions, spells have an OnCastInTown method you'll need to remove or force it to return true (you will need to check any spells that override the method too, and remove the overrides, etc)

So, if you force CheckTown and OnCastInTown to return true, you don't need to change any of the other related code, because it will simply never be reached.
sorry in this case

C#:
public override bool OnBeginSpellCast(Mobile m, ISpell s)
        {
            if (!IsDisabled() && !s.OnCastInTown(this))
            {
                m.SendLocalizedMessage(500946); // You cannot cast this in town!
                return false;
            }

            return true;
        }

and

C#:
public virtual bool OnCastInTown(Region r)
        {
            return true;
        }

are those correct?
P.S checked your method and spells are casting in towns now!

and one more thing so i will not create new topic... is it possible to permanently turn off oneshot guards at all? the methods i found here are just disabling guarded regions at all, i need guarded regions to stay but without guards. thank you for your assistance
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back