RedBeard
Member
Currently this script finds multiple targets and launches an arrow at all targets at once. I'm trying to get it to attack one target at a time. When it does multiple targets the damage seems to multiply as well strangely.
I change the 'foreach' to if statements having some trouble
I change the 'foreach' to if statements having some trouble
Code:
public virtual void Refresh()
{
bool foundPlayer = false;
ArrayList list = new ArrayList();
foreach ( Mobile mob in GetMobilesInRange( TrapRange ))
{
if ( !mob.Alive || mob.AccessLevel > AccessLevel.Player || (mob.Hidden && NoDamageHidden) )
continue;
if ( ( (this.Z + 8) >= mob.Z && (mob.Z + 16) > this.Z ) )
{
if (mob is BaseCreature || mob is BaseCreature && (((BaseCreature)mob).Controlled || ((BaseCreature)mob).Summoned))
list.Add(mob);
else if (mob.Player)
list.Add(mob);
foundPlayer = true;
foreach (Mobile mm in list)
{
Effects.SendMovingEffect( this, mm, SpellEffect, 5, 0, false, true );
Effects.PlaySound( Location, Map, Sound );
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), mm, mm, Utility.RandomMinMax( MinDamage, MaxDamage ), 100, 0, 0, 0, 0 );
}
}
}
}