Jump to content

Recommended Posts

Scenario Bot is in a party I would like it to only buff a target "if" its name is "player-name" . at the moment i just use SpellManager.CastSpellByNameOn("Blessing of Kings","player-name");  in the spell name field and check the notspell. is C# code and in the conditions I include targetbuff, target distance, globalcooldown however its checking all the party members for the conditions and repeat casting on the intended target this is because its not checking if the targets name matches a condition. So my question is what would be typed in the C# condition so it will only cast if the name of the target matches said condition.

If an Lua condition can be added that would work too

Sorry, but it´s hard to understand what exactly you mean.

If you have a Function which already checks all Party Members then you can use something like to cast only if :

WoWUnit Bufftarget = ObjectManager.GetObjectWoWUnit.Where(o=> o.IsAlive && !o.HaveBuff("Buff") && o.Name == "player-name" && o.IsPartyMember).FirstOrDefault();

      Interact.InteractGameObject(Bufftarget.GetBaseAddress);
      Buff.Launch();
      Usefuls.WaitIsCasting();

Or using the same but casting on Focustarget:

WoWUnit Bufftarget = ObjectManager.GetObjectWoWUnit.Where(o=> o.IsAlive && !o.HaveBuff("Buff") && o.Name == "player-name" && o.IsPartyMember).FirstOrDefault();

     ObjectManager.Me.FocusGuid = Bufftarget.Guid;
     Lua.LuaDoString($"CastSpellByID({ Buff.Id}, \"focus\")");
     Usefuls.WaitIsCasting();

And complete:

if(Me.IsInGroup)
{
    WoWUnit Bufftarget = ObjectManager.GetObjectWoWUnit.Where(o=> o.IsAlive && !o.HaveBuff("Buff") && o.Name == "player-name" && o.IsPartyMember).FirstOrDefault();

         ObjectManager.Me.FocusGuid = Bufftarget.Guid;
         Lua.LuaDoString($"CastSpellByID({ Buff.Id}, \"focus\")");
         Usefuls.WaitIsCasting();
         Lua.LuaDoString("ClearFocus();");
}

It would be helpful if you just post the Code you are struggling with.

You see It will check the whole party for the set of conditions to cast the spell then repeat cast it on the intended name however I need it to not cast  if the named target has the buff already regardless of the other party members having it! if it only checked the named target for the buff conditions that would be ideal, however a work around would be to add a condition that if the targets name that the bot checked  for the buff condition is not the intended targets name then do not cast. It would then check party 1 through 5 for the correct name as a condition then check buff conditions and proceed to cast or return if its already buffed.

Ah sorry, thought you were making a complete FIghtclass in C#. I never used the Fightclass Editor, so i really don´t know hoa to build this there. I am sure that you can catch if the Target has already the Buff then ignore it. 

 

I have figured it out and its as simple as adding a C# condition that looks like this.  p.Name == ("insertnamehere")

So for those who use the Fight-class Creation tool, in the conditions drop down menu choose C sharp code then type into the value box p.Name == ("insertnamehere") and obviously insert the intended targets name in place of insertnamehere. The bot will only cast onto that target if its name matches this condition.

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...