firefox

Initiate
HELLO! i noticed that chainlightning hits the caster, how can i change that? i dont want caster to take damage.


Thanks!!!
 
Odd, I would think that Lines 68-69 in ChainLightning.cs would prevent the caster from taking damage.

if (id == null || (Core.AOS && id is Mobile && (Mobile)id == this.Caster))
continue;

Or are you playing pre-AOS?

Edit: Just loaded and tried shooting myself with CL, it does not hurt me.
 
Last edited:
Hello thanks for reply, i forgot to post the CL script, here it is:

i have the expansion set to None


Code:
using System;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Regions;
using Server.Guilds;
using Server.Mobiles;

namespace Server.Spells.Seventh
{
    public class ChainLightningSpell : MagerySpell
    {
        public override SpellCircle Circle { get { return SpellCircle.Seventh; } }
        public override int Sound { get { return 0x29; } }
       
        private static readonly SpellInfo m_Info = new SpellInfo(
                "Chain Lightning", "Vas Ort Grav",
                263,
                9022,
                true,
                Reagent.BlackPearl,
                Reagent.Bloodmoss,
                Reagent.MandrakeRoot,
                Reagent.SulfurousAsh
            );

        public ChainLightningSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
        {
        }

        public override double GetResistPercent( Mobile target )
        {
            return 10.0;
        }
       
        public override void OnCast()
        {
            if(Caster is PlayerMobile)
                Target( (IPoint3D)SphereSpellTarget );
            else
                Caster.Target = new InternalTarget( this );
        }

        public override bool DelayedDamage{ get{ return true; } }

       
        public void Target( IPoint3D p)
        {
            if ( !Caster.CanSee( p ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            
           
            else if ( /*SpellHelper.CheckTown( p, Caster ) && */CheckSequence() )
            {
                SpellHelper.Turn( Caster, p );
                

                if ( p is Item )
                    p = ((Item)p).GetWorldLocation();

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                bool playerVsPlayer = false;

                if ( map != null )
                {
                    IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 5 );

                    foreach ( Mobile m in eable )
                    {

                            targets.Add( m );

                            if ( m.Player )
                                playerVsPlayer = true;

                    }

                    eable.Free();
                }
               

                double damage;
                
                if ( Core.AOS )
                    damage = GetNewAosDamage( 48, 1, 5, Caster.Player && playerVsPlayer );
                else
                    damage = Utility.Random( 32, 35 );

                if ( targets.Count > 0 )
                {
                    if ( Core.AOS && targets.Count > 1 )
                        damage = (damage * 2) / targets.Count;
                    else if ( !Core.AOS )
                        damage /= targets.Count;

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

                        Region house = m.Region;

                        double toDeal = damage;

                    /*    if ( !Core.AOS && CheckResisted( m ) )
                        {
                            toDeal *= 0.5;

                      
                    m.SendAsciiMessage(93,"You resist the Spell");
                    damage = (int)(damage * 0.7);
                    }*/

                        if( !(house is Regions.HouseRegion) )
                        {
                            Caster.DoHarmful( m );
                                Guild guild = Caster.Guild as Guild;
if (guild != null && Caster is PlayerMobile)
{
    switch (Caster.Guild.Type)
    {
        case GuildType.Chaos: damage += 2; break;
        case GuildType.Order: damage += 2; break;
    }
}
                            SpellHelper.Damage( this, m, toDeal, 0, 0, 0, 0, 100 );

                            m.BoltEffect( 0 );
                        }

                    }
                }
            }

            FinishSequence();
        }
       

        private class InternalTarget : Target
        {
            private ChainLightningSpell m_Owner;

            public InternalTarget( ChainLightningSpell owner ) : base( 12, true, TargetFlags.Harmful )
            {
                m_Owner = owner;
            }

            protected override void OnTarget( Mobile from, object o )
            {
                IPoint3D p = o as IPoint3D;

                if ( p != null )
                    m_Owner.Target( p );
            }

            protected override void OnTargetFinish( Mobile from )
            {
                m_Owner.FinishSequence();
            }
        }
    }
}
 
Code:
using System;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Targeting;
using Server.Regions;
using Server.Guilds;
using Server.Mobiles;

namespace Server.Spells.Seventh
{
    public class ChainLightningSpell : MagerySpell
    {
        public override SpellCircle Circle { get { return SpellCircle.Seventh; } }
        public override int Sound { get { return 0x29; } }
    
        private static readonly SpellInfo m_Info = new SpellInfo(
                "Chain Lightning", "Vas Ort Grav",
                263,
                9022,
                true,
                Reagent.BlackPearl,
                Reagent.Bloodmoss,
                Reagent.MandrakeRoot,
                Reagent.SulfurousAsh
            );

        public ChainLightningSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
        {
        }

        public override double GetResistPercent( Mobile target )
        {
            return 10.0;
        }
    
        public override void OnCast()
        {
            if(Caster is PlayerMobile)
                Target( (IPoint3D)SphereSpellTarget );
            else
                Caster.Target = new InternalTarget( this );
        }

        public override bool DelayedDamage{ get{ return true; } }

    
        public void Target( IPoint3D p)
        {
            if ( !Caster.CanSee( p ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
         
        
            else if ( /*SpellHelper.CheckTown( p, Caster ) && */CheckSequence() )
            {
                SpellHelper.Turn( Caster, p );
             

                if ( p is Item )
                    p = ((Item)p).GetWorldLocation();

                ArrayList targets = new ArrayList();

                Map map = Caster.Map;

                bool playerVsPlayer = false;

                if ( map != null )
                {
                    IPooledEnumerable eable = map.GetMobilesInRange( new Point3D( p ), 5 );

                    foreach ( Mobile m in eable )
                    {

                            if (m == null || m == Caster)
                                continue;

                            targets.Add( m );

                            if ( m.Player )
                                playerVsPlayer = true;

                    }

                    eable.Free();
                }
            

                double damage;
             
                if ( Core.AOS )
                    damage = GetNewAosDamage( 48, 1, 5, Caster.Player && playerVsPlayer );
                else
                    damage = Utility.Random( 32, 35 );

                if ( targets.Count > 0 )
                {
                    if ( Core.AOS && targets.Count > 1 )
                        damage = (damage * 2) / targets.Count;
                    else if ( !Core.AOS )
                        damage /= targets.Count;

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

                        Region house = m.Region;

                        double toDeal = damage;

                    /*    if ( !Core.AOS && CheckResisted( m ) )
                        {
                            toDeal *= 0.5;

                   
                    m.SendAsciiMessage(93,"You resist the Spell");
                    damage = (int)(damage * 0.7);
                    }*/

                        if( !(house is Regions.HouseRegion) )
                        {
                            Caster.DoHarmful( m );
                                Guild guild = Caster.Guild as Guild;
if (guild != null && Caster is PlayerMobile)
{
    switch (Caster.Guild.Type)
    {
        case GuildType.Chaos: damage += 2; break;
        case GuildType.Order: damage += 2; break;
    }
}
                            SpellHelper.Damage( this, m, toDeal, 0, 0, 0, 0, 100 );

                            m.BoltEffect( 0 );
                        }

                    }
                }
            }

            FinishSequence();
        }
    

        private class InternalTarget : Target
        {
            private ChainLightningSpell m_Owner;

            public InternalTarget( ChainLightningSpell owner ) : base( 12, true, TargetFlags.Harmful )
            {
                m_Owner = owner;
            }

            protected override void OnTarget( Mobile from, object o )
            {
                IPoint3D p = o as IPoint3D;

                if ( p != null )
                    m_Owner.Target( p );
            }

            protected override void OnTargetFinish( Mobile from )
            {
                m_Owner.FinishSequence();
            }
        }
    }
}
 
+ Spells/Seventh/ChainLightning.cs:
CS0103: Line 78: The name 'id' does not exist in the current context
CS0103: Line 78: The name 'id' does not exist in the current context
CS0103: Line 78: The name 'id' does not exist in the current context

should i change ''id'' to ''m'' ?
 
+ Spells/Seventh/ChainLightning.cs:
CS0103: Line 78: The name 'id' does not exist in the current context
CS0103: Line 78: The name 'id' does not exist in the current context
CS0103: Line 78: The name 'id' does not exist in the current context

Heh, I'd just got done editing the fix for that when you posted :p

Actually, hold on a sec, there are a couple more things that can be simplified since you're not using IDamageable.
 
Haha, it works now but player can ''spam'' Chainlightning if theres no mobiles around It doesnt even take mana or anything.

cl.png
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back