I've learned a lot about programming in general and C# since I started trying to make routines, learning the basics makes the biggest difference. The Reborn Console plugin is also amazing. The following code is commented so you can see what each line does...
Code:
//Loops through every VISIBLE object in the objectmanager.
foreach (GameObject a in GameObjectManager.GameObjects.Where(u => u.IsVisible))
{
//For each party member in our party manager
foreach (PartyMember b in PartyManager.AllMembers)
{
//If one of our party members matches an object in the object manager...
if (a == b.GameObject)
//Use the object as character to display the info we want in the log.
Log((a as Character).Name + " " + (a as Character).CurrentHealthPercent + " " + (a as Character).CurrentManaPercent);
}
}
I've only just started getting into C# so there's probably a better way, but I don't know it. Essentially i'm using 2 foreach loops, 1 to go through all visible game objects and 1 to go through all our current party members. If a party member matches an object I use
the object as character (using this gives me access to all the info I want, including percentages) and display some info in the log. Instead of writing info to the log I could just as easily do ...
Code:
foreach (GameObject a in GameObjectManager.GameObjects.Where(u => u.IsVisible))
{
foreach (PartyMember b in PartyManager.AllMembers)
{
if (a == b.GameObject && (a as Character).CurrentHealthPercent < 90 && !(a as Character).HasAura("Regen"))
Actionmanager.DoAction("Regen", a);
}
}
This should use Regen on someone in our party who currently doesn't have it on them and has less than 90% health, I haven't tested it but it should work. You can try writing the first block of code in the Reborn Console to see if it works for you, from there you can alter it and have it do whatever you'd like.
To get percent from PartyMembers, you would need to do something like this ...
Code:
var HealthPercent = (PartyMember.CurrentHealth / PartyMember.MaxHealth) * 100;
Obviously all that does is divide the party member's current health from the max health and multiplies it by 100, the issue i've had is that using this, it always returns either
0 or
100. Using objects as character is the only way I was successful.
I hope this was enough to lead you in the right direction. I'd like this community to grow and help each other out, I certainly know i'll need the help.