BIGCHIEF

Member
I am trying to add a brigand that is red to the game so players can gain justice off them but cant remember how i edited the brigand script for it before when I had my other server can someone please help me out here.
 
Check out this neat script from my archive of runuo scripts I've gathered.
This might help you. An NPC murderer (Pker, Red). He is tough to beat and will run off, if his health drops too low.
He also talks smack. *credit to ICE for the script.

The Pker Script will show you how to add the Justice point gains
 

Attachments

  • Cracker.cs
    8.9 KB · Views: 17
  • PKers.cs
    2.7 KB · Views: 18
Last edited:
ty very much for the help I am now getting this error.

Errors:
+ Mobiles/Monsters/Humanoid/Brigand.cs:
CS0117: Line 115: 'Server.Mobiles.PlayerMobile' does not contain a definition for 'ComputeSkillTotal'
CS0117: Line 116: 'Server.Mobiles.PlayerMobile' does not contain a definition for 'ComputeSkillTotal'
Scripts: One or more scripts failed to compile or no script files were found.
 
this is what i added to my brigand script

private DateTime m_NextJustAward;

public override void OnDeath( Container c )
{
base.OnDeath( c );

if ( this.Kills >= 5 && DateTime.Now >= m_NextJustAward )
{
Mobile m = FindMostRecentDamager( false );

if ( m != null && m.Player )
{
bool gainedPath = false;

int theirTotal = PlayerMobile.ComputeSkillTotal( m );
int ourTotal = PlayerMobile.ComputeSkillTotal( this );

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 );
}
}
}
}
 
Your Compute method doesnt exist:
int theirTotal = PlayerMobile.ComputeSkillTotal( m );
int ourTotal = PlayerMobile.ComputeSkillTotal( this );

youshould be able to simply use:
int theirTotal = m.SkillsTotal;
int ourTotal = this.SkillsTotal;

Also if you use the [ code]...[ /code] (without the space in the brackets) it will be easier to read since it keeps the indention
 
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();
        }
    }
}
 
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();
        }
    }
}
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).
Code:
if(this.Kills>=5&& DateTime.Now>= m_NextJustAward )

Also you probably want to move this from the top of the method to the bottom
Code:
base.OnDeath( c );
If you call the base.OnDeath code first, then the creature gets deleted before any of your code runs.
 
Last edited:
This bit of code below was tested and is working

check out this release also
: https://www.servuo.com/threads/pk-gang-by-x-ray.4030/

Code:
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);

		}
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back