Im trying to make a summon familiar ability which I got to work well enough but it only spawns it once.
I'm trying to get spawn one at a time but repeat process after minion dies(spawn new minion)

Code:
#region Summon Familiar

public void SummonFamiliar()

{

if (this.Map == null)

return;

if (m_SpawnedFamiliar)

{

m_Familiar = null;

return;

}

if (m_SpawnedFamiliar)

{

if (m_Familiar != null && m_Familiar.Deleted)

m_Familiar = null;

return;

}



if (Hits < HitsMax / 2)

{

this.Say("Kal Xen Bal [Summon Familiar]");

switch (Utility.Random(5))

{

case 0:

this.m_Familiar = new VampireBatPK(this);

break;

case 1:

this.m_Familiar = new DarkWolfPK(this);

break;

case 2:

this.m_Familiar = new ShadowWispPK(this);

break;

case 3:

this.m_Familiar = new DeathAdderPK(this);

break;

case 4://default:

this.m_Familiar = new HordeMinionPK(this);

break;

}

this.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);

m_Familiar.PlaySound(m_Familiar.GetIdleSound());

((BaseCreature)this.m_Familiar).Team = this.Team;

this.m_Familiar.MoveToWorld(this.Location, this.Map);

this.m_SpawnedFamiliar = true;

}



else if (this.m_Familiar != null && this.m_Familiar.Deleted)

{

this.m_Familiar = null;

}

}
 
Red, maybe this will help give you some insight:
Code:
		public override void OnDamage( int amount, Mobile from, bool willKill )
		{
			if ( from != null && from != this && !m_InHere )
			{
				m_InHere = true;
				AOS.Damage( from, this, Utility.RandomMinMax( 8, 20 ), 100, 0, 0, 0, 0 );

				MovingEffect( from, 0xECA, 10, 0, false, false, 0, 0 );
				PlaySound( 0x491 );

				if ( 0.05 > Utility.RandomDouble() )
					Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerStateCallback( CreateBones_Callback ), from );

				m_InHere = false;
			}
			
			if ( willKill )
			{
				SpawnHelper( new Changeling(), 6368, 1630, 1 );
				SpawnHelper( new Changeling(), 6371, 1633, 1 );
				SpawnHelper( new Changeling(), 6374, 1630, 1 ); 	

				Say( "You shall never defeat me!" );
			}
				
			base.OnDamage( amount, from, willKill );
		}
Code:
		public virtual void CreateBones_Callback( object state )
		{
			Mobile from = (Mobile)state;
			Map map = from.Map;

			if ( map == null )
				return;

			int count = Utility.RandomMinMax( 1, 3 );

			for ( int i = 0; i < count; ++i )
			{
				int x = from.X + Utility.RandomMinMax( -1, 1 );
				int y = from.Y + Utility.RandomMinMax( -1, 1 );
				int z = from.Z;

				if ( !map.CanFit( x, y, z, 16, false, true ) )
				{
					z = map.GetAverageZ( x, y );

					if ( z == from.Z || !map.CanFit( x, y, z, 16, false, true ) )
						continue;
				}

				UnholyBone bone = new UnholyBone();

				bone.Hue = 0;
				bone.Name = "Sacrificial Bones";
				bone.ItemID = Utility.Random( 0xECA, 9 );

				bone.MoveToWorld( new Point3D( x, y, z ), map );
			}
		}

With the above code, this NPC spawns 3 "helpers" at a time.
 
Its suppose to look and act like authentic summon familiar spell so no spinning bones or w/e one helper spawns til it dies then a chance to spawn another. My script works great problem is it is one and done. I'm not looking to rewrite the whole thing just tweak what i have to repeat the process over time. It is set to trigger on got melee 30% time when health is at or below 50.

I am making PVP Bots that try to look and act like real player-killers. Only reason my necro-mage tries to summons familiars is to insure a corpse to animate dead with in overland situations, so I'm actually trying to overcome some ai deficiencies in mobiles with these scripts to seem more realistic. I could leave it as is, would just be nice to have it try to re-summon since the idea is for it to survive, since they drop a head with their name on it I would like to incorporate into bounty system (so as you can see one and done is not as authentic if they are to be a hunted criminals that have a good chance to survive battle after battle or continue to murder).

Details:
They wear armor that randomly adds runic props and randomly applies resource type and bonus as well as their armor say exceptional crafted by "them". Talismans they wear say blessed for "them". They talk smack using their opponents "names". With a 25% chance to drop the leather pieces its wearing, armor comprised of Arties and virtually crafted leather for realism. Their hair and beards are melisandes dyed. Tank mages and warrior PKers will have chance to drop virtually crafted runic weapons that say exceptional crafted by "them".
They are clones of PVP templates used in R/L UO., & reward Justice points.

They have a speed boost when health low.
I may even give them crazy guild names and titles

So this isnt a purple dragon type script... Its for small shards that want a taste of the PVP aspect without griefers or perhaps without Felucca ruleset, and a chance to raise Justice Virtue on non-PVP ruleset shards..
For all interested I'll be releasing this here when completed.
 
Last edited:
Ok I figured this out for anyone interested. This works to spawn one helper at a time, and try to respawn when criteria are met again, also pulling possible mobs from a list:
(Ripped from Omni Ai Necro) thanks peoharen
Code:
#region Summon Familiar

public void SummonFamiliar()

{

int whichone = Utility.RandomMinMax(1, 5);

BaseCreature mob = null;

if (whichone == 5 )//&& this.Skills[SkillName.Necromancy].Value >= 100.0)

mob = new VampireBatFamiliar();

else if (whichone >= 4 )//&& this.Skills[SkillName.Necromancy].Value >= 80.0)

mob = new DeathAdder();

else if (whichone >= 3 )//&& this.Skills[SkillName.Necromancy].Value >= 60.0)

mob = new DarkWolfFamiliar();

else if (whichone >= 2 )//&& this.Skills[SkillName.Necromancy].Value >= 50.0)

mob = new ShadowWispFamiliar();

else //if (this.Skills[SkillName.Necromancy].Value >= 30.0)

mob = new HordeMinionFamiliar();

if (mob != null)

{

BaseCreature.Summon(mob, this, this.Location, -1, TimeSpan.FromDays(1.0));

mob.FixedParticles(0x3728, 1, 10, 9910, EffectLayer.Head);

mob.PlaySound(mob.GetIdleSound());

}

return;

}

#endregion

public override void OnGotMeleeAttack(Mobile attacker)

{

base.OnGotMeleeAttack(attacker);

if (0.50 >= Utility.RandomDouble() && Hits <= 50)

SummonFamiliar();

}
 
Back