Resource icon

Monster and Item Auras! 1.6.0

How do I add this to my own item/monster?

First we need to define the variable that will hold the aura:​

C#:
private Bittiez.Aura.Aura EffectAura;
This is usually done near the top of your class:
C#:
    public class EffectCloak : BaseCloak
    {
        private Bittiez.Aura.Aura EffectAura;

Next the step is setting up the aura, because we have to set this up any time the server restarts it's easiest to create a re-usable method to do this:​

C#:
        private void AuraSetup()
        {
            EffectAura = new Bittiez.Aura.Aura(this, 8, Bittiez.Aura.AURATYPE.EFFECTAURA);
            EffectAura.AffectsSelf = true;
        }

Now we need to call this method when 1. we initially create the item or 2. the server restarts and the item is effectively re-created:​

Add a call to the method you just created AuraSetup(); to the constructor method of your class:
C#:
        [Constructable]
        public EffectCloak(int hue)
            : base(0x1515, hue)
        {
            AuraSetup();
            Weight = 5.0;
        }
And add a call in the deserialize method as well:
C#:
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();
            AuraSetup();
        }

Last, but not least, we need a way to turn the aura on and off, if this is for monsters/ or items left on the ground(like a healing totem or something), I recommend using sector activation and deactivate:​

This will turn the aura on when that area of the map is active (from a player entering the area)
C#:
        public override void OnSectorActivate()
        {
            EffectAura.EnableAura();
            base.OnSectorActivate();
        }

        public override void OnSectorDeactivate()
        {
            EffectAura.DisableAura();
            base.OnSectorDeactivate();
        }

Or if you want the player to be able to turn it on and off via double clicking the item:
C#:
        public override void OnDoubleClick(Mobile from)
        {
            if (EffectAura.ToggleAura()) from.SendMessage("Aura on"); else from.SendMessage("Aura off");
            base.OnDoubleClick(from);
        }

Alternatively you could have the aura always on by using EffectAura.EnableAura(); inside the AuraSetup() method.

Now your aura should work if everything was setup properly.

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back