RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Guards

Kathrina

Wanderer
thank you everyone for your help but i'm just not understanding what you are trying to tell me. i understand that the prob might be in the baseguard script. my problem is however that i know about as much scripting as flying. i haven't grown wings yet this is the first time i have even thought about scripting anything and i am just the kind of person to jump right into the fire when i decide to do something. this is my first script and i just don't see what i am missing.
can anyone help me with a little more detail. as i look at my base guard script i don't see where the problem lies. :(:confused:
 

Kathrina

Wanderer
thank you everyone for your help but i'm just not understanding what you are trying to tell me. i understand that the prob might be in the baseguard script. my problem is however that i know about as much scripting as flying. i haven't grown wings yet this is the first time i have even thought about scripting anything and i am just the kind of person to jump right into the fire when i decide to do something. this is my first script and i just don't see what i am missing.:eek:
can anyone help me with a little more detail. as i look at my base guard script i don't see where the problem lies. :(:confused:

i thought i had already taken out what made them teleport from the base gaurd script
 

brixey2451

Wanderer
you can try this, i havent tested it, it looks like you guards are getting sent to a location, this is from your baseguard.cs, i just comented out lines 59-66

Code:
using System;
using System.Collections;
using Server.Misc;
using Server.Items;
using Server.Mobiles;

namespace Server.Mobiles
{
	public abstract class BaseGuard : Mobile
	{
		public static void Spawn( Mobile caller, Mobile target )
		{
			Spawn( caller, target, 1, true );
		}

		public static void Spawn( Mobile caller, Mobile target, int amount, bool onlyAdditional )
		{
			if ( target == null || target.Deleted )
				return;

			foreach ( Mobile m in target.GetMobilesInRange( 15 ) )
			{
				if ( m is BaseGuard )
				{
					BaseGuard g = (BaseGuard)m;

					if ( g.Focus == null ) // idling
					{
						g.Focus = target;

						--amount;
					}
					else if ( g.Focus == target && !onlyAdditional )
					{
						--amount;
					}
				}
			}

			while ( amount-- > 0 )
				caller.Region.MakeGuard( target );
		}

		public BaseGuard( Mobile target )
		{
			if ( target != null )
			{
				Location = target.Location;
				Map = target.Map;

				Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 );
			}
		}

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

		//public override bool OnBeforeDeath()
		//{
			//Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );

			//PlaySound( 0x1FE );

			//return false;
		//}

		public abstract Mobile Focus{ get; set; }

		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();
		}
	}
}
 

Greystar

Wanderer
brixey2451;706451 said:
you can try this, i havent tested it, it looks like you guards are getting sent to a location, this is from your baseguard.cs, i just comented out lines 59-66

Code:
using System;
using System.Collections;
using Server.Misc;
using Server.Items;
using Server.Mobiles;

namespace Server.Mobiles
{
	public abstract class BaseGuard : Mobile
	{
		public static void Spawn( Mobile caller, Mobile target )
		{
			Spawn( caller, target, 1, true );
		}

		public static void Spawn( Mobile caller, Mobile target, int amount, bool onlyAdditional )
		{
			if ( target == null || target.Deleted )
				return;

			foreach ( Mobile m in target.GetMobilesInRange( 15 ) )
			{
				if ( m is BaseGuard )
				{
					BaseGuard g = (BaseGuard)m;

					if ( g.Focus == null ) // idling
					{
						g.Focus = target;

						--amount;
					}
					else if ( g.Focus == target && !onlyAdditional )
					{
						--amount;
					}
				}
			}

			while ( amount-- > 0 )
				caller.Region.MakeGuard( target );
		}

		public BaseGuard( Mobile target )
		{
			if ( target != null )
			{
				Location = target.Location;
				Map = target.Map;

				Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 5023 );
			}
		}

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

		//public override bool OnBeforeDeath()
		//{
			//Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3728, 10, 10, 2023 );

			//PlaySound( 0x1FE );

			//return false;
		//}

		public abstract Mobile Focus{ get; set; }

		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();
		}
	}
}

This code is still going to make it so guards will Insta-Kill your players and doesn't take into account that now being able to kill guards isn't going to crash the shard.

I would strongly bugtest this before even using it to make sure that when and if a player even can successfully kill the guard that there is not going to be crash your shard.

For those of you that choose to use this as a "COMPLETE" mod to make guards killable I say... Good Luck!

To the person who post this in the FAQ... I recommend you revise your FAQ once you get all the information needed to make them truely killable.
 

Greystar

Wanderer
Tomahawk;706570 said:
Works for me, even as a player..

Have a guard chase you out of a guarded region. Have a mobile kill the guard. as a GM Force a guard to attack a dragon for instance. Have a player take out a pet that is normally aggressive in town where a guard can see it. There are several things that guards don't normally have to worry about since they kill a player in one hit. If on your shard you are able to hit and kill a guard without them hitting you then you must have adjusted other things on your shard to prevent the guards insta-kill (ie one hit kill) from working. the target.Kill() built into the code will kill a player once the guard hits. I know you just said making them killable and that is true, but most people also don't want them to teleport and don't want them to one hit kill their players.

So that's one of the reasons for my previous post. People will jump on it saying "Yes someone who created an easy way to make killable guards" and it's not.
 

brixey2451

Wanderer
i never said they it would stop them from instant kill, i just fixed it to the last post, i only have a lemited time to try and help fix stuff with out uo, so its hard to do both at the same time, for the instant killing you can try this, i just used your archer guard and my name is next to the parts edited and the reason why i took the parts out, let me know if that works also the same changes should be applyed with the worriers :)

Code:
using System;
using System.Collections;
using Server;
using Server.Misc;
using Server.Items;
using Server.Mobiles;

namespace Server.Mobiles
{
    [CorpseName( "an archerguard corpse" )]
    public class ArcherGuard : BaseGuard
    {
        private Timer m_AttackTimer, m_IdleTimer;

        private Mobile m_Focus;

        [Constructable]
        public ArcherGuard()
            : this(null)
        {
        }

        public ArcherGuard(Mobile target)
            : base(target)
		{
			InitStats( 100, 125, 25 );
			Title = "the guard";

			SpeechHue = Utility.RandomDyedHue();

			Hue = Utility.RandomSkinHue();

			if ( Female = Utility.RandomBool() )
			{
				Body = 0x191;
				Name = NameList.RandomName( "female" );
			}
			else
			{
				Body = 0x190;
				Name = NameList.RandomName( "male" );
			}

			new Horse().Rider = this;

			AddItem( new StuddedChest() );
			AddItem( new StuddedArms() );
			AddItem( new StuddedGloves() );
			AddItem( new StuddedGorget() );
			AddItem( new StuddedLegs() );
			AddItem( new Boots() );
			AddItem( new SkullCap() );

			Bow bow = new Bow();

			bow.Movable = true;
			bow.Crafter = this;
			bow.Quality = WeaponQuality.Exceptional;

			AddItem( bow );

			Container pack = new Backpack();

			pack.Movable = false;

			Arrow arrows = new Arrow( 250 );

			arrows.LootType = LootType.Newbied;

			pack.DropItem( arrows );
			pack.DropItem( new Gold( 10, 25 ) );

			AddItem( pack );

			Skills[SkillName.Anatomy].Base = 120.0;
			Skills[SkillName.Tactics].Base = 120.0;
			Skills[SkillName.Archery].Base = 120.0;
			Skills[SkillName.MagicResist].Base = 120.0;
			Skills[SkillName.DetectHidden].Base = 100.0;

			Fame = 1000;
            Karma = -2000;

			this.NextCombatTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 );
			this.Focus = target;
		}

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

        public override bool OnBeforeDeath()
        {
            if (m_Focus != null && m_Focus.Alive)
                new AvengeTimer(m_Focus).Start(); // If a guard dies, one more guard will spawn

            return base.OnBeforeDeath();
        }
        public override bool ShowFameTitle { get { return false; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public override Mobile Focus
        {
            get
            {
                return m_Focus;
            }
            set
            {
                if (Deleted)
                    return;

                Mobile oldFocus = m_Focus;

                if (oldFocus != value)
                {
                    m_Focus = value;

                    if (value != null)
                        this.AggressiveAction(value);

                    Combatant = value;

                    if (oldFocus != null && !oldFocus.Alive)
                        Say("Thou hast suffered thy punishment, scoundrel.");

                    if (value != null)
                        Say(500131); // Thou wilt regret thine actions, swine!

                    if (m_AttackTimer != null)
                    {
                        m_AttackTimer.Stop();
                        m_AttackTimer = null;
                    }

                    if (m_IdleTimer != null)
                    {
                        m_IdleTimer.Stop();
                        m_IdleTimer = null;
                    }

                    if (m_Focus != null)
                    {
                        m_AttackTimer = new AttackTimer(this);
                        m_AttackTimer.Start();
                        ((AttackTimer)m_AttackTimer).DoOnTick();
                    }
                    else
                    {
                        m_IdleTimer = new IdleTimer(this);
                        m_IdleTimer.Start();
                    }
                }
                else if (m_Focus == null && m_IdleTimer == null)
                {
                    m_IdleTimer = new IdleTimer(this);
                    m_IdleTimer.Start();
                }
            }
        }

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

            writer.Write((int)0); // version

            writer.Write(m_Focus);
        }

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

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Focus = reader.ReadMobile();

                        if (m_Focus != null)
                        {
                            m_AttackTimer = new AttackTimer(this);
                            m_AttackTimer.Start();
                        }
                        else
                        {
                            m_IdleTimer = new IdleTimer(this);
                            m_IdleTimer.Start();
                        }

                        break;
                    }
            }
        }

        public override void OnAfterDelete()
        {
            if (m_AttackTimer != null)
            {
                m_AttackTimer.Stop();
                m_AttackTimer = null;
            }

            if (m_IdleTimer != null)
            {
                m_IdleTimer.Stop();
                m_IdleTimer = null;
            }

            base.OnAfterDelete();
        }

        private class AvengeTimer : Timer
        {
            private Mobile m_Focus;

            public AvengeTimer(Mobile focus)
                : base(TimeSpan.FromSeconds(2.5), TimeSpan.FromSeconds(1.0), 3) // After 2.5 seconds, one guard will spawn every 1.0 second, three times
            {
                m_Focus = focus;
            }

            protected override void OnTick()
            {
                BaseGuard.Spawn(m_Focus, m_Focus, 1, true);
            }
        }

        private class AttackTimer : Timer
        {
            private ArcherGuard m_Owner;
            //	private bool m_Shooting;

            public AttackTimer(ArcherGuard owner)
                : base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(0.1))
            {
                m_Owner = owner;
            }

            public void DoOnTick()
            {
                OnTick();
            }

            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                m_Owner.Criminal = true;
                m_Owner.Kills = +1;
                m_Owner.Stam = m_Owner.StamMax;

                Mobile target = m_Owner.Focus;

                if (target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful(target)))
                {
                    m_Owner.Focus = null;
                    Stop();
                    return;
                }
                else if (m_Owner.Weapon is Fists)
                {
                    m_Owner.Kill();
                    Stop();
                    return;
                }

                if (target != null && m_Owner.Combatant != target)
                    m_Owner.Combatant = target;

                if (target == null)
                {
                    Stop();
                }

                if (target is BaseCreature)
                    ((BaseCreature)target).NoKillAwards = true;

                //brixey~ so guards dont hit your max hits target.Damage(target.HitsMax, m_Owner);
                //brixey~ so they dont kill by overriden damage target.Kill(); // just in case, maybe Damage is overriden on some shard

                if (target.Corpse != null && !target.Player)
                    target.Corpse.Delete();

                m_Owner.Focus = null;
                Stop();
            }/*else if ( !m_Owner.InRange( target, 20 ) )
				{
					m_Shooting = false;
					m_Owner.Focus = null;
				}
				else if ( !m_Owner.InLOS( target ) )
				{
					m_Shooting = false;
					TeleportTo( target );
				}
				else if ( !m_Owner.CanSee( target ) )
				{
					m_Shooting = false;

					if ( !m_Owner.InRange( target, 2 ) )
					{
						if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
							TeleportTo( target );
					}
					else
					{
						if ( !m_Owner.UseSkill( SkillName.DetectHidden ) && Utility.Random( 50 ) == 0 )
							m_Owner.Say( "Reveal!" );
					}
				}
				else
				{
					if ( m_Shooting && (TimeToSpare() || OutOfMaxDistance( target )) )
						m_Shooting = false;
					else if ( !m_Shooting && InMinDistance( target ) )
						m_Shooting = true;

					if ( !m_Shooting )
					{
						if ( m_Owner.InRange( target, 1 ) )
						{
							if ( !m_Owner.Move( (Direction)(m_Owner.GetDirectionTo( target ) - 4) | Direction.Running ) && OutOfMaxDistance( target ) ) // Too close, move away
								RunTo( target );
						}
						else if ( !m_Owner.InRange( target, 2 ) )
						{
							if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
								RunTo( target );
						}
					}
				}*/
        }

        private class IdleTimer : Timer
        {
            private ArcherGuard m_Owner;
            private int m_Stage;

            public IdleTimer(ArcherGuard owner)
                : base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.5))
            {
                m_Owner = owner;
            }

            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                if ((m_Stage++ % 4) == 0 || !m_Owner.Move(m_Owner.Direction))
                    m_Owner.Direction = (Direction)Utility.Random(8);

                if (m_Stage > 16)
                {
                    Effects.SendLocationParticles(EffectItem.Create(m_Owner.Location, m_Owner.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                    m_Owner.PlaySound(0x1FE);

                    m_Owner.Delete();
                }
            }
        }
    }
}
 

Kathrina

Wanderer
once i figure out how to stop him from teleporting after a few minutes i think i have them done killing him doesn't create a crash and he is droping a corps now i think i am almost there thanks to all of you i couldn't have done it without you guys
here is the killable baseguard script
Code:
using System;
using System.Collections;
using Server.Misc;
using Server.Items;
using Server.Mobiles;

namespace Server.Mobiles
{
	public abstract class BaseGuard : Mobile
	{
		public static void Spawn( Mobile caller, Mobile target )
		{
			Spawn( caller, target, 1, true );
		}

		public static void Spawn( Mobile caller, Mobile target, int amount, bool onlyAdditional )
		{
			if ( target == null || target.Deleted )
				return;

			foreach ( Mobile m in target.GetMobilesInRange( 15 ) )
			{
				if ( m is BaseGuard )
				{
					BaseGuard g = (BaseGuard)m;

					if ( g.Focus == null ) // idling
					{
						g.Focus = target;

						--amount;
					}
					else if ( g.Focus == target && !onlyAdditional )
					{
						--amount;
					}
				}
			}

			while ( amount-- > 0 )
				caller.Region.MakeGuard( target );
		}

		public BaseGuard( Mobile target )
		{
			if ( target != null )
			{
				Location = target.Location;
				Map = target.Map;

			}
		}

		public BaseGuard( Serial serial ) : base( serial )
		{
		}
        
		public abstract Mobile Focus{ get; set; }

		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();
		}
	}
}
and here is the archer guards
Code:
using System;
using System.Collections;
using Server;
using Server.Misc;
using Server.Items;
using Server.Mobiles;

namespace Server.Mobiles
{
    [CorpseName( "an archerguard corpse" )]
    public class ArcherGuard : BaseGuard
    {
        private Timer m_AttackTimer, m_IdleTimer;

        private Mobile m_Focus;

        [Constructable]
        public ArcherGuard()
            : this(null)
        {
        }

        public ArcherGuard(Mobile target)
            : base(target)
		{
			InitStats( 200, 150, 25 );
			Title = "the guard";

			SpeechHue = Utility.RandomDyedHue();

			Hue = Utility.RandomSkinHue();

			if ( Female = Utility.RandomBool() )
			{
				Body = 0x191;
				Name = NameList.RandomName( "female" );
			}
			else
			{
				Body = 0x190;
				Name = NameList.RandomName( "male" );
			}

			new Horse().Rider = this;

			AddItem( new StuddedChest() );
			AddItem( new StuddedArms() );
			AddItem( new StuddedGloves() );
			AddItem( new StuddedGorget() );
			AddItem( new StuddedLegs() );
			AddItem( new Boots() );
			AddItem( new SkullCap() );

			Bow bow = new Bow();

			bow.Movable = true;
			bow.Crafter = this;
			bow.Quality = WeaponQuality.Exceptional;

			AddItem( bow );

			Container pack = new Backpack();

			pack.Movable = false;

			Arrow arrows = new Arrow( 250 );

			arrows.LootType = LootType.Newbied;

			pack.DropItem( arrows );
			pack.DropItem( new Gold( 10, 25 ) );

			AddItem( pack );

			Skills[SkillName.Anatomy].Base = 120.0;
			Skills[SkillName.Tactics].Base = 120.0;
			Skills[SkillName.Archery].Base = 120.0;
			Skills[SkillName.MagicResist].Base = 120.0;
			Skills[SkillName.DetectHidden].Base = 100.0;

			Fame = 1000;
            Karma = -2000;

			this.NextCombatTime = DateTime.Now + TimeSpan.FromSeconds( 0.5 );
			this.Focus = target;
		}

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

        public override bool OnBeforeDeath()
        {
            if (m_Focus != null && m_Focus.Alive)
                new AvengeTimer(m_Focus).Start(); // If a guard dies, one more guard will spawn

            return base.OnBeforeDeath();
        }
        public override bool ShowFameTitle { get { return false; } }

        [CommandProperty(AccessLevel.GameMaster)]
        public override Mobile Focus
        {
            get
            {
                return m_Focus;
            }
            set
            {
                if (Deleted)
                    return;

                Mobile oldFocus = m_Focus;

                if (oldFocus != value)
                {
                    m_Focus = value;

                    if (value != null)
                        this.AggressiveAction(value);

                    Combatant = value;

                    if (oldFocus != null && !oldFocus.Alive)
                        Say("Thou hast suffered thy punishment, scoundrel.");

                    if (value != null)
                        Say(500131); // Thou wilt regret thine actions, swine!

                    if (m_AttackTimer != null)
                    {
                        m_AttackTimer.Stop();
                        m_AttackTimer = null;
                    }

                    if (m_IdleTimer != null)
                    {
                        m_IdleTimer.Stop();
                        m_IdleTimer = null;
                    }

                    if (m_Focus != null)
                    {
                        m_AttackTimer = new AttackTimer(this);
                        m_AttackTimer.Start();
                        ((AttackTimer)m_AttackTimer).DoOnTick();
                    }
                    else
                    {
                        m_IdleTimer = new IdleTimer(this);
                        m_IdleTimer.Start();
                    }
                }
                else if (m_Focus == null && m_IdleTimer == null)
                {
                    m_IdleTimer = new IdleTimer(this);
                    m_IdleTimer.Start();
                }
            }
        }

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

            writer.Write((int)0); // version

            writer.Write(m_Focus);
        }

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

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    {
                        m_Focus = reader.ReadMobile();

                        if (m_Focus != null)
                        {
                            m_AttackTimer = new AttackTimer(this);
                            m_AttackTimer.Start();
                        }
                        else
                        {
                            m_IdleTimer = new IdleTimer(this);
                            m_IdleTimer.Start();
                        }

                        break;
                    }
            }
        }

        public override void OnAfterDelete()
        {
            if (m_AttackTimer != null)
            {
                m_AttackTimer.Stop();
                m_AttackTimer = null;
            }

            if (m_IdleTimer != null)
            {
                m_IdleTimer.Stop();
                m_IdleTimer = null;
            }

            base.OnAfterDelete();
        }

        private class AvengeTimer : Timer
        {
            private Mobile m_Focus;

            public AvengeTimer(Mobile focus)
                : base(TimeSpan.FromSeconds(2.5), TimeSpan.FromSeconds(1.0), 3) // After 2.5 seconds, one guard will spawn every 1.0 second, three times
            {
                m_Focus = focus;
            }

            protected override void OnTick()
            {
                BaseGuard.Spawn(m_Focus, m_Focus, 1, true);
            }
        }

        private class AttackTimer : Timer
        {
            private ArcherGuard m_Owner;
            //	private bool m_Shooting;

            public AttackTimer(ArcherGuard owner)
                : base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(0.1))
            {
                m_Owner = owner;
            }

            public void DoOnTick()
            {
                OnTick();
            }

            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                m_Owner.Criminal = true;
                m_Owner.Kills = +1;
                m_Owner.Stam = m_Owner.StamMax;

                Mobile target = m_Owner.Focus;

                if (target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful(target)))
                {
                    m_Owner.Focus = null;
                    Stop();
                    return;
                }
                else if (m_Owner.Weapon is Fists)
                {
                    m_Owner.Kill();
                    Stop();
                    return;
                }

                if (target != null && m_Owner.Combatant != target)
                    m_Owner.Combatant = target;

                if (target == null)
                {
                    Stop();
                }

                if (target is BaseCreature)
                    ((BaseCreature)target).NoKillAwards = true;

                target.Damage(target.HitsMax, m_Owner);
                target.Kill(); // just in case, maybe Damage is overriden on some shard

                if (target.Corpse != null && !target.Player)
                    target.Corpse.Delete();

                m_Owner.Focus = null;
                Stop();
            }/*else if ( !m_Owner.InRange( target, 20 ) )
				{
					m_Shooting = false;
					m_Owner.Focus = null;
				}
				else if ( !m_Owner.InLOS( target ) )
				{
					m_Shooting = false;
					TeleportTo( target );
				}
				else if ( !m_Owner.CanSee( target ) )
				{
					m_Shooting = false;

					if ( !m_Owner.InRange( target, 2 ) )
					{
						if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
							TeleportTo( target );
					}
					else
					{
						if ( !m_Owner.UseSkill( SkillName.DetectHidden ) && Utility.Random( 50 ) == 0 )
							m_Owner.Say( "Reveal!" );
					}
				}
				else
				{
					if ( m_Shooting && (TimeToSpare() || OutOfMaxDistance( target )) )
						m_Shooting = false;
					else if ( !m_Shooting && InMinDistance( target ) )
						m_Shooting = true;

					if ( !m_Shooting )
					{
						if ( m_Owner.InRange( target, 1 ) )
						{
							if ( !m_Owner.Move( (Direction)(m_Owner.GetDirectionTo( target ) - 4) | Direction.Running ) && OutOfMaxDistance( target ) ) // Too close, move away
								RunTo( target );
						}
						else if ( !m_Owner.InRange( target, 2 ) )
						{
							if ( !m_Owner.Move( m_Owner.GetDirectionTo( target ) | Direction.Running ) && OutOfMaxDistance( target ) )
								RunTo( target );
						}
					}
				}*/
        }

        private class IdleTimer : Timer
        {
            private ArcherGuard m_Owner;
            private int m_Stage;

            public IdleTimer(ArcherGuard owner)
                : base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.5))
            {
                m_Owner = owner;
            }

            protected override void OnTick()
            {
                if (m_Owner.Deleted)
                {
                    Stop();
                    return;
                }

                if ((m_Stage++ % 4) == 0 || !m_Owner.Move(m_Owner.Direction))
                    m_Owner.Direction = (Direction)Utility.Random(8);

                if (m_Stage > 16)
                {
                    Effects.SendLocationParticles(EffectItem.Create(m_Owner.Location, m_Owner.Map, EffectItem.DefaultDuration), 0x3728, 10, 10, 2023);
                    m_Owner.PlaySound(0x1FE);

                    m_Owner.Delete();
                }
            }
        }
    }
}
if anyone finds a bug other than them teleporting please let me know and i'll start working on it
 
Top