Jump to content

Recommended Posts

Im trying to make FC's for vanilla and ship them as .cs files.

 

For the life of me i cant get a "hostile unit near=x" condition to work like it does in the xml FC editor.  I cant find any Working examples i can copy the structure from either.

 

Attached is what i currently have- trying to get it to work for Thunderclap... once i have something working i can go apply it to other classes.

Anyone got a file i can look at to see how it should work?

Warrior_Aoe2.cs

        if (Clap.KnownSpell && !ObjectManager.Target.HaveBuff("Thunder Clap") && ObjectManager.Me.Rage >= 15 && enemiesNearMe >= 2))<-remove this one?
        {
            Clap.Launch();
        }    

1 hour ago, eeny said:

Im trying to make FC's for vanilla and ship them as .cs files.

 

For the life of me i cant get a "hostile unit near=x" condition to work like it does in the xml FC editor.  I cant find any Working examples i can copy the structure from either.

 

Attached is what i currently have- trying to get it to work for Thunderclap... once i have something working i can go apply it to other classes.

Anyone got a file i can look at to see how it should work?

Warrior_Aoe2.cs

bool thunderClapConditions = (ObjectManager.Me.GetAttackableUnits(8).Count() >= 2) && this.AoeMode;
if (this.ThunderClap.Cast(ObjectManager.Me.TargetObject, thunderClapConditions))
{
    return true;
}
/// <summary>
/// Gets the units around our unit in the given range.
/// </summary>
/// <param name="range">The range we are looking in.</param>
/// <param name="objectType">The object type we are looking for.</param>
/// <returns>Returns a list of units if we found one, otherwise a empty list.</returns>
public static IEnumerable<WoWUnit> GetAttackableUnits(this WoWUnit instance, int range, WoWObjectType objectType = WoWObjectType.Unit)
{
    // Get units
    IEnumerable<WoWUnit> results = ObjectManager.GetObjectWoWUnit().Where(u => u.Type == objectType && u.IsAlive && u.MaxHealth > 1 && ((instance.Position.DistanceTo2D(u.Position) - instance.CombatReach) <= range) && u.IsAttackable && !TraceLine.TraceLineGo(u.Position));

    // Return
    return results;
}
Edited by iMod

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...