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

Energy updating problem

fiftypence

New Member
Joined
Jul 28, 2011
Messages
235
Reaction score
13
Energy values seem to take a long time to be updated by Honorbuddy. This means that when evaluating a condition such as Me.CurrentEnergy > 90 using a decorator, the action will not be completed when energy hits /90/ but rather one or two seconds after.

Take, for example, the following code:

Code:
private Composite BuildBehaviorTree()
{
    return new PrioritySelector(
        new Sequence(
            new Action(ret => Logging.Write("Visit" + i + "  Energy: " + Me.CurrentEnergy)),
            new Action(ret => i++))
    );
}

this produces a log output similar to:

Code:
Visit0  Energy: 120
Visit1  Energy: 120
Visit2  Energy: 120
Visit3  Energy: 120
Visit4  Energy: 120
Visit5  Energy: 120
Visit6  Energy: 120
Visit7  Energy: 65
Visit8  Energy: 65
Visit9  Energy: 65
Visit10  Energy: 70
Visit11  Energy: 70
Visit12  Energy: 70
Visit13  Energy: 70
Visit14  Energy: 70
Visit15  Energy: 70
Visit16  Energy: 70
Visit17  Energy: 70
Visit18  Energy: 70
Visit19  Energy: 70
Visit20  Energy: 91
Visit21  Energy: 91
Visit22  Energy: 91
Visit23  Energy: 91
Visit24  Energy: 91
Visit25  Energy: 91
Visit26  Energy: 91
Visit27  Energy: 91
Visit28  Energy: 91
Visit29  Energy: 91
Visit30  Energy: 91
Visit31  Energy: 113
Visit32  Energy: 113
Visit33  Energy: 113
Visit34  Energy: 113
Visit35  Energy: 113
Visit36  Energy: 113

I use the following code to fix this:

Code:
private Composite BuildBehaviorTree()
{
    return new PrioritySelector(
        new Sequence(
            new Action(ret => UpdateEnergyValues()),
            new Action(ret => Logging.Write("Visit" + i + "  Energy: " + energy)),
            new Action(ret => i++))
    );
}

private void UpdateEnergyValues()
{
    energy = Lua.GetReturnVal<int>("return UnitMana(\"player\");", 0);
}

which results in the following log output:

Code:
Visit0  Energy: 120
Visit1  Energy: 120
Visit2  Energy: 120
Visit3  Energy: 120
Visit4  Energy: 120
Visit5  Energy: 120
Visit6  Energy: 120
Visit7  Energy: 67
Visit8  Energy: 69
Visit9  Energy: 71
Visit10  Energy: 73
Visit11  Energy: 74
Visit12  Energy: 78
Visit13  Energy: 80
Visit14  Energy: 81
Visit15  Energy: 83
Visit16  Energy: 85
Visit17  Energy: 87
Visit18  Energy: 90
Visit19  Energy: 92
Visit20  Energy: 93
Visit21  Energy: 95
Visit22  Energy: 97
Visit23  Energy: 101
Visit24  Energy: 103
Visit25  Energy: 105
Visit26  Energy: 107
Visit27  Energy: 108


Is there any way to force an update of the player's energy resource without using Lua? I have a sneaky suspicion that constantly calling lua to update energy values every time the tree-walker visits a node will slow things down considerably, and waiting one/two seconds per energy update simply isn't acceptable for my CC.

Cheers
fiftypence
 
Lua reading is actually fast enough for this.

You may want to take profit of the in-game spell queue by casting spells when they're nearly ready to be cast. Try something like "Me.CurrrentEnergy >= 85" if you need 90.
 
Hey, cheers for the advice. With a rogue CC I am never limited by a global cooldown (or, rather, /very/ rarely) so taking advantage of lag tolerance wouldn't really boost DPS by much. The main factor to worry about is energy management. Mutilate costs 55 energy but we should only cast it when we have 90+ energy OR when we have envenom so we pool energy for other abilities/envenom/etc. I fully intend to rewrite my paladin CC soon to use lag tolerance ability queues and Lua to cast spells, so thank you for that suggestion. :)

When I make use of Me.CurrentEnergy >= 85 it will, in the vast majority of cases, actually cast the ability when the character's energy is above 100. Before implementing my lua work-around I had to use Me.CurrentEnergy <= 70 in order to have the CC pool energy to 90 -- but the annoying thing about this method is that sometimes it will actually cast the spell when the character's energy is at 75, albeit rarely, and under certain circumstances (overkill and heroism) the CC would get energy capped.

If Lua is fast enough for this then I am more than happy to continue using it.

Thanks!
 
Back
Top