What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

Question regarding code for a CC/Plugin to use a trinket when target health < 45%

SpigotStyle

New Member
Joined
Jan 15, 2010
Messages
98
Reaction score
1
Sorry to seem like a complete programming noob here (I am), but I am having a little difficulty figuring out how to modify a plugin or CC to use my Badge of Conquest when the target gets to say, 45% or below.

I found some code that does something similar, but uses the trinket when your character gets below a particular health percentage. (Credit to NaRK for his modification of exemplar's PvP trinket plugin:
http://www.thebuddyforum.com/honorb...p/13081-plugin-pvp-basic-trinket-racials.html)

Code:
if (StyxWoW.Me.HealthPercent < 15 && StyxWoW.Me.Inventory.Equipped.Trinket1 != null && StyxWoW.Me.Inventory.Equipped.Trinket1.Name.Contains(" Emblem of Tenacity") && StyxWoW.Me.Inventory.Equipped.Trinket1.Cooldown <= 0)
                                    {
                                                Logging.Write("Health < 15% - " + " - " + StyxWoW.Me.Inventory.Equipped.Trinket1.Name);
                                                StyxWoW.Me.Inventory.Equipped.Trinket1.Use();
                                                return;
                                    }
                                    if (StyxWoW.Me.HealthPercent < 15 && StyxWoW.Me.Inventory.Equipped.Trinket2 != null && StyxWoW.Me.Inventory.Equipped.Trinket2.Name.Contains(" Emblem of Tenacity") && StyxWoW.Me.Inventory.Equipped.Trinket2.Cooldown <= 0)
                                    {
                                                Logging.Write("Health < 15% - " + " - " + StyxWoW.Me.Inventory.Equipped.Trinket2.Name);
                                                StyxWoW.Me.Inventory.Equipped.Trinket2.Use();
                                                return;
                                    }

I looked through the documentation zip and elsewhere on the forum and I am at a standstill as to what string to use instead of StyxWow.Me.Healthpercent. Currenttarget looks to be what I would be aiming at using, but I am unclear how to draft the code.

Any help would be greatly appreciated.
 
PHP:
if (StyxWoW.Me.CurrentTarget.HealthPercent <= 45 && StyxWoW.Me.Inventory.Equipped.Trinket1 != null && 
    StyxWoW.Me.Inventory.Equipped.Trinket1.Name.Contains("Badge of Conquest") && StyxWoW.Me.Inventory.Equipped.Trinket1.Cooldown == 0)
{
     StyxWoW.Me.Inventory.Equipped.Trinket1.Use();
     return;
}

if (StyxWoW.Me.CurrentTarget.HealthPercent <= 45 && StyxWoW.Me.Inventory.Equipped.Trinket2 != null && 
    StyxWoW.Me.Inventory.Equipped.Trinket2.Name.Contains("Badge of Conquest") && StyxWoW.Me.Inventory.Equipped.Trinket2.Cooldown == 0)
{
     StyxWoW.Me.Inventory.Equipped.Trinket2.Use();
     return;
}

Should do what you want it to do!
 
I'll give it a test right now. Thanks Fifty!

Edit: Not working, however, this gives me a base to go off of and troubleshoot. I'll tinker with it and see what I come up with.
 
Last edited:
Back
Top