1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

adding special effects that cause dmg. how to implement?

Discussion in 'Script Support' started by Jezika, Jun 4, 2014.

  1. Jezika
    Offline

    Jezika Member

    Joined:
    Jun 2, 2014
    Messages:
    36
    Likes Received:
    5
    Ok, I have a script for a powerful boss type dragon. it is a variation of another script i found on the boards. its been tweaked and rearranged to suit the needs of my playerbase (ie. my family). I searched on Vorspires website to see how to do it but i am not exactly sure as to where i would place the new info and if it would be correct.

    What I would like it to do is an area dmg effect like an aura or even when the dragon uses a magic attack it could trigger. on the H.S. exp, Charybdiss is being used to show how his special fx package can cause dmg using a water wave from how i am reading it, the wave is an attack. id like to do similar but have been unable to with my old set up (which is now long gone) but with fire, energy or poison. which are attacks on the special dragons.

    I have attached a copy of 1 of the dragons, if you need the loot page or the other 2 dragons as well, i can provide them. again I am not the original scripter for the dragons but I have altered them to suit our needs.

    Here is a copy of what Vorpsire stated on his forum which is making me think I should be able to create what i am looking to do. if not possible thats ok as well.

    [quote author=Vorspire link=topic=35.msg83#msg83 date=1384758811]
    No, he's part of High Seas, the video was taken on Pandora to demonstrate how the effects can be used, you can do it by using the WaterWaveEffect and giving it an EffectHandler that handles each point the effect processes, to find and damage mobiles, boats, etc.

    Something like this, for example:
    Code (C#):
    1.  
    2. new WaterWaveEffect( source, map, direction, range,
    3.   effectHandler: e =>
    4.   {
    5.   e.Source.GetMobilesInRange( e.Map, 0 ).ForEach( m => m.Damage( 100 ) );
    6.   }
    7. ).Send();
    8.  
    [/quote]

    I know the stats on the dragon. this is not for a normal dungeon and he waits in a guarded dungeon with ample warnings. btw, hes fun to kill :D
     

    Attached Files:

    #1 Jezika, Jun 4, 2014
    Last edited: Jun 4, 2014
  2. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    This can be done very easily with XMLSpawner, but if you'd like to have it in the script consider this code that Peoharen wrote for The Six:
    Code (C#):
    1.  
    2.         public static void FlameWave(Mobile from)
    3.         {
    4.             if (!CanUse(from))
    5.                 return;
    6.  
    7.             from.Say("*Vas Grav Consume !*");
    8.  
    9.             new FlameWaveTimer(from).Start();
    10.         }
    11.  
    12.         internal class FlameWaveTimer : Timer
    13.         {
    14.             private Mobile m_From;
    15.             private Point3D m_StartingLocation;
    16.             private Map m_Map;
    17.             private int m_Count;
    18.             private Point3D m_Point;
    19.  
    20.             public FlameWaveTimer(Mobile from)
    21.                 : base(TimeSpan.FromMilliseconds(300.0), TimeSpan.FromMilliseconds(300.0))
    22.             {
    23.                 m_From = from;
    24.                 m_StartingLocation = from.Location;
    25.                 m_Map = from.Map;
    26.                 m_Count = 0;
    27.                 m_Point = new Point3D();
    28.                 SetupDamage(from);
    29.             }
    30.  
    31.             protected override void OnTick()
    32.             {
    33.                 if (m_From == null || m_From.Deleted)
    34.                 {
    35.                     Stop();
    36.                     return;
    37.                 }  
    38.  
    39.                 double dist = 0.0;
    40.  
    41.                 for (int i = -m_Count; i < m_Count + 1; i++)
    42.                 {
    43.                     for (int j = -m_Count; j < m_Count + 1; j++)
    44.                     {
    45.                         m_Point.X = m_StartingLocation.X + i;
    46.                         m_Point.Y = m_StartingLocation.Y + j;
    47.                         m_Point.Z = m_Map.GetAverageZ(m_Point.X, m_Point.Y);
    48.                         dist = GetDist(m_StartingLocation, m_Point);
    49.                         if (dist < ((double)m_Count + 0.1) && dist > ((double)m_Count - 3.1))
    50.                         {
    51.                             Effects.SendLocationParticles(EffectItem.Create(m_Point, m_Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
    52.                         }
    53.                     }
    54.                 }
    55.  
    56.                 m_Count += 3;
    57.  
    58.                 if (m_Count > 15)
    59.                     Stop();
    60.             }
    61.  
    62.             private void SetupDamage(Mobile from)
    63.             {
    64.                 foreach (Mobile m in from.GetMobilesInRange(10))
    65.                 {
    66.                     if (CanTarget(from, m, true, false, false))
    67.                     {
    68.                         Timer.DelayCall(TimeSpan.FromMilliseconds(300 * (GetDist(m_StartingLocation, m.Location) / 3)), new TimerStateCallback(Hurt), m);
    69.                     }
    70.                 }
    71.             }
    72.  
    73.             public void Hurt(object o)
    74.             {
    75.                 Mobile m = o as Mobile;
    76.  
    77.                 if (m_From == null || m == null || m.Deleted)
    78.                     return;
    79.  
    80.                 int damage = m_From.Hits / 4;
    81.  
    82.                 if (damage > 200)
    83.                     damage = 400;  
    84.  
    85.                 AOS.Damage(m, m_From, damage, 0, 100, 0, 0, 0);
    86.                 m.SendMessage("You are being burnt alive by the seering heat!");
    87.             }
    88.             private double GetDist(Point3D start, Point3D end)
    89.             {
    90.                 int xdiff = start.X - end.X;
    91.                 int ydiff = start.Y - end.Y;
    92.                 return Math.Sqrt((xdiff * xdiff) + (ydiff * ydiff));
    93.             }
    94.         }
    That is the defined method for the effect with damage. Calling it is as easy as adding:
    Code (C#):
    1.  
    2.         public override void OnActionCombat()
    3.         {
    4.             if ( DateTime.Now > m_Delay )
    5.             {
    6.                 if ( Utility.Random( 12 ) <= 8  )
    7.                 {
    8.                     Ability.FlameWave( this );
    9.                     m_Delay = DateTime.Now + TimeSpan.FromSeconds( Utility.RandomMinMax( 30, 45 ) );
    10.                 }
    11.  
    12.             }          
    13.  
    14.             base.OnActionCombat();
    15.         }
    16.  
    Add the above code to the main constructable for the mob and you're ready to go.
     
    • Helpful Helpful x 2
    • Two Thumbs Up Two Thumbs Up x 1
  3. Jezika
    Offline

    Jezika Member

    Joined:
    Jun 2, 2014
    Messages:
    36
    Likes Received:
    5
    tass23, That is Exactly what i was looking for. Thank you!
    :D
     
    • Like Like x 1
  4. Sirenix
    Offline

    Sirenix Member

    Joined:
    Apr 16, 2014
    Messages:
    75
    Likes Received:
    5
    I used the above code in a script im working on for a spell but I cant seem to figure out how to change the hue of the flames. I tried this and it didn't seem to effect anything:

    Effects.SendLocationParticles(EffectItem.Create(m_Point, m_Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052, 1154);

    I also tried:

    Effects.SendLocationParticles(EffectItem.Create(m_Point, m_Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 1154);

    I know that the 0x3709 is the itemid for the effect it self, and im assuming the 10 is the duration, but what is the 30 and the 5052?
     
  5. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    If I remember correctly your code is explained like this:
    Effects.SendLocationParticles(EffectItem.Create(m_Point, m_Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052, 1154);

    0x3709 (AnimID)
    10 (Duration)
    30(Tile Area around target)
    5052 (SoundID)
    1154 (Hue of the effect)

    That's pretty close anyway. If you have the Ultimate Hider ball for staff, you can use that to see the effects, sounds and duration.
     
  6. Sirenix
    Offline

    Sirenix Member

    Joined:
    Apr 16, 2014
    Messages:
    75
    Likes Received:
    5
    I had Ultimate hider at one time but I couldn't remember what it was called to find it again lol. Putting that 1154 on the end of the code like that didn't change the hue like I thought it would though.
     
  7. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    Yeah, you can't just stick it in anywhere. You have to look at how the effect you're using is defined and have each attribute in the right place. If you look in your Server folder, you'll find the Effects.cs. Open that file and look at how each SendParticles method is defined. Here's an example:
    Code (C#):
    1. public static void SendLocationParticles( IEntity e, int itemID, int speed, int duration, int hue, int renderMode, int effect, int unknown )
    Basically skip to the itemID, then Speed, Duration, Hue, renderMode, effect and unknown. What's important is to use the right SendParticles method for your effect. If you don't known what the unknown is, just use a 0. In most cases a 0 there is fine.
    Code (C#):
    1. public static void SendLocationParticles( IEntity e, int itemID, int speed, int duration, int effect )
    See this SendParticles doesn't have everything the one above it does. Since Hue isn't listed, you can't add it in any old spot. You have to pick one that lists hue and set it up exactly as the base method says.
     
  8. Sirenix
    Offline

    Sirenix Member

    Joined:
    Apr 16, 2014
    Messages:
    75
    Likes Received:
    5
    lol this harder then I thought it would be for a simple hue change. I was looking at the sleep field spell how it changes the hue of the standard fire field, but that uses a internal item in a much different method then the flamewave.

    By the way where is that flamewave scrpt located in the folders? I tried searching for flamewave.cs and couldnt find it.
     
  9. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    The flamewave was part of the code Peoharen wrote for The Six and the Stygian Dragon. I believe in most current server releases its called "Ability The Six.cs". If you have Agent Ransack you can find it quickly.

    Not all effect spells are written the same way. The ones that use an internal item are a pain to deal with. You're almost better off using someone else's custom sleep spell, like from Lucid Nagal's ACC spells, and changing that the way you want it. But even then, some spells just HAVE to use an internal item.
     
  10. Sirenix
    Offline

    Sirenix Member

    Joined:
    Apr 16, 2014
    Messages:
    75
    Likes Received:
    5
    Ah that explains why I couldnt find it.

    I actually have a good allspells system I been with that project from the beginning and actually created the ranger spells under my RunUO username MetallicSomber. There kinda primitive now looking back on them lol. Im out of practice now and get stumped with the simplest stupid things sometimes now. I just cant seem to find a good moving particles effect that can change hue colors.
     
  11. tass23
    Offline

    Moderator

    Joined:
    Aug 28, 2013
    Messages:
    1,014
    Likes Received:
    131
    Best way to do it is with the Ultimate Hider. I've no idea if this is even going to work with the current RunUO/ServUO releases, but here it is. I've no clue who originally scripted it, but I haven't made any changes to it.
     

    Attached Files:

    • Thanks! Thanks! x 1
    • Two Thumbs Up Two Thumbs Up x 1
  12. Sirenix
    Offline

    Sirenix Member

    Joined:
    Apr 16, 2014
    Messages:
    75
    Likes Received:
    5
    Hey that worked! (ultimate hider compiled too im in shock considering how old it is!) thanks on both accounts!

    Effects.SendLocationParticles( EffectItem.Create( m_Point, m_Map, EffectItem.DefaultDuration ), 0x3709, 10, 30, 1154, 0, 0, 0 );
    It ended up being dark green but thats cause of hue offset I take it easy fix.
     
    • Like Like x 1
  13. Omni
    Offline

    Omni Member

    Joined:
    Dec 22, 2013
    Messages:
    165
    Likes Received:
    24
    Here is something you might find usefull..

    This is a system that allows you to add a bunch of special features to mobiles without a great deal of work..

    Drop basespecialcreature.cs into your custom files..

    Then to add special abilities to mobiles you need to do a few minor edits to there scripts..

    Code (C#):
    1. public class Dragon : [color=green]BaseSpecialCreature[/color]
    Code (C#):
    1. [color=green]public override bool DoesMultiFirebreathing { get { return true; } }[/color]
    Code (C#):
    1. [color=green]public override double MultiFirebreathingChance { get { return 0.4; } }[/color]
    Code (C#):
    1. [color=green]public override int BreathDamagePercent { get { return 80; } }[/color]
    Code (C#):
    1. [color=green]public override int BreathMaxTargets { get { return 5; } }[/color]
    Code (C#):
    1. [color=green]public override int BreathMaxRange { get { return 5; } }[/color]
    Example

    Code (C#):
    1. using System;
    2. using Server;
    3. using Server.Items;
    4.  
    5. namespace Server.Mobiles
    6. {
    7.     [CorpseName( "a dragon corpse" )]
    8.     public class Dragon : [color=green]BaseSpecialCreature[/color]
    9.     {[color=green]
    10.             public override bool DoesMultiFirebreathing { get { return true; } }
    11.             public override double MultiFirebreathingChance { get { return 0.4; } }
    12.             public override int BreathDamagePercent { get { return 80; } }
    13.             public override int BreathMaxTargets { get { return 5; } }
    14.             public override int BreathMaxRange { get { return 5; } }
    15. [/color]
    16.         [Constructable]
    17.         public Dragon () : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
    18.         {
    19.             Name = "a dragon";
    20.             Body = Utility.RandomList( 12, 59 );
    21.             BaseSoundID = 362;
    22.  
    23.             SetStr( 796, 825 );
    24.             SetDex( 86, 105 );
    25.             SetInt( 436, 475 );
    26.  
    27.             SetHits( 478, 495 );
    28.  
    29.             SetDamage( 16, 22 );
    30.  
    31.             SetDamageType( ResistanceType.Physical, 100 );
    32.  
    33.             SetResistance( ResistanceType.Physical, 55, 65 );
    34.             SetResistance( ResistanceType.Fire, 60, 70 );
    35.             SetResistance( ResistanceType.Cold, 30, 40 );
    36.             SetResistance( ResistanceType.Poison, 25, 35 );
    37.             SetResistance( ResistanceType.Energy, 35, 45 );
    38.  
    39.             SetSkill( SkillName.EvalInt, 30.1, 40.0 );
    40.             SetSkill( SkillName.Magery, 30.1, 40.0 );
    41.             SetSkill( SkillName.MagicResist, 99.1, 100.0 );
    42.             SetSkill( SkillName.Tactics, 97.6, 100.0 );
    43.             SetSkill( SkillName.Wrestling, 90.1, 92.5 );
    44.  
    45.             Fame = 15000;
    46.             Karma = -15000;
    47.  
    48.             VirtualArmor = 60;
    49.  
    50.             Tamable = true;
    51.             ControlSlots = 3;
    52.             MinTameSkill = 93.9;
    53.         }
    54.  
    55.         public override void GenerateLoot()
    56.         {
    57.             AddLoot( LootPack.FilthyRich, 2 );
    58.             AddLoot( LootPack.Gems, 8 );
    59.         }
    60.  
    61.         public override bool ReacquireOnMovement{ get{ return !Controlled; } }
    62.         [color=green]//[/color]public override bool HasBreath{ get{ return true; } } // fire breath enabled
    63.         public override bool AutoDispel{ get{ return !Controlled; } }
    64.         public override int TreasureMapLevel{ get{ return 4; } }
    65.         public override int Meat{ get{ return 19; } }
    66.         public override int Hides{ get{ return 20; } }
    67.         public override HideType HideType{ get{ return HideType.Barbed; } }
    68.         public override int Scales{ get{ return 7; } }
    69.         public override ScaleType ScaleType{ get{ return ( Body == 12 ? ScaleType.Yellow : ScaleType.Red ); } }
    70.         public override FoodType FavoriteFood{ get{ return FoodType.Meat; } }
    71.         public override bool CanAngerOnTame { get { return true; } }
    72.  
    73.         public Dragon( Serial serial ) : base( serial )
    74.         {
    75.         }
    76.  
    77.         public override void Serialize( GenericWriter writer )
    78.         {
    79.             base.Serialize( writer );
    80.             writer.Write( (int) 0 );
    81.         }
    82.  
    83.         public override void Deserialize( GenericReader reader )
    84.         {
    85.             base.Deserialize( reader );
    86.             int version = reader.ReadInt();
    87.         }
    88.     }
    89. }
     

    Attached Files:

    • Winner Winner x 2
  14. Milva
    Offline

    Admin Moderator

    Joined:
    Mar 3, 2013
    Messages:
    3,604
    Likes Received:
    396
    Omni this would be nice to have in Custom Releases also :) (UO Archive)
    Edit: Scratch that I see you just posted this thanks!
     
  15. Omni
    Offline

    Omni Member

    Joined:
    Dec 22, 2013
    Messages:
    165
    Likes Received:
    24
    Already ahead of you Milva ;)
     
    • Two Thumbs Up Two Thumbs Up x 1
  16. Milva
    Offline

    Admin Moderator

    Joined:
    Mar 3, 2013
    Messages:
    3,604
    Likes Received:
    396
    Thanks!! :)
     
Similar Threads: adding special
Forum Title Date
Script Support Adding Addon Items and Mobs to XMLSpawner Oct 30, 2017
Script Support Help with creating and adding other crafting PS's Oct 16, 2017
Script Support Adding a rank ladder to ConPvP Oct 2, 2017
Script Support Adding checks to notoriety Sep 24, 2017
Script Support Adding a spawner to a mobile script Sep 13, 2017
Script Support XmlSpawner. Adding new arguments for LOOTPACK Sep 4, 2017
Script Support Adding in a race check for loot in BaseCreature Aug 31, 2017