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!

holy water script

Packer898

Knight
You are missing a closing brace from the end of the file. You really should be using SharpDevelop to code in. It would save you a ton of errors and lost time.


p.s. It doesnt look right to me. Maybe just change the alchemyBonus to vampireBonus and add the check for RaceType. No need to add a new method when you could alter what is already there.

p.s.s. LOL Hell if the damage is going to be constant and not a % from another skill then just add a damage modifier after the race check. damage += 10: etc...
 

Packer898

Knight
I threw this together real fast so I'm not sure if it will work or not but I edited the Explode method. I "think" this would work. I really dont see a reason why it would need anything more complex. But I have been known to be wrong before. =)-

Code:
		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;
			
			Delete();
			
			for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;
				
				if ( targ != null && targ.Potion == this )
					Target.Cancel( m );
			}
			
			if ( map == null )
				return;
			
			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );
			
			int alchemyBonus = 0;
			int vampireBonus = 10;
			
			if ( direct )
				alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
			
			IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
			ArrayList toExplode = new ArrayList();
			
			int toDamage = 0;
			
			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
			}
			
			eable.Free();
			
			int min = Scale( from, MinDamage );
			int max = Scale( from, MaxDamage );
			
			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o = toExplode[i];
				
				if ( o is Mobile )
				{
					Mobile m = (Mobile)o;
					
					if ( m.RaceType == RaceType.LesserVampire )
					{
						int damage = Utility.RandomMinMax( min, max );
						
						damage += vampireBonus;
						
						if ( !Core.AOS && damage > 40 )
							damage = 40;
						else if ( Core.AOS && toDamage > 2 )
							damage /= toDamage - 1;
						
						AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
					}
					
					if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
					{
						if ( from != null )
							from.DoHarmful( m );
						
						int damage = Utility.RandomMinMax( min, max );
						
						damage += alchemyBonus;
						
						if ( !Core.AOS && damage > 40 )
							damage = 40;
						else if ( Core.AOS && toDamage > 2 )
							damage /= toDamage - 1;
						
						AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
					}
				}
			}

Edit - I didnt include the alchemy bonus either. Might want to add that in their if your wanting to keep it. lol like I said was just a quick throw together.
 

devil6

Wanderer
ok, not understanding this at all. as you can see here i have } on line 296....lol, and by the way thanks for the help


PHP:
Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
 - Error: Scripts\Custom\BaseHolyWater.cs: CS1513: (line 296, column 2) } expect
ed
 - Error: Scripts\Custom\BaseHolyWater.cs: CS1513: (line 296, column 2) } expect
ed
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.


PHP:
using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Spells;

namespace Server.Items
{
	public abstract class BaseHolyWater : BasePotion
	{
		public abstract int MinDamage { get; }
		public abstract int MaxDamage { get; }

		public override bool RequireFreeHand{ get{ return false; } }

		private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
		private static bool InstantExplosion = false; // Should explosion potions explode on impact?
		private const int   ExplosionRange   = 2;     // How long is the blast radius?

		public BaseHolyWater( PotionEffect effect ) : base( 0xF0D, effect )
		{
		}

		public BaseHolyWater( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}

		public virtual object FindParent( Mobile from )
		{
			Mobile m = this.HeldBy;

			if ( m != null && m.Holding == this )
				return m;

			object obj = this.RootParent;

			if ( obj != null )
				return obj;

			if ( Map == Map.Internal )
				return from;

			return this;
		}

		private Timer m_Timer;

		private ArrayList m_Users;

		public override void Drink( Mobile from )
		{
			if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
			{
				from.SendLocalizedMessage( 1062725 ); // You can not use a purple potion while paralyzed.
				return;
			}

			ThrowTarget targ = from.Target as ThrowTarget;

			if ( targ != null && targ.Potion == this )
				return;

			from.RevealingAction();

			if ( m_Users == null )
				m_Users = new ArrayList();

			if ( !m_Users.Contains( from ) )
				m_Users.Add( from );

			from.Target = new ThrowTarget( this );

			if ( m_Timer == null )
			{
				from.SendLocalizedMessage( 500236 ); // You should throw it now!
				m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } );
			}
		}

		private void Detonate_OnTick( object state )
		{
			if ( Deleted )
				return;

			object[] states = (object[])state;
			Mobile from = (Mobile)states[0];
			int timer = (int)states[1];

			object parent = FindParent( from );

			if ( timer == 0 )
			{
				Point3D loc;
				Map map;

				if ( parent is Item )
				{
					Item item = (Item)parent;

					loc = item.GetWorldLocation();
					map = item.Map;
				}
				else if ( parent is Mobile )
				{
					Mobile m = (Mobile)parent;

					loc = m.Location;
					map = m.Map;
				}
				else
				{
					return;
				}

				Explode( from, true, loc, map );
			}
			else
			{
				if ( parent is Item )
					((Item)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
				else if ( parent is Mobile )
					((Mobile)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );

				states[1] = timer - 1;
			}
		}

		private void Reposition_OnTick( object state )
		{
			if ( Deleted )
				return;

			object[] states = (object[])state;
			Mobile from = (Mobile)states[0];
			IPoint3D p = (IPoint3D)states[1];
			Map map = (Map)states[2];

			Point3D loc = new Point3D( p );

			if ( InstantExplosion )
				Explode( from, true, loc, map );
			else
				MoveToWorld( loc, map );
		}

		private class ThrowTarget : Target
		{
			private BaseHolyWater m_Potion;

			public BaseHolyWater Potion
			{
				get{ return m_Potion; }
			}

			public ThrowTarget( BaseHolyWater potion ) : base( 12, true, TargetFlags.None )
			{
				m_Potion = potion;
			}

			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
					return;

				IPoint3D p = targeted as IPoint3D;

				if ( p == null )
					return;

				Map map = from.Map;

				if ( map == null )
					return;

				SpellHelper.GetSurfaceTop( ref p );

				from.RevealingAction();

				IEntity to;

				if ( p is Mobile )
					to = (Mobile)p;
				else
					to = new Entity( Serial.Zero, new Point3D( p ), map );

				Effects.SendMovingEffect( from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0 );

				m_Potion.Internalize();
				Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Reposition_OnTick ), new object[]{ from, p, map } );
			}
		}

		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;
			
			Delete();
			
			for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;
				
				if ( targ != null && targ.Potion == this )
					Target.Cancel( m );
			}
			
			if ( map == null )
				return;
			
			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );
			
			int alchemyBonus = 0;
			int vampireBonus = 10;
			
			if ( direct )
				alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
			
			IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
			ArrayList toExplode = new ArrayList();
			
			int toDamage = 0;
			
			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
			}
			
			eable.Free();
			
			int min = Scale( from, MinDamage );
			int max = Scale( from, MaxDamage );
			
			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o = toExplode[i];
				
				if ( o is Mobile )
				{
					Mobile m = (Mobile)o;
					
					if ( m.RaceType == RaceType.LesserVampire )
					{
						int damage = Utility.RandomMinMax( min, max );
						
						damage += vampireBonus;
						
						if ( !Core.AOS && damage > 40 )
							damage = 40;
						else if ( Core.AOS && toDamage > 2 )
							damage /= toDamage - 1;
						
						AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
					}
			
					if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
					{
						if ( from != null )
							from.DoHarmful( m );
						
						int damage = Utility.RandomMinMax( min, max );
						
						damage += alchemyBonus;
				else if ( o is BaseHolyWater )
				{
					BaseHolyWater pot = (BaseHolyWater)o;

					pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
					

				}
			}
		}
	}
}
 

zen_tooshi

Wanderer
Its not saying you don't have one there. Its saying you need another.
Example:
Code:
if ( bool == true )
         {
                  if ( bool != false )
                  {
                             i++
                   }

This would give an error: line 6, } expected. Because it needs another one.
Basically you have more open braces than closing ones, that that is an error, as everything opened must close.

edit: This is a good reason why it is helpfull to get a scripting assist tool. I use Microsoft Visual Studio.NET. Which showes errors like that the same way a wordpad shows a mispelled word. Its much easier also to notice these, when you intend as you script, with each {. That way, when you get to the end of the file, you just } per indent still open. Look at the bottom of most files, they ALL have like 3-6 lines of }s closing off open sections still.
 

devil6

Wanderer
ok this is where i'm at, unable to find the last } i need
cripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Custom\BaseHolyWater.cs: CS1513: (line 298, column 2) } expect
d
cripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

PHP:
using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Spells;

namespace Server.Items
{
	public abstract class BaseHolyWater : BasePotion
	{
		public abstract int MinDamage { get; }
		public abstract int MaxDamage { get; }

		public override bool RequireFreeHand{ get{ return false; } }

		private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
		private static bool InstantExplosion = false; // Should explosion potions explode on impact?
		private const int   ExplosionRange   = 2;     // How long is the blast radius?

		public BaseHolyWater( PotionEffect effect ) : base( 0xF0D, effect )
		{
		}

		public BaseHolyWater( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}

		public virtual object FindParent( Mobile from )
		{
			Mobile m = this.HeldBy;

			if ( m != null && m.Holding == this )
				return m;

			object obj = this.RootParent;

			if ( obj != null )
				return obj;

			if ( Map == Map.Internal )
				return from;

			return this;
		}

		private Timer m_Timer;

		private ArrayList m_Users;

		public override void Drink( Mobile from )
		{
			if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
			{
				from.SendLocalizedMessage( 1062725 ); // You can not use a purple potion while paralyzed.
				return;
			}

			ThrowTarget targ = from.Target as ThrowTarget;

			if ( targ != null && targ.Potion == this )
				return;

			from.RevealingAction();

			if ( m_Users == null )
				m_Users = new ArrayList();

			if ( !m_Users.Contains( from ) )
				m_Users.Add( from );

			from.Target = new ThrowTarget( this );

			if ( m_Timer == null )
			{
				from.SendLocalizedMessage( 500236 ); // You should throw it now!
				m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } );
			}
		}

		private void Detonate_OnTick( object state )
		{
			if ( Deleted )
				return;

			object[] states = (object[])state;
			Mobile from = (Mobile)states[0];
			int timer = (int)states[1];

			object parent = FindParent( from );

			if ( timer == 0 )
			{
				Point3D loc;
				Map map;

				if ( parent is Item )
				{
					Item item = (Item)parent;

					loc = item.GetWorldLocation();
					map = item.Map;
				}
				else if ( parent is Mobile )
				{
					Mobile m = (Mobile)parent;

					loc = m.Location;
					map = m.Map;
				}
				else
				{
					return;
				}

				Explode( from, true, loc, map );
			}
			else
			{
				if ( parent is Item )
					((Item)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
				else if ( parent is Mobile )
					((Mobile)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );

				states[1] = timer - 1;
			}
		}

		private void Reposition_OnTick( object state )
		{
			if ( Deleted )
				return;

			object[] states = (object[])state;
			Mobile from = (Mobile)states[0];
			IPoint3D p = (IPoint3D)states[1];
			Map map = (Map)states[2];

			Point3D loc = new Point3D( p );

			if ( InstantExplosion )
				Explode( from, true, loc, map );
			else
				MoveToWorld( loc, map );
		}

		private class ThrowTarget : Target
		{
			private BaseHolyWater m_Potion;

			public BaseHolyWater Potion
			{
				get{ return m_Potion; }
			}

			public ThrowTarget( BaseHolyWater potion ) : base( 12, true, TargetFlags.None )
			{
				m_Potion = potion;
			}

			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
					return;

				IPoint3D p = targeted as IPoint3D;

				if ( p == null )
					return;

				Map map = from.Map;

				if ( map == null )
					return;

				SpellHelper.GetSurfaceTop( ref p );

				from.RevealingAction();

				IEntity to;

				if ( p is Mobile )
					to = (Mobile)p;
				else
					to = new Entity( Serial.Zero, new Point3D( p ), map );

				Effects.SendMovingEffect( from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0 );

				m_Potion.Internalize();
				Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Reposition_OnTick ), new object[]{ from, p, map } );
			}
		}

		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;
			
			Delete();
			
			for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;
				
				if ( targ != null && targ.Potion == this )
					Target.Cancel( m );
			}
			
			if ( map == null )
				return;
			
			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );
			
			int alchemyBonus = 0;
			int vampireBonus = 10;
			
			if ( direct )
				alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
			
			IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
			ArrayList toExplode = new ArrayList();
			
			int toDamage = 0;
			
			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
			}
			
			eable.Free();
			
			int min = Scale( from, MinDamage );
			int max = Scale( from, MaxDamage );
			
			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o = toExplode[i];
				
				if ( o is Mobile )
				{
					Mobile m = (Mobile)o;
					
					if ( m.RaceType == RaceType.LesserVampire )
					{
						int damage = Utility.RandomMinMax( 3, 8 );
						
						damage += vampireBonus;
						
						if ( !Core.AOS && damage > 40 )
							damage = 40;
						else if ( Core.AOS && toDamage > 2 )
							damage /= toDamage - 1;
						
						AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
					}
				
			
					if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
					{
						if ( from != null )
							from.DoHarmful( m );
						
						int damage = Utility.RandomMinMax( min, max );
						
						damage += alchemyBonus;
				}
				else if ( o is BaseHolyWater )
				{
					BaseHolyWater pot = (BaseHolyWater)o;

					pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
					

				}
			}
		}
	}
}
 

zen_tooshi

Wanderer
Go to the line and colum where it says it expects it, and you'll notice its the end of the file. You didn't close the namespace.
 

Packer898

Knight
devil6 said:
ok this is where i'm at, unable to find the last } i need

if your using SharpDevelop then when you have the file open right click anywhere in it and choose Indent. Then you can scroll down to the bottom of the script and see where its missing.

Or you could just use Ctrl + I
 

TMSTKSBK

Lord
Or you could use VS 2005, which shows red squigglies. This, to the trained eye, means "EBIL MISSING } OF DOOOOOOOMMM!!!!!!111one"
 

devil6

Wanderer
lol.......... yea, my isn't trained yet...lol.... but i've looked over this thing and looked, and i dont see where this is at lol
 

devil6

Wanderer
dose anyone see the } I'm missing?

PHP:
using System;
using System.Collections;
using Server;
using Server.Network;
using Server.Targeting;
using Server.Spells;

namespace Server.Items
{
	public abstract class BaseHolyWater : BasePotion
	{
		public abstract int MinDamage { get; }
		public abstract int MaxDamage { get; }

		public override bool RequireFreeHand{ get{ return false; } }

		private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
		private static bool InstantExplosion = false; // Should explosion potions explode on impact?
		private const int   ExplosionRange   = 2;     // How long is the blast radius?

		public BaseHolyWater( PotionEffect effect ) : base( 0xF0D, effect )
		{
		}

		public BaseHolyWater( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );

			writer.Write( (int) 0 ); // version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );

			int version = reader.ReadInt();
		}

		public virtual object FindParent( Mobile from )
		{
			Mobile m = this.HeldBy;

			if ( m != null && m.Holding == this )
				return m;

			object obj = this.RootParent;

			if ( obj != null )
				return obj;

			if ( Map == Map.Internal )
				return from;

			return this;
		}

		private Timer m_Timer;

		private ArrayList m_Users;

		public override void Drink( Mobile from )
		{
			if ( Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting)) )
			{
				from.SendLocalizedMessage( 1062725 ); // You can not use a purple potion while paralyzed.
				return;
			}

			ThrowTarget targ = from.Target as ThrowTarget;

			if ( targ != null && targ.Potion == this )
				return;

			from.RevealingAction();

			if ( m_Users == null )
				m_Users = new ArrayList();

			if ( !m_Users.Contains( from ) )
				m_Users.Add( from );

			from.Target = new ThrowTarget( this );

			if ( m_Timer == null )
			{
				from.SendLocalizedMessage( 500236 ); // You should throw it now!
				m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 0.75 ), TimeSpan.FromSeconds( 1.0 ), 4, new TimerStateCallback( Detonate_OnTick ), new object[]{ from, 3 } );
			}
		}

		private void Detonate_OnTick( object state )
		{
			if ( Deleted )
				return;

			object[] states = (object[])state;
			Mobile from = (Mobile)states[0];
			int timer = (int)states[1];

			object parent = FindParent( from );

			if ( timer == 0 )
			{
				Point3D loc;
				Map map;

				if ( parent is Item )
				{
					Item item = (Item)parent;

					loc = item.GetWorldLocation();
					map = item.Map;
				}
				else if ( parent is Mobile )
				{
					Mobile m = (Mobile)parent;

					loc = m.Location;
					map = m.Map;
				}
				else
				{
					return;
				}

				Explode( from, true, loc, map );
			}
			else
			{
				if ( parent is Item )
					((Item)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );
				else if ( parent is Mobile )
					((Mobile)parent).PublicOverheadMessage( MessageType.Regular, 0x22, false, timer.ToString() );

				states[1] = timer - 1;
			}
		}

		private void Reposition_OnTick( object state )
		{
			if ( Deleted )
				return;

			object[] states = (object[])state;
			Mobile from = (Mobile)states[0];
			IPoint3D p = (IPoint3D)states[1];
			Map map = (Map)states[2];

			Point3D loc = new Point3D( p );

			if ( InstantExplosion )
				Explode( from, true, loc, map );
			else
				MoveToWorld( loc, map );
		}

		private class ThrowTarget : Target
		{
			private BaseHolyWater m_Potion;

			public BaseHolyWater Potion
			{
				get{ return m_Potion; }
			}

			public ThrowTarget( BaseHolyWater potion ) : base( 12, true, TargetFlags.None )
			{
				m_Potion = potion;
			}

			protected override void OnTarget( Mobile from, object targeted )
			{
				if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
					return;

				IPoint3D p = targeted as IPoint3D;

				if ( p == null )
					return;

				Map map = from.Map;

				if ( map == null )
					return;

				SpellHelper.GetSurfaceTop( ref p );

				from.RevealingAction();

				IEntity to;

				if ( p is Mobile )
					to = (Mobile)p;
				else
					to = new Entity( Serial.Zero, new Point3D( p ), map );

				Effects.SendMovingEffect( from, to, m_Potion.ItemID & 0x3FFF, 7, 0, false, false, m_Potion.Hue, 0 );

				m_Potion.Internalize();
				Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Reposition_OnTick ), new object[]{ from, p, map } );
			}
		}

		public void Explode( Mobile from, bool direct, Point3D loc, Map map )
		{
			if ( Deleted )
				return;
			
			Delete();
			
			for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
			{
				Mobile m = (Mobile)m_Users[i];
				ThrowTarget targ = m.Target as ThrowTarget;
				
				if ( targ != null && targ.Potion == this )
					Target.Cancel( m );
			}
			
			if ( map == null )
				return;
			
			Effects.PlaySound( loc, map, 0x207 );
			Effects.SendLocationEffect( loc, map, 0x36BD, 20 );
			
			int alchemyBonus = 0;
			int vampireBonus = 10;
			
			if ( direct )
				alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
			
			IPooledEnumerable eable = LeveledExplosion ? map.GetObjectsInRange( loc, ExplosionRange ) : map.GetMobilesInRange( loc, ExplosionRange );
			ArrayList toExplode = new ArrayList();
			
			int toDamage = 0;
			
			foreach ( object o in eable )
			{
				if ( o is Mobile )
				{
					toExplode.Add( o );
					++toDamage;
				}
			}
			
			eable.Free();
			
			int min = Scale( from, MinDamage );
			int max = Scale( from, MaxDamage );
			
			for ( int i = 0; i < toExplode.Count; ++i )
			{
				object o = toExplode[i];
				
				if ( o is Mobile )
				{
					Mobile m = (Mobile)o;
					
					if ( m.RaceType == RaceType.LesserVampire )
					{
						int damage = Utility.RandomMinMax( 3, 8 );
						
						damage += vampireBonus;
						
						if ( !Core.AOS && damage > 40 )
							damage = 40;
						else if ( Core.AOS && toDamage > 2 )
							damage /= toDamage - 1;
						
						AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 );
					}
				
			
					if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) )
					{
						if ( from != null )
							from.DoHarmful( m );
						
						int damage = Utility.RandomMinMax( min, max );
						
						damage += alchemyBonus;
				}
				else if ( o is BaseHolyWater )
				{
					BaseHolyWater pot = (BaseHolyWater)o;

					pot.Explode( from, false, pot.GetWorldLocation(), pot.Map );
					

				}
			}
		}
	}
}
 

devil6

Wanderer
here what i get with that :(


r
Scripts: Compiling C# scripts...failed (1 errors, 12 warnings)
- Warning: Scripts\Commands\motd.cs: CS0183: (line 322, column 47) The given ex
pression is always of the provided ('Server.Mobiles.PlayerMobile') type
- Warning: Scripts\Commands\motd.cs: CS0219: (line 369, column 8) The variable
'line' is assigned but its value is never used
- Warning: Scripts\Items\Weapons\BaseWeapon.cs: CS0219: (line 2699, column 8) T
he variable 'oreType' is assigned but its value is never used
- Warning: Scripts\Custom\XmlSpawner2-v281-3of3\XmlMobiles\TalkingBaseEscortabl
e.cs: CS0219: (line 361, column 10) The variable 'gainedPath' is assigned but it
s value is never used
- Warning: Scripts\Mobiles\Vendors\BaseVendor.cs: CS0162: (line 355, column 4)
Unreachable code detected
- Error: Scripts\Custom\BaseHolyWater.cs: CS0117: (line 263, column 11) 'Server
.Mobile' does not contain a definition for 'RaceType'
- Warning: Scripts\Engines\Craft\Core\CraftItem.cs: CS0219: (line 1496, column
11) The variable 'endquality' is assigned but its value is never used
- Warning: Scripts\Engines\Craft\Core\CraftItem.cs: CS0219: (line 1627, column
11) The variable 'endquality' is assigned but its value is never used
- Warning: Scripts\Engines\Craft\DefBlacksmithy.cs: CS0219: (line 219, column 8
) The variable 'index' is assigned but its value is never used
- Warning: Scripts\Items\Wands\BaseWand.cs: CS0219: (line 184, column 8) The va
riable 'number' is assigned but its value is never used
- Warning: Scripts\Mobiles\Townfolk\BaseEscortable.cs: CS0219: (line 324, colum
n 10) The variable 'gainedPath' is assigned but its value is never used
- Warning: Scripts\Mobiles\PlayerMobile.cs: CS0219: (line 1526, column 11) The
variable 'gainedPath' is assigned but its value is never used
- Warning: Scripts\Online-Chat\OnlineClientGump.cs: CS0219: (line 185, column 8
) The variable 'line' is assigned but its value is never used
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 

Packer898

Knight
Code:
 - Error: Scripts\Custom\BaseHolyWater.cs: CS0117: (line 263, column 11) 'Server
.Mobile' does not contain a definition for 'RaceType'

Means you need to look at your playermobile.cs and call the same property that you used in there. If you caled it VampRace then it needs to be the same here.
 

zen_tooshi

Wanderer
I'm not exactly sure why it happens, but it seem syou are having some of the same occurances I am. Anytime there is an error, some other prefab custom scripts that the server I script for uses always fire off warnings...
The first time it came up I freaked, fixed what I was working on, and then freaked more when the mysteriously appearing "unreachable code" vanished again...

Anyway know why, when you get an error, some scripts push warnings tword you. But once you fix the errors, the warnings are gone?

edit: Oh yeah, em. The reason I brought that up, is the long list of erros and warnings you have there, only 1 seems to be relavent to the file you are working one. Do the above fix check (about mobile.RaceType or whatever) and see if it compiles after that. If its the same weird thing i get, once you fix that 1 error, the rest ninja vanishes.
 

Packer898

Knight
Warning will not stop compiling. Errors will. I had a few of the same warnings he does from various scripts. They are not that hard to fix, just some moinor tweaks to a few custom scripts. I fixed them myself just because I didnt want to see any errors or take a chance on some type of bug because of it.
 

daat99

Moderator
Staff member
zen_tooshi said:
I'm not exactly sure why it happens, but it seem syou are having some of the same occurances I am. Anytime there is an error, some other prefab custom scripts that the server I script for uses always fire off warnings...
The first time it came up I freaked, fixed what I was working on, and then freaked more when the mysteriously appearing "unreachable code" vanished again...

Anyway know why, when you get an error, some scripts push warnings tword you. But once you fix the errors, the warnings are gone?

edit: Oh yeah, em. The reason I brought that up, is the long list of erros and warnings you have there, only 1 seems to be relavent to the file you are working one. Do the above fix check (about mobile.RaceType or whatever) and see if it compiles after that. If its the same weird thing i get, once you fix that 1 error, the rest ninja vanishes.
The reason is simple.
You use some poorly coded scripts that have "warnings".
Warnings won't stop the server from compiling (like packer said already) but they should be fixed to avoid confusion.
It's realy annoying to help a person that have 10 warnings and 1 errors... it takes a min just to figure out what the error is...

I suggest that you both try to fix the warnings that you have before you fix the errors.
Just ignore the error itself and make the warnings go away.
Once you don't see the warnings anymore you could fix the error and be sure the warnings are gone for good (assuming you won't install another poorly coded script that is) ;)
 

devil6

Wanderer
wow, playermobile.cs is huge, anyways hmmm i dont no whats going on....lol i don't see anything in that file, that calls racetypes of anykind,
 

Packer898

Knight
devil6 said:
wow, playermobile.cs is huge, anyways hmmm i dont no whats going on....lol i don't see anything in that file, that calls racetypes of anykind,

Uhh You would have had to added it to have custom Vampire races on your shard. You do have Vampires races on your shard right? If so then how did you add them?
 

devil6

Wanderer
hehehe, no just a vampire script NPC only, lol, sorry for not making that clear, I'm just trying to put together holy water based on Exlotion that would do double damage to Vampire NPC.

I was wondering why it became suck a hard project, but thats my falt :)
 
Top