I'm working on a "small" project & so far, so good. The only thing I'm having issues with at the moment is my gargoyles axe spawning wood elementals. I have the ele's scripted & can get 1 to spawn, but only one. If I try to use the default method used for Mining, they seem to spawn to the internal map only. So I'm using the method I used for FireRock Craft to spawn the fire rock ele. Only problem is, it will only spawn the 1 type. Heres the area for spawning them. The axe works great otherwise, mutates the vein like it should & will spawn the 1 ele, but I cant get the others to go in as well.
If I try adding them this way
I get ; expected with a nice red line under Activator. Any suggestions? Full script added.
Code:
private static Type[] m_Types = new Type[]
{
typeof(OakWoodElemental ),
typeof(AshWoodElemental ),
typeof(YewWoodElemental),
typeof(HeartwoodElemental ),
typeof(BloodwoodElemental ),
typeof(FrostwoodElemental)
};
public override void OnHarvestFinished(Mobile from, Item tool, HarvestDefinition def, HarvestVein vein, HarvestBank bank, HarvestResource resource, object harvested)
{
if (tool is GargoylesAxe && def == m_Definition && 0.1 > Utility.RandomDouble() && HarvestMap.CheckMapOnHarvest(from, harvested, def) == null)
{
try
{
Type tospawn = (m_Types[Utility.Random(m_Types.Length)]);
Map map = from.Map;
if (map == null) return;
BaseCreature spawned = (OakWoodElemental)Activator.CreateInstance(tospawn);
if (spawned != null)
{
int offset = Utility.Random(8) * 2;
for (int i = 0; i < m_Offsets.Length; i += 2)
{
int x = from.X + m_Offsets[(offset + i) % m_Offsets.Length];
int y = from.Y + m_Offsets[(offset + i + 1) % m_Offsets.Length];
if (map.CanSpawnMobile(x, y, from.Z))
{
spawned.MoveToWorld(new Point3D(x, y, from.Z), map);
spawned.Combatant = from;
return;
}
else
{
int z = map.GetAverageZ(x, y);
if (map.CanSpawnMobile(x, y, z))
{
spawned.MoveToWorld(new Point3D(x, y, z), map);
spawned.Combatant = from;
return;
}
}
}
spawned.MoveToWorld(from.Location, from.Map);
spawned.Combatant = from;
}
}
catch { }
}
}
Code:
BaseCreature spawned = (OakWoodElemental || AshWoodElemental)Activator.CreateInstance(tospawn);