Macil
Initiate
I have Orcs as a playable race on my server and as one of the benefits to being a Player Orc I wanted to make it so NPC Orcs do not attack on-site any Player Orcs.
I started by looking at the code for the Orcish Kin Mask which only got me so far as now Orcs do not attack Player Orcs on site as intended, but they also do not defend themselves now if attacked.
What I'd like to do is add an aggro timer for lets just say 5 minutes. So if a Player Orc should attack a NPC Orc, all NPC Orcs can target and attack that player for 5 minutes from the last moment of attack/contact/conflict that player had with an Orc, even if you lose line of sight temporarily. I just want an invisible timer in the background that tells the game the player can be openly attacked by Orcs.
When the timer expires, I want any Orcs currently targeting a player to continue attacking until line of sight is broken (like a normal aggro timer would work with any other NPC in the game in any other normal instance)
Here is what I have so far in Orc.cs:
I started by looking at the code for the Orcish Kin Mask which only got me so far as now Orcs do not attack Player Orcs on site as intended, but they also do not defend themselves now if attacked.
What I'd like to do is add an aggro timer for lets just say 5 minutes. So if a Player Orc should attack a NPC Orc, all NPC Orcs can target and attack that player for 5 minutes from the last moment of attack/contact/conflict that player had with an Orc, even if you lose line of sight temporarily. I just want an invisible timer in the background that tells the game the player can be openly attacked by Orcs.
When the timer expires, I want any Orcs currently targeting a player to continue attacking until line of sight is broken (like a normal aggro timer would work with any other NPC in the game in any other normal instance)
Here is what I have so far in Orc.cs:
Code:
using System;
using Server.Items;
using Server.Misc;
namespace Server.Mobiles
{
[CorpseName("an orcish corpse")]
public class Orc : BaseCreature
{
[Constructable]
public Orc()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
this.Name = NameList.RandomName("orc");
this.Body = 17;
this.BaseSoundID = 0x45A;
this.SetStr(96, 120);
this.SetDex(81, 105);
this.SetInt(36, 60);
this.SetHits(58, 72);
this.SetDamage(5, 7);
this.SetDamageType(ResistanceType.Physical, 100);
this.SetResistance(ResistanceType.Physical, 25, 30);
this.SetResistance(ResistanceType.Fire, 20, 30);
this.SetResistance(ResistanceType.Cold, 10, 20);
this.SetResistance(ResistanceType.Poison, 10, 20);
this.SetResistance(ResistanceType.Energy, 20, 30);
this.SetSkill(SkillName.MagicResist, 50.1, 75.0);
this.SetSkill(SkillName.Tactics, 55.1, 80.0);
this.SetSkill(SkillName.Wrestling, 50.1, 70.0);
this.Fame = 1500;
this.Karma = -1500;
this.VirtualArmor = 28;
switch ( Utility.Random(20) )
{
case 0:
this.PackItem(new Scimitar());
break;
case 1:
this.PackItem(new Katana());
break;
case 2:
this.PackItem(new WarMace());
break;
case 3:
this.PackItem(new WarHammer());
break;
case 4:
this.PackItem(new Kryss());
break;
case 5:
this.PackItem(new Pitchfork());
break;
}
this.PackItem(new ThighBoots());
switch ( Utility.Random(3) )
{
case 0:
this.PackItem(new Ribs());
break;
case 1:
this.PackItem(new Shaft());
break;
case 2:
this.PackItem(new Candle());
break;
}
if (0.2 > Utility.RandomDouble())
this.PackItem(new BolaBall());
}
public Orc(Serial serial)
: base(serial)
{
}
public override InhumanSpeech SpeechType
{
get
{
return InhumanSpeech.Orc;
}
}
public override bool CanRummageCorpses
{
get
{
return true;
}
}
public override int TreasureMapLevel
{
get
{
return 1;
}
}
public override int Meat
{
get
{
return 1;
}
}
public override OppositionGroup OppositionGroup
{
get
{
return OppositionGroup.SavagesAndOrcs;
}
}
public override void GenerateLoot()
{
this.AddLoot(LootPack.Meager);
}
public override bool IsEnemy(Mobile m)
{
if (m.Race == Race.Orc || m.Player && m.FindItemOnLayer(Layer.Helm) is OrcishKinMask)
return false;
return base.IsEnemy(m);
}
public override void AggressiveAction(Mobile aggressor, bool criminal)
{
base.AggressiveAction(aggressor, criminal);
Item item = aggressor.FindItemOnLayer(Layer.Helm);
if (item is OrcishKinMask)
{
AOS.Damage(aggressor, 50, 0, 100, 0, 0, 0);
item.Delete();
aggressor.FixedParticles(0x36BD, 20, 10, 5044, EffectLayer.Head);
aggressor.PlaySound(0x307);
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
}
public override bool SwampHazardImmune { get { return true; } }
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
}
}