RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[2.1] Doom Points System (Guarenteed Artifact Over Time) (XML)

Iraq-

Sorceror
XmlDoomPoints System

By: SHAMBAMPOW

What is this?
XmlDoomPoints is a system designed to serve as a "light at the end of the tunnel" for players doing the Doom Gauntlet. For players doing Doom, it isn't unlikely to sometimes go days without receiving an artifact, and then suddenly receive 2 or 3 within an hour. This system allows players a more steady and predictable means of obtaining artifacts from Doom Gauntlet.

While the normal random chance remains intact (This can also be removed if you would rather use JUST my system, but I chose to leave it in). Players making rounds in Doom earn points for killing each boss. These points are stored within an XmlAttachment attached to each player.

The Dark Father = 45-55 points. (5x other bosses).
Other Gauntlet Bosses = 9-11 points. (5 other bosses * 10 = ~Dark Father value)
Target Artifact Cost: 500 points. (Takes 5-12 rounds: Easily changed in DoomPointsSettings.cs)

When a player makes enough rounds to earn an artifact, they are rewarded a random one.
The handout for the artifact is the same "For your valor in combating the fallen beast, a special artifact has been bestowed on you." message.

The XmlAttachment stores:
Points: Current # of Points the player has.. Resets back to 0 when artifact is awarded.
TotalPoints: Total # of Points the player has ever had over time.
TotalArtifacts: Total # of Artifacts given to the player using the XmlDoomPoints System.

This system is easy to install, and (since it used XmlAttachments) requires edits only to the OnDeath methods of the Doom Gauntlet Bosses.

Installation:
  1. Extract XmlDoomPoints.zip into your Customs folder.
  2. In DemonKnight.cs add
    Code:
    using Server.Engines.XmlSpawner2;
    at the top, and then add
    Code:
            public static void DistributePoints( BaseCreature creature )
             {
                 List<DamageStore> rights = BaseCreature.GetLootingRights( creature.DamageEntries, creature.HitsMax );
                 for ( int i = rights.Count - 1; i >= 0; --i )
                 {
                     DamageStore ds = rights[i];
                     if ( !ds.m_HasRight )
                         rights.RemoveAt( i );
                     else
                     {
                         XmlDoomPoints a = (XmlDoomPoints)XmlAttach.FindAttachment( rights[i].m_Mobile, typeof( XmlDoomPoints ));
                         if( a == null )
                         {
                             XmlAttach.AttachTo( rights[i].m_Mobile, new XmlDoomPoints());
                         }
                         else
                         {
                             if( creature.GetType() == typeof( DemonKnight ) )
                             {
                                 a.Points += DoomPoints.DarkFatherPoints;
                                 a.TotalPoints += DoomPoints.DarkFatherPoints;
                             }
                             else if (creature.GetType() == typeof(AbysmalHorror) || creature.GetType() == typeof(ShadowKnight) || creature.GetType() == typeof(DarknightCreeper) || creature.GetType() == typeof(Impaler) || creature.GetType() == typeof(FleshRenderer) )
                             {
                                 a.Points += DoomPoints.GauntletBossPoints;
                                 a.TotalPoints += DoomPoints.GauntletBossPoints;
                             }
                             if( a.Points >= DoomPoints.PointsPerArtifacts )    // if they have reached the points value, give them an artifact.
                             {
                                 DistributeArtifact( rights[i].m_Mobile, CreateRandomArtifact() );
                                 a.TotalArtifacts++;
                                 a.Points -= DoomPoints.PointsPerArtifacts;
                             }
                         }
                     }
                 }
             }
    Right after the FindRandomPlayer method around line 99.
  3. In DemonKnight.cs, AbysmalHorror.cs, DarknightCreeper.cs, Fleshrenderer.cs, Impaler.cs, and ShadowKnight.cs, find the OnDeath method and change it to:
    Code:
            public override void OnDeath( Container c )
             {
                 base.OnDeath( c );
                 if ( !Summoned && !NoKillAwards && DemonKnight.CheckArtifactChance( this ) )
                     DemonKnight.DistributeArtifact( this );
                 DemonKnight.DistributePoints( this ); // Added for XmlDoomPoints System by SHAMBAMPOW
             }
  4. Restart your server, and it's all set.
* Players who do not have the XmlDoomPoints attachment will obtain it automaticallywhen they kill their first Doom Gauntlet Boss. (Staff may also add an attachment to a player by typing "[AddAtt XmlDoomPoints" and targeting the player).
* As a staff to check up on a players doom points attachment stats simply type "[GetAtt XmlDoomPoints" and click the player.
 

Attachments

  • XmlDoomPoints.zip
    1.2 KB · Views: 174

Iraq-

Sorceror
Are you having any specific issues?
I have this working on my server. The instructions are in the first thread. Once you finish them and restart your server the changes will apply. If you, or anyone for that matter, would like help getting this (or any of my systems) to run I will gladly assist you either in this thread, in script support, or via private chat.
 

clarissa

Sorceror
I have added this and get the error that it is not finding the that it is not finding the xmldoompoints and the name xmlattach does not exist on lines 175 and 178 in the DemonKnight.cs
 

Iraq-

Sorceror
Clarissa, put
Code:
using Server.Engines.XmlSpawner2;
at the top of the script. That should fix your issues.
 
You menchoned XMLSpawner2 from Arte when we talked eairler, and i see it in the code here. does this mean you've included it in this script set? if so thanks :p
 

Iraq-

Sorceror
No, xmlspawner2 is required for this system but is not included. Installing XmlSpawner2 requires multiple edits to key files, you will need to follow the installation instructions listed on the XmlSpawner2 thread.
 
hi there

im ttrying to put thison my server. i got everything else good but the findrandomplayer part keeps giving me an error. could someone post the code for me? ive tried a few different ways and donnt know where im going wrong :(
 
ok this is what im gettin

tRunUO - [www.runuo.com] Version 2.1, Build 4272.35047
Core: Running on .NET Framework Version 2.0.50727
Core: Running with arguments: -debug
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Mobiles/Monsters/AOS/DemonKnight.cs:
CS1002: Line 80: ; expected
CS1519: Line 118: Invalid token '{' in class, struct, or interface member de
claration
CS1519: Line 121: Invalid token 'for' in class, struct, or interface member
declaration
CS1519: Line 121: Invalid token '>=' in class, struct, or interface member d
eclaration
CS1519: Line 121: Invalid token ')' in class, struct, or interface member de
claration
CS1519: Line 125: Invalid token 'if' in class, struct, or interface member d
eclaration
CS1519: Line 125: Invalid token ')' in class, struct, or interface member de
claration
CS1519: Line 126: Invalid token '(' in class, struct, or interface member de
claration
CS1519: Line 126: Invalid token ')' in class, struct, or interface member de
claration
CS0116: Line 129: A namespace does not directly contain members such as fiel
ds or methods
CS1518: Line 130: Expected class, delegate, enum, interface, or struct
CS1518: Line 135: Expected class, delegate, enum, interface, or struct
CS1518: Line 140: Expected class, delegate, enum, interface, or struct
CS1518: Line 145: Expected class, delegate, enum, interface, or struct
CS1518: Line 150: Expected class, delegate, enum, interface, or struct
CS1518: Line 163: Expected class, delegate, enum, interface, or struct
CS1518: Line 179: Expected class, delegate, enum, interface, or struct
CS1518: Line 184: Expected class, delegate, enum, interface, or struct
CS1518: Line 195: Expected class, delegate, enum, interface, or struct
CS1518: Line 204: Expected class, delegate, enum, interface, or struct
CS1518: Line 249: Expected class, delegate, enum, interface, or struct
CS1518: Line 255: Expected class, delegate, enum, interface, or struct
CS1518: Line 256: Expected class, delegate, enum, interface, or struct
CS1518: Line 257: Expected class, delegate, enum, interface, or struct
CS1518: Line 258: Expected class, delegate, enum, interface, or struct
CS1518: Line 260: Expected class, delegate, enum, interface, or struct
CS1518: Line 262: Expected class, delegate, enum, interface, or struct
CS1518: Line 264: Expected class, delegate, enum, interface, or struct
CS1518: Line 275: Expected class, delegate, enum, interface, or struct
CS1022: Line 278: Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

Iraq-

Sorceror
ok this is what im gettin
Code:
tRunUO - [www.runuo.com] Version 2.1, Build 4272.35047
 
Core: Running on .NET Framework Version 2.0.50727
 
Core: Running with arguments: -debug
 
Core: Optimizing for 2 processors
 
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
 
Errors:
 
+ Mobiles/Monsters/AOS/DemonKnight.cs:
 
CS1002: Line 80: ; expected
 
CS1519: Line 118: Invalid token '{' in class, struct, or interface member de
 
claration
 
CS1519: Line 121: Invalid token 'for' in class, struct, or interface member
 
declaration
 
CS1519: Line 121: Invalid token '>=' in class, struct, or interface member d
 
eclaration
 
CS1519: Line 121: Invalid token ')' in class, struct, or interface member de
 
claration
 
CS1519: Line 125: Invalid token 'if' in class, struct, or interface member d
 
eclaration
 
CS1519: Line 125: Invalid token ')' in class, struct, or interface member de
 
claration
 
CS1519: Line 126: Invalid token '(' in class, struct, or interface member de
 
claration
 
CS1519: Line 126: Invalid token ')' in class, struct, or interface member de
 
claration
 
CS0116: Line 129: A namespace does not directly contain members such as fiel
 
ds or methods
 
CS1518: Line 130: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 135: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 140: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 145: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 150: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 163: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 179: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 184: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 195: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 204: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 249: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 255: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 256: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 257: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 258: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 260: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 262: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 264: Expected class, delegate, enum, interface, or struct
 
CS1518: Line 275: Expected class, delegate, enum, interface, or struct
 
CS1022: Line 278: Type or namespace definition, or end-of-file expected
 
Scripts: One or more scripts failed to compile or no script files were found.
 
- Press return to exit, or R to try again.

Go to Line 80 of your DemonKnight.cs and add a semicolon ( ; ) at the end of it. Then you're all set.
 
Code:
using System;
using System.Collections;
using Server;
using Server.Items;
using System.Collections.Generic;
 
namespace Server.Mobiles
{
    [CorpseName( "a demon knight corpse" )]
    public class DemonKnight : BaseCreature
    {
        public override bool IgnoreYoungProtection { get { return Core.ML; } }
 
        public static Type[] ArtifactRarity10 { get { return m_ArtifactRarity10; } }
        public static Type[] ArtifactRarity11 { get { return m_ArtifactRarity11; } }
        private static Type[] m_ArtifactRarity10 = new Type[]
            {
                typeof( LegacyOfTheDreadLord ),
                typeof( TheTaskmaster )
            };
 
        private static Type[] m_ArtifactRarity11 = new Type[]
            {
                typeof( TheDragonSlayer ),
                typeof( ArmorOfFortune ),
                typeof( GauntletsOfNobility ),
                typeof( HelmOfInsight ),
                typeof( HolyKnightsBreastplate ),
                typeof( JackalsCollar ),
                typeof( LeggingsOfBane ),
                typeof( MidnightBracers ),
                typeof( OrnateCrownOfTheHarrower ),
                typeof( ShadowDancerLeggings ),
                typeof( TunicOfFire ),
                typeof( VoiceOfTheFallenKing ),
                typeof( BraceletOfHealth ),
                typeof( OrnamentOfTheMagician ),
                typeof( RingOfTheElements ),
                typeof( RingOfTheVile ),
                typeof( Aegis ),
                typeof( ArcaneShield ),
                typeof( AxeOfTheHeavens ),
                typeof( BladeOfInsanity ),
                typeof( BoneCrusher ),
                typeof( BreathOfTheDead ),
                typeof( Frostbringer ),
                typeof( SerpentsFang ),
                typeof( StaffOfTheMagi ),
                typeof( TheBeserkersMaul ),
                typeof( TheDryadBow ),
                typeof( DivineCountenance ),
                typeof( HatOfTheMagi ),
                typeof( HuntersHeaddress ),
                typeof( SpiritOfTheTotem )
            };
 
        public static Item CreateRandomArtifact()
        {
            if ( !Core.AOS )
                return null;
 
            int count = ( m_ArtifactRarity10.Length * 5 ) + ( m_ArtifactRarity11.Length * 4 );
            int random = Utility.Random( count );
            Type type;
 
            if ( random < ( m_ArtifactRarity10.Length * 5 ) )
            {
                type = m_ArtifactRarity10[random / 5];
            }
            else
            {
                random -= m_ArtifactRarity10.Length * 5;
                type = m_ArtifactRarity11[random / 4];
            }
 
            return Loot.Construct( type );
        }
 
        public static Mobile FindRandomPlayer( BaseCreature creature )
        {
            List<DamageStore> rights = BaseCreature.GetLootingRights( creature.DamageEntries, creature.HitsMax );
 
            for ( int i = rights.Count - 1; i >= 0; --i )
            {
                DamageStore ds = rights[i];
 
                if ( !ds.m_HasRight )
                    rights.RemoveAt( i );
            }
 
            if ( rights.Count > 0 )
                return rights[Utility.Random( rights.Count )].m_Mobile;
 
            return null;
        }
 
        public static void DistributeArtifact( BaseCreature creature )
        {
            DistributeArtifact( creature, CreateRandomArtifact() );
        }
 
        public static void DistributeArtifact( BaseCreature creature, Item artifact )
        {
            DistributeArtifact( FindRandomPlayer( creature ), artifact );
        }
 
        public static void DistributeArtifact( Mobile to )
        {
            DistributeArtifact( to, CreateRandomArtifact() );
        }
 
        public static void DistributeArtifact( Mobile to, Item artifact )
        {
            if ( to == null || artifact == null )
                return;
 
            Container pack = to.Backpack;
 
            if ( pack == null || !pack.TryDropItem( to, artifact, false ) )
                to.BankBox.DropItem( artifact );
 
            to.SendLocalizedMessage( 1062317 ); // For your valor in combating the fallen beast, a special artifact has been bestowed on you.
        }
 
        public static int GetArtifactChance( Mobile boss )
        {
            if ( !Core.AOS )
                return 0;
 
            int luck = LootPack.GetLuckChanceForKiller( boss );
            int chance;
 
            if ( boss is DemonKnight )
                chance = 1500 + (luck / 5);
            else
                chance = 750 + (luck / 10);
 
            return chance;
        }
 
        public static bool CheckArtifactChance( Mobile boss )
        {
            return GetArtifactChance( boss ) > Utility.Random( 100000 );
        }
 
        public override WeaponAbility GetWeaponAbility()
        {
            switch ( Utility.Random( 3 ) )
            {
                default:
                case 0: return WeaponAbility.DoubleStrike;
                case 1: return WeaponAbility.WhirlwindAttack;
                case 2: return WeaponAbility.CrushingBlow;
            }
        }
 
        public override void OnDeath( Container c )
        {
            base.OnDeath( c );
 
            if ( !Summoned && !NoKillAwards && DemonKnight.CheckArtifactChance( this ) )
                DemonKnight.DistributeArtifact( this );
        }
 
        [Constructable]
        public DemonKnight() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
        {
            Name = NameList.RandomName( "demon knight" );
            Title = "the Dark Father";
            Body = 318;
            BaseSoundID = 0x165;
 
            SetStr( 500 );
            SetDex( 100 );
            SetInt( 1000 );
 
            SetHits( 30000 );
            SetMana( 5000 );
 
            SetDamage( 17, 21 );
 
            SetDamageType( ResistanceType.Physical, 20 );
            SetDamageType( ResistanceType.Fire, 20 );
            SetDamageType( ResistanceType.Cold, 20 );
            SetDamageType( ResistanceType.Poison, 20 );
            SetDamageType( ResistanceType.Energy, 20 );
 
            SetResistance( ResistanceType.Physical, 30 );
            SetResistance( ResistanceType.Fire, 30 );
            SetResistance( ResistanceType.Cold, 30 );
            SetResistance( ResistanceType.Poison, 30 );
            SetResistance( ResistanceType.Energy, 30 );
 
            SetSkill( SkillName.Necromancy, 120, 120.0 );
            SetSkill( SkillName.SpiritSpeak, 120.0, 120.0 );
 
            SetSkill( SkillName.DetectHidden, 80.0 );
            SetSkill( SkillName.EvalInt, 100.0 );
            SetSkill( SkillName.Magery, 100.0 );
            SetSkill( SkillName.Meditation, 120.0 );
            SetSkill( SkillName.MagicResist, 150.0 );
            SetSkill( SkillName.Tactics, 100.0 );
            SetSkill( SkillName.Wrestling, 120.0 );
 
            Fame = 28000;
            Karma = -28000;
 
            VirtualArmor = 64;
        }
 
        public override void GenerateLoot()
        {
            AddLoot( LootPack.SuperBoss, 2 );
            AddLoot( LootPack.HighScrolls, Utility.RandomMinMax( 6, 60 ) );
        }
 
        public override bool BardImmune{ get{ return !Core.SE; } }
        public override bool Unprovokable{ get{ return Core.SE; } }
        public override bool AreaPeaceImmune { get { return Core.SE; } }
        public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
 
        public override int TreasureMapLevel{ get{ return 1; } }
 
        private static bool m_InHere;
 
        public override void OnDamage( int amount, Mobile from, bool willKill )
        {
            if ( from != null && from != this && !m_InHere )
            {
                m_InHere = true;
                AOS.Damage( from, this, Utility.RandomMinMax( 8, 20 ), 100, 0, 0, 0, 0 );
 
                MovingEffect( from, 0xECA, 10, 0, false, false, 0, 0 );
                PlaySound( 0x491 );
 
                if ( 0.05 > Utility.RandomDouble() )
                    Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( CreateBones_Callback ), from );
 
                m_InHere = false;
            }
        }
 
        public virtual void CreateBones_Callback( object state )
        {
            Mobile from = (Mobile)state;
            Map map = from.Map;
 
            if ( map == null )
                return;
 
            int count = Utility.RandomMinMax( 1, 3 );
 
            for ( int i = 0; i < count; ++i )
            {
                int x = from.X + Utility.RandomMinMax( -1, 1 );
                int y = from.Y + Utility.RandomMinMax( -1, 1 );
                int z = from.Z;
 
                if ( !map.CanFit( x, y, z, 16, false, true ) )
                {
                    z = map.GetAverageZ( x, y );
 
                    if ( z == from.Z || !map.CanFit( x, y, z, 16, false, true ) )
                        continue;
                }
 
                UnholyBone bone = new UnholyBone();
 
                bone.Hue = 0;
                bone.Name = "unholy bones";
                bone.ItemID = Utility.Random( 0xECA, 9 );
 
                bone.MoveToWorld( new Point3D( x, y, z ), map );
            }
        }
 
        public DemonKnight( Serial serial ) : base( serial )
        {
        }
 
        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );
            writer.Write( (int) 0 );
        }
 
        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );
            int version = reader.ReadInt();
        }
    }
}
 

Iraq-

Sorceror
There you go:
I made all of the edits for you.
;)
Be sure to include the edits to the other Doom Bosses in Step#3 of the Installation at the top of the thread.
 

Attachments

  • DemonKnight with XmlDoomPoints.cs
    11.9 KB · Views: 47
Top