Jump to content

C# condition for a fightclass made using wrobot


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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...