Hello guys!
There is some way to set enemies cant flee when they have 10%hp?
Thanks in advance,i think the code is in baseAI.cs and all "x"AI.cs?Thank you!!!
 
BaseAI.cs
public virtual double TransformMoveDelay(double delay)

Code:
            if (!m_Mobile.IsDeadPet && (m_Mobile.ReduceSpeedWithDamage || m_Mobile.IsSubdued))
            {
                double offset = (double)m_Mobile.Hits / m_Mobile.HitsMax;

                if (offset < 0.0)
                {
                    offset = 0.0;
                }
                else if (offset > 1.0)
                {
                    offset = 1.0;
                }

                offset = 1.0 - offset;

                delay += (offset * speedfactor);
            }
 
Hi, sorry but I feel like an idiot but what is working?, is there anything to change? Di I missed a secret post? I dont see where I can stop them from fleeing , set the 1.0 to 0(I tried did nothing )? help :)
 
Last edited:
Maybe this will help explain it some. You could change it for every single creature by editing the base file. There are certain things that are meant to run. So the best thing is to create your own creature. I've made you an NPC wearing dyed plate armor, that won't flee, is immune to bard stuff, auto dispels summons, Poison immune, and always Red. All of those are just overriding the default class for this one creature.

Code:
using System;
using Server.Items;
using System.Collections.Generic;
using Server.Engines.CannedEvil;

namespace Server.Mobiles
{
	[CorpseName( "rhasce corpse" )]
	public class Rhasce : BaseCreature
	{
		public override bool CanFlee { get { return false; } }
		public override bool BardImmune{ get{ return true; } } //make it bardimmune: unpeaceable\unprovokable\undiscorded
		public override bool AutoDispel{ get{ return true; } } //make it auto dispel summons
		public override Poison PoisonImmune{ get{ return Poison.Lethal; } } //make it immmune to lethal poison
		public override bool AlwaysMurderer{ get{ return true; } } //make the npc red
		
		public int m_ArmorHUE = 0x54E;

		[Constructable]
		public Rhasce() : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
			Name = "Rhasce"; //the name players will see
			// Body = 0x25D; //Male Body
			Body = 0x25E; //Female Body

			SetStr( 500, 750 ); //set stats
			SetDex( 250, 400 );
			SetInt( 350, 550 );

			SetHits( 2000, 2500 ); //set hp

			SetDamage( 70, 80 ); //set how much damage ~

			SetDamageType( ResistanceType.Physical, 50 ); //which damage type it does
			SetDamageType( ResistanceType.Cold, 50 );
			// SetDamageType( ResistanceType.Fire, 50 );
			// SetDamageType( ResistanceType.Poison, 50 );
			// SetDamageType( ResistanceType.Energy, 50 );

			SetResistance( ResistanceType.Physical, 60, 80 ); //what resists it has
			SetResistance( ResistanceType.Fire, 55, 70 );
			SetResistance( ResistanceType.Cold, 55, 70 );
			SetResistance( ResistanceType.Poison, 55, 70 );
			SetResistance( ResistanceType.Energy, 55, 70 );

			SetSkill( SkillName.Anatomy, 200.0 );
			SetSkill( SkillName.Tactics, 200.0 );
			SetSkill( SkillName.Macing, 200.0 );

			Fame = 30000; //its fame/karma
			Karma = -30000;
           
			VirtualArmor = 50;

			PlateChest chest = new PlateChest(); //add its armor and set its hue and not movable so it won't be on loot
			chest.Hue = m_ArmorHUE;
			chest.Movable = false;
			AddItem( chest );
			
			PlateArms arms = new PlateArms();
			arms.Hue = m_ArmorHUE;
			arms.Movable = false;
			AddItem( arms );
			
			PlateGloves gloves = new PlateGloves();
			gloves.Hue = m_ArmorHUE;
			gloves.Movable = false;
			AddItem( gloves );
			
			PlateGorget gorget = new PlateGorget();
			gorget.Hue = m_ArmorHUE;
			gorget.Movable = false;
			AddItem( gorget );
			
			PlateLegs legs = new PlateLegs();
			legs.Hue = m_ArmorHUE;
			legs.Movable = false;
			AddItem( legs );
			
			WarHammer weapon = new WarHammer(); //add its weapon and set its hue and not movable so it won't be on loot
			weapon.Name = "Rhasce's Hammer of Smiting!";
			weapon.Hue = m_ArmorHUE;
			weapon.Movable = false;
			AddItem( weapon );
			
			FurBoots boots = new FurBoots(); //add its boots and set its hue and not movable so it won't be on loot
			boots.Hue = m_ArmorHUE;
			boots.Movable = false;
			AddItem( boots );

			Item hair = new Item( 8251 );  //add its hair and set its hue and not movable so it won't be on loot
			hair.Hue = m_ArmorHUE; 
			hair.Layer = Layer.Hair; 
			hair.Movable = false; 
			AddItem( hair );

			AddItem( new Gold( 2500, 5000 ));
		}

		public override void GenerateLoot() //add normal loot
		{
			AddLoot( LootPack.UltraRich ); // set the loot type to ultra rich
		}

		public Rhasce( Serial serial ) : base( serial ) // no idea what this does
		{
		}

		public override void Serialize( GenericWriter writer ) // this save the info on the mob so it won't be deleted all the time
		{
			base.Serialize( writer );
			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader ) // this load the info on the mob so it won't be deleted all the time
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}
 
Back