using System;
using Server.Items;
namespace Server.Mobiles
{
public class Brigand : BaseCreature
{
[Constructable]
public Brigand()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
this.SpeechHue = Utility.RandomDyedHue();
this.Title = "the brigand";
this.Hue = Utility.RandomSkinHue();
if (this.Female = Utility.RandomBool())
{
this.Body = 0x191;
this.Name = NameList.RandomName("female");
this.AddItem(new Skirt(Utility.RandomNeutralHue()));
}
else
{
this.Body = 0x190;
this.Name = NameList.RandomName("male");
this.AddItem(new ShortPants(Utility.RandomNeutralHue()));
}
this.SetStr(86, 100);
this.SetDex(81, 95);
this.SetInt(61, 75);
this.SetDamage(10, 23);
this.SetSkill(SkillName.Fencing, 66.0, 97.5);
this.SetSkill(SkillName.Macing, 65.0, 87.5);
this.SetSkill(SkillName.MagicResist, 25.0, 47.5);
this.SetSkill(SkillName.Swords, 65.0, 87.5);
this.SetSkill(SkillName.Tactics, 65.0, 87.5);
this.SetSkill(SkillName.Wrestling, 15.0, 37.5);
this.Fame = 1000;
this.Karma = -1000;
this.AddItem(new Boots(Utility.RandomNeutralHue()));
this.AddItem(new FancyShirt());
this.AddItem(new Bandana());
switch ( Utility.Random(7))
{
case 0:
this.AddItem(new Longsword());
break;
case 1:
this.AddItem(new Cutlass());
break;
case 2:
this.AddItem(new Broadsword());
break;
case 3:
this.AddItem(new Axe());
break;
case 4:
this.AddItem(new Club());
break;
case 5:
this.AddItem(new Dagger());
break;
case 6:
this.AddItem(new Spear());
break;
}
Utility.AssignRandomHair(this);
}
public Brigand(Serial serial)
: base(serial)
{
}
public override bool ClickTitle
{
get
{
return false;
}
}
public override bool AlwaysMurderer
{
get
{
return true;
}
}
public override void GenerateLoot()
{
this.AddLoot(LootPack.Average);
}
private DateTime m_NextJustAward;
public override void OnDeath( Container c )
{
base.OnDeath( c );
if ( this.Kills >= 5 && DateTime.Now >= m_NextJustAward )
{
Mobile m = FindMostRecentDamager( true );
if ( m != null && m.Player )
{
bool gainedPath = true;
int theirTotal = m.SkillsTotal;
int ourTotal = this.SkillsTotal;
int pointsToGain = 1 + ((theirTotal - ourTotal) / 50);
if ( pointsToGain < 1 )
pointsToGain = 1;
else if ( pointsToGain > 4 )
pointsToGain = 4;
if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) )
{
if ( gainedPath )
m.SendLocalizedMessage( 1049367 ); // You have gained a path in Justice!
else
m.SendLocalizedMessage( 1049363 ); // You have gained in Justice.
m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist );
m.PlaySound( 0x1F7 );
m_NextJustAward = DateTime.Now + TimeSpan.FromMinutes( pointsToGain * 2 );
}
}
}
}
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();
}
}
}
You can remove this check because we already know we want to give justice for this mob. This code will just fail outright because probably BaseCreatures don't have their NextJustAward set, and the mobile won't have more than 5 kills (its red status is set by AlwaysMurderer).Even with my script reading like this my players still arnt gaining justice.
Code:using System; using Server.Items; namespace Server.Mobiles { public class Brigand : BaseCreature { [Constructable] public Brigand() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4) { this.SpeechHue = Utility.RandomDyedHue(); this.Title = "the brigand"; this.Hue = Utility.RandomSkinHue(); if (this.Female = Utility.RandomBool()) { this.Body = 0x191; this.Name = NameList.RandomName("female"); this.AddItem(new Skirt(Utility.RandomNeutralHue())); } else { this.Body = 0x190; this.Name = NameList.RandomName("male"); this.AddItem(new ShortPants(Utility.RandomNeutralHue())); } this.SetStr(86, 100); this.SetDex(81, 95); this.SetInt(61, 75); this.SetDamage(10, 23); this.SetSkill(SkillName.Fencing, 66.0, 97.5); this.SetSkill(SkillName.Macing, 65.0, 87.5); this.SetSkill(SkillName.MagicResist, 25.0, 47.5); this.SetSkill(SkillName.Swords, 65.0, 87.5); this.SetSkill(SkillName.Tactics, 65.0, 87.5); this.SetSkill(SkillName.Wrestling, 15.0, 37.5); this.Fame = 1000; this.Karma = -1000; this.AddItem(new Boots(Utility.RandomNeutralHue())); this.AddItem(new FancyShirt()); this.AddItem(new Bandana()); switch ( Utility.Random(7)) { case 0: this.AddItem(new Longsword()); break; case 1: this.AddItem(new Cutlass()); break; case 2: this.AddItem(new Broadsword()); break; case 3: this.AddItem(new Axe()); break; case 4: this.AddItem(new Club()); break; case 5: this.AddItem(new Dagger()); break; case 6: this.AddItem(new Spear()); break; } Utility.AssignRandomHair(this); } public Brigand(Serial serial) : base(serial) { } public override bool ClickTitle { get { return false; } } public override bool AlwaysMurderer { get { return true; } } public override void GenerateLoot() { this.AddLoot(LootPack.Average); } private DateTime m_NextJustAward; public override void OnDeath( Container c ) { base.OnDeath( c ); if ( this.Kills >= 5 && DateTime.Now >= m_NextJustAward ) { Mobile m = FindMostRecentDamager( true ); if ( m != null && m.Player ) { bool gainedPath = true; int theirTotal = m.SkillsTotal; int ourTotal = this.SkillsTotal; int pointsToGain = 1 + ((theirTotal - ourTotal) / 50); if ( pointsToGain < 1 ) pointsToGain = 1; else if ( pointsToGain > 4 ) pointsToGain = 4; if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) ) { if ( gainedPath ) m.SendLocalizedMessage( 1049367 ); // You have gained a path in Justice! else m.SendLocalizedMessage( 1049363 ); // You have gained in Justice. m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist ); m.PlaySound( 0x1F7 ); m_NextJustAward = DateTime.Now + TimeSpan.FromMinutes( pointsToGain * 2 ); } } } } 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(); } } }
if(this.Kills>=5&& DateTime.Now>= m_NextJustAward )
base.OnDeath( c );
public override void OnDeath( Container c )
{
Mobile m = FindMostRecentDamager( false );
if ( m != null && m.Player )
{
bool gainedPath = false;
int theirTotal = m.SkillsTotal;
int ourTotal = this.SkillsTotal;
int pointsToGain = 1 + ((theirTotal - ourTotal) / 50);
if ( pointsToGain < 1 )
pointsToGain = 1;
else if ( pointsToGain > 4 )
pointsToGain = 4;
if ( VirtueHelper.Award( m, VirtueName.Justice, pointsToGain, ref gainedPath ) )
{
if ( gainedPath )
m.SendLocalizedMessage( 1049367 ); // You have gained a path in Justice!
else
m.SendLocalizedMessage( 1049363 ); // You have gained in Justice.
m.FixedParticles( 0x375A, 9, 20, 5027, EffectLayer.Waist );
m.PlaySound( 0x1F7 );
}
}
base.OnDeath(c);
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.