ServUO Version
Publish 58
Ultima Expansion
Third Dawn
Trying to make it when this Mob hits x HP it will spawn lets say zombies. so for example when HP hits 80 spawn 4 zombies and so on maybe 3 other spawns.
I looked at the Champions to see if i could get an idea but lets face it, i didn't lol. any help will be wonderfool.


thought this would help get me started but again was wrong:
                   AddLoot(LootPack.Rich, 3);
                   AddLoot(LootPack.HighScrolls, 3);
        // drop rare item at a % of a chance

                  }

              public override void OnDamage(int amount, Mobile from, bool willKill)
                        {
                            if (Utility.RandomDouble() < 0.1)
                                Dropzombie();

                              base.OnDamage(amount, from, willKill);
                           }



           public override void Serialize(GenericWriter writer)
               {
                   base.Serialize(writer);
                   writer.Write(0);
               }
 
You want it to spawn 4 zombies whenever the mob have 80% hp? check SIlvani (the champion) she spawn pixies on meleehit, this is a modified version (untested) it should spawn 2 to 4 zombies at 80% hp ,10% chance

//add this
C#:
double remainingHPPercentage = (double)Hits / HitsMax;

//add this
C#:
public override void OnGotMeleeAttack( Mobile attacker )
        {
            base.OnGotMeleeAttack( attacker );

            if ( 0.1 >= Utility.RandomDouble() && remainingHPPercentage <= 0.8 ) //10% spawn zombies at 80%
                SpawnZombies( attacker );
        }

//add this
C#:
public void SpawnZombies( Mobile target )
        {
            Map map = Map;

            if ( map == null )
                return;

            int newPixies = Utility.RandomMinMax( 2, 4 );

            for ( int i = 0; i < newPixies; ++i )
            {
                Zombie pixie = new Zombie();

                pixie.Team = Team;
                pixie.FightMode = FightMode.Closest;

                bool validLocation = false;
                Point3D loc = Location;

                for ( int j = 0; !validLocation && j < 10; ++j )
                {
                    int x = X + Utility.Random( 3 ) - 1;
                    int y = Y + Utility.Random( 3 ) - 1;
                    int z = map.GetAverageZ( x, y );

                    if ( validLocation = map.CanFit( x, y, Z, 16, false, false ) )
                        loc = new Point3D( x, y, Z );
                    else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )
                        loc = new Point3D( x, y, z );
                }

                pixie.MoveToWorld( loc, map );
                pixie.Combatant = target;
            }
        }
 
add above here are my errors


Error Log:
Errors:
 + Custom/Cult of/Minaxx.cs:
    CS0236: Line 80: A field initializer cannot reference the non-static field, method, or property 'Mobile.Hits'
    CS0236: Line 80: A field initializer cannot reference the non-static field, method, or property 'BaseCreature.HitsMax'
    CS0118: Line 101: 'Zombie' is a type but is used like a variable
    CS0103: Line 103: The name 'zombie' does not exist in the current context
    CS0103: Line 104: The name 'zombie' does not exist in the current context
    CS0103: Line 121: The name 'zombie' does not exist in the current context
    CS0103: Line 122: The name 'zombie' does not exist in the current context
Scripts: One or more scripts failed to compile or no script files were found.
here is the whole script


script:
lang="csharp" title="the whole thing"]using System;

using Server.Engines.CannedEvil;

using Server.Items;

using Server.Network;



namespace Server.Mobiles

{

    [CorpseName("corpse of Minaxx")]

     public class Minaxx : BaseCreature

    {



      FlameStrikeAoe fsa = new FlameStrikeAoe();

      FlameStrikeTargeted fst = new FlameStrikeTargeted();

      ToxicSpores ts = new ToxicSpores();

      CustomAbilityList list;





        [Constructable]

        public Minaxx()

            : base(AIType.AI_NecroMage, FightMode.Closest, 10, 1, 0.2, 0.4)

         {

      

                 Name = "Minax";

                 Body = 606;

                 BaseSoundID = 0x482;

             Hue = 33770;// fix

         Item hair = new Item(Utility.RandomList(0x2FC2, 0x2FC2));

                 hair.Hue = 2167;

         hair.Layer = Layer.Hair;

                 hair.Movable = false;

                 AddItem(hair);



      

        SetWearable(new FemaleStuddedChest(),2167 );



                 SetStr(80);

                 SetDex(80);

                 SetInt(80);



                 SetHits(100, 110);



                 SetDamage(8, 10);



                 SetDamageType(ResistanceType.Physical, 10);

                 SetDamageType(ResistanceType.Cold, 20);

                 SetDamageType(ResistanceType.Poison, 70);



                 SetResistance(ResistanceType.Physical, 66);

                 SetResistance(ResistanceType.Fire, 20);

                 SetResistance(ResistanceType.Cold, 45);

                 SetResistance(ResistanceType.Poison, 80);

                 SetResistance(ResistanceType.Energy, 45);



                 SetSkill(SkillName.Necromancy, 100.0, 120.0);

                 SetSkill(SkillName.SpiritSpeak, 100.0, 120.0);

                 SetSkill(SkillName.Anatomy, 0.0, 10.0);

                 SetSkill(SkillName.EvalInt, 100.0, 120.0);

                 SetSkill(SkillName.Magery, 100.0, 120.0);

                 SetSkill(SkillName.Meditation, 100.0, 110.0);

                 SetSkill(SkillName.MagicResist, 120.0, 150.0);

                 SetSkill(SkillName.Tactics, 70.0, 80.0);

                 SetSkill(SkillName.Wrestling, 90.0, 100.0);



                 Fame = 4000;

                 Karma = -4000;



                 SetWeaponAbility(WeaponAbility.InfectiousStrike);

                 SetSpecialAbility(SpecialAbility.LifeDrain);



             PackReg(6, 8);





         }



             public override bool ShowFameTitle => false;

             public override bool ClickTitle => false;

             public override bool PropertyTitle => false;

         public override bool AlwaysAttackable => true;



    double remainingHPPercentage = (double)Hits / HitsMax; // just added



        public override void OnGotMeleeAttack( Mobile attacker )

        {

            base.OnGotMeleeAttack( attacker );



            if ( 0.1 >= Utility.RandomDouble() && remainingHPPercentage <= 0.8 ) //10% spawn zombies at 80%

                SpawnZombies( attacker );

        }



public void SpawnZombies( Mobile target )

        {

            Map map = Map;



            if ( map == null )

                return;



            int newPixies = Utility.RandomMinMax( 2, 4 );



            for ( int i = 0; i < newPixies; ++i )

            {

                Zombie pixie = new Zombie();



                pixie.Team = Team;

                pixie.FightMode = FightMode.Closest;



                bool validLocation = false;

                Point3D loc = Location;



                for ( int j = 0; !validLocation && j < 10; ++j )

                {

                    int x = X + Utility.Random( 3 ) - 1;

                    int y = Y + Utility.Random( 3 ) - 1;

                    int z = map.GetAverageZ( x, y );



                    if ( validLocation = map.CanFit( x, y, Z, 16, false, false ) )

                        loc = new Point3D( x, y, Z );

                    else if ( validLocation = map.CanFit( x, y, z, 16, false, false ) )

                        loc = new Point3D( x, y, z );

                }



                pixie.MoveToWorld( loc, map );

                pixie.Combatant = target;

            }

        }





             public Minaxx(Serial serial)

             : base(serial)

        {

        }



            public override bool BleedImmune => true;

                public override Poison PoisonImmune => Poison.Lethal;

                public override Poison HitPoison => Poison.Lethal;



               public override void GenerateLoot()

               {

                   AddLoot(LootPack.Rich, 3);

                   AddLoot(LootPack.HighScrolls, 3);

        // drop rare item at a % of a chance



                  }











           public override void Serialize(GenericWriter writer)

               {

                   base.Serialize(writer);

                   writer.Write(0);

               }



               public override void Deserialize(GenericReader reader)

               {

                  base.Deserialize(reader);

                  int version = reader.ReadInt();

               }

    }

}
 
Last edited:
Back