Full Version : XmlIsEnemy
xmlspawner >>XMLSpawner Attachments >>XmlIsEnemy


<< Prev | Next >>

ArteGordon- 10-08-2007
QUOTE


        public virtual bool IsEnemy(Mobile m)
        {

            XmlIsEnemy a = (XmlIsEnemy)XmlAttach.FindAttachment(this, typeof(XmlIsEnemy));
            if (a != null)
            {
                return a.IsEnemy(m);
            }

            OppositionGroup g = this.OppositionGroup;

            if (g != null && g.IsEnemy(this, m))
                return true;


add the mod in red to the beginning of the IsEnemy method as shown above in BaseCreature.cs around line 810.

Also make sure that you have this at the top of basecreature.cs

CODE

using Server.Engines.XmlSpawner2;


Then you can use the XmlIsEnemy attachment to specify the conditions that will determine which mobs are enemies of the creature it is attached to.

For example a spawn entry like

orc/ATTACH/<xmlisenemy/test/@GETONCARRIED,orcwar,longsword,visible=true>


would spawn an orc that would only attack people that carried the longsword named 'orcwar'

and an entry like


orc/ATTACH/<xmlisenemy/test/@~GETONCARRIED,orcwar,longsword,visible=true>


would do just the opposite and protect people carrying the sword.

The Test property on the attachment can be set to any valid xmlspawner condition.

Kin-Kran- 10-08-2007
Arte, is this the same for RunUO 1.0

Thx

ArteGordon- 10-08-2007
yes, should work just fine with 1.0