OP
Xeno
ServUO Version
Publish 57
Ultima Expansion
Time Of Legends
Are there any guides on how to code different fighting effects (spellcasting and melee) to mobs? I have tried VitaNex but it seems that it mostly does big area explosions and stuff and I am looking to add other types as well. Thank you in advance!
 
Last edited:
I think most mobs do area effect spells like earthquake and blizzard stuff for large scale fights against multple targets. Ill share my frost giant hes got a spell in his script shows you kinda I think what your looking for.

spell:
        public void Avalanche()
        {
            Map map = this.Map;

            if ( map == null )
                return;

            ArrayList targets = new ArrayList();

            foreach ( Mobile m in this.GetMobilesInRange( 8 ) )
            {
                if ( m == this || !CanBeHarmful( m ) )
                    continue;

                if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team) )
                    targets.Add( m );
                else if ( m.Player )
                    targets.Add( m );
            }

            PlaySound( 0x16 );

            for ( int i = 0; i < targets.Count; ++i )
            {
                Mobile m = (Mobile)targets[i];

                double damage = m.Hits * 0.6;

                if ( damage < 10.0 )
                    damage = 10.0;
                else if ( damage > 75.0 )
                    damage = 75.0;

                DoHarmful( m );
                m.Paralyze( TimeSpan.FromSeconds( Utility.RandomMinMax( 10, 20 ) ) );
                m.SendMessage("The frost giant's avalache begins to freeze you solid!");
                
                AOS.Damage( m, this, (int)damage, 0, 0, 100, 0, 0 );

                if ( m.Alive && m.Body.IsHuman && !m.Mounted )
                    m.Animate( 20, 7, 1, true, false, 0 ); // take hit
            }
        }
 

Attachments

  • FrostGiant.cs
    3.2 KB · Views: 6
Many shards have amazing spell and specials effects. Outlands is one that comes to mind almost immediately.
Luthius the coder for outlands is an Amazing coder and is very advanced and has totally rewriten the entire core of the server so he has done alot of things so his effects would be hard to replicate. But there are alot of spells and effects you can find on monsters like the one i posted on the frost giant as an example.
 
Let me ask this, suppose I want an ice elemental to launch snowballs or some kind of ice particles. Would that be an art animation I would load into the game or is it something I would just code? I am thinking it would have to be an animation added.
 
The snippet below is the same way to do snowball. This comes from a spitting cobra I made.

You could use a player animation to show a result that affects the player, see @Vert-I-Go post above:
"m.Animate( 20, 7, 1, true, false, 0 ); // take hit"

You can also add an effect layer, which will illustrate the snowballs effect on hit to break apart:
"m.FixedParticles(0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head);" (taken from mind blast spell)

Graphic
Hue

MovingEffect(m, 0x36E4, 1, 0, false, false, 2654, 0);

phys-fire-cold-pois-nrgy
AOS.Damage(m, Utility.RandomMinMax(10, 15), 0, 0, 0, 100, 0);


Venom Spit:
 #region Venom Spit
 private DateTime m_NextVenomSpit;

 public void BeginVenomSpit()
 {
     PlayerMobile m = Combatant as PlayerMobile;
     // Mobile m = Combatant;

     if (m == null || m.Deleted || !m.Alive || !Alive || m_NextVenomSpit > DateTime.Now || !CanBeHarmful(m))
         return;

     PlaySound(0x133);
     MovingEffect(m, 0x36E4, 1, 0, false, false, 2654, 0);

     TimeSpan delay = TimeSpan.FromSeconds(GetDistanceToSqrt(m) / 5.0);
     Timer.DelayCall<Mobile>(delay, EndVenomSpit, m);

     m_NextVenomSpit = DateTime.Now + TimeSpan.FromSeconds(5);
 }

 public void EndVenomSpit(Mobile m)
 {
     if (m == null || m.Deleted || !m.Alive || !Alive)
         return;

     if (0.5 >= Utility.RandomDouble())
     {
         m.ApplyPoison(this, Poison.Lethal);
     }
     else
         m.ApplyPoison(this, Poison.Deadly);

     AOS.Damage(m, Utility.RandomMinMax(10, 15), 0, 0, 0, 100, 0);
     m.Stam -= Utility.Random(35, 20);
     m.Mana -= Utility.Random(35, 20);
     m.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You have just been hit with snake venom; the acidic fluid burns your skin!");
 }
 #endregion

 public override void OnGotMeleeAttack(Mobile attacker)
 {

     if (attacker.Weapon is BaseRanged)

         BeginVenomSpit();

     base.OnGotMeleeAttack(attacker);
 }
 
Last edited:
The snippet below is the same way to do snowball. This comes from a spitting cobra I made.

You could use a player animation to show a result that affects the player, see @Vert-I-Go post above:
"m.Animate( 20, 7, 1, true, false, 0 ); // take hit"

You can also add an effect layer, which will illustrate the snowballs effect on hit to break apart:
"m.FixedParticles(0x374A, 10, 15, 5038, 1181, 2, EffectLayer.Head);" (taken from mind blast spell)

Graphic
Hue

MovingEffect(m, 0x36E4, 1, 0, false, false, 2654, 0);

phys-fire-cold-pois-nrgy
AOS.Damage(m, Utility.RandomMinMax(10, 15), 0, 0, 0, 100, 0);


Venom Spit:
 #region Venom Spit
 private DateTime m_NextVenomSpit;

 public void BeginVenomSpit()
 {
     PlayerMobile m = Combatant as PlayerMobile;
     // Mobile m = Combatant;

     if (m == null || m.Deleted || !m.Alive || !Alive || m_NextVenomSpit > DateTime.Now || !CanBeHarmful(m))
         return;

     PlaySound(0x133);
     MovingEffect(m, 0x36E4, 1, 0, false, false, 2654, 0);

     TimeSpan delay = TimeSpan.FromSeconds(GetDistanceToSqrt(m) / 5.0);
     Timer.DelayCall<Mobile>(delay, EndVenomSpit, m);

     m_NextVenomSpit = DateTime.Now + TimeSpan.FromSeconds(5);
 }

 public void EndVenomSpit(Mobile m)
 {
     if (m == null || m.Deleted || !m.Alive || !Alive)
         return;

     if (0.5 >= Utility.RandomDouble())
     {
         m.ApplyPoison(this, Poison.Lethal);
     }
     else
         m.ApplyPoison(this, Poison.Deadly);

     AOS.Damage(m, Utility.RandomMinMax(10, 15), 0, 0, 0, 100, 0);
     m.Stam -= Utility.Random(35, 20);
     m.Mana -= Utility.Random(35, 20);
     m.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You have just been hit with snake venom; the acidic fluid burns your skin!");
 }
 #endregion

 public override void OnGotMeleeAttack(Mobile attacker)
 {

     if (attacker.Weapon is BaseRanged)

         BeginVenomSpit();

     base.OnGotMeleeAttack(attacker);
 }

Thank you, especially for the color coding to make it easier to understand what is what. I used the graphic to find it in fiddler and hopefully can expand on this. Thank you!
 
Another easy way to do this is like nightmare with breath weapon but change the item id for the effect Like for my white dragons i changed the itemID to look like a white fireball I have in art file. Or like my Blue dragons shoot lightning bolts I just change the BreathEffectItemID and BreathEffectSound.

public override bool HasBreath{ get{ return true; } }
public override int BreathColdDamage{ get{ return 100; } }
public override int BreathEffectSound{ get{ return 0x650; } }
public override int BreathEffectItemID{ get{ return 0x5476; } }

You can also change the ItemID hue so lets says your using the fireball effect ID in art file you can change the hue of it to look green or purple or yellow or blue.
public override int BreathEffectHue{ get{ return 1372; } }
 
Last edited:
Back