Attribute Problem #2

devomage

Member
My attribute setup is all time based. Health/Power max amounts are level based. Ley/Fatigue is 0-100. Regen rate is 4x per second.

Health: 15 seconds
Ley: 20 seconds
Power: 30 seconds if Ley is 0. 10 seconds if Ley is 100.
Fatigue: 5 seconds

- When the Ley attribute changes the Power AutoUpdateAmount is updated accordingly.
- If the Ley attribute is changing, the Power attribute is no longer updated or an update happens randomly.
- You can repro this by increasing Ley when in a trigger - then within the Ley update event, modify the Power attribute AutoUpdateAmount = PowerPerRegen
- This doesnt happen until power is around 50%.
- When Ley hits 100% - Power increases as it should.

C#:
private float PowerPerRegen
{
    get
    {
        //30s from 0 to 100% if ley = 0%
        //10s from 0 to 100% if ley = 100%

        var Power = m_AttributeManager.GetAttribute("Power");
        var Ley = m_AttributeManager.GetAttribute("Ley");

        float seconds = 30f;
        seconds -= 20f * (Ley.Value / 100f);

        return RegenPerTick(Power.MaxValue, seconds, true);
    }
}

private float RegenPerTick(float maxValue, float totalSeconds, bool combatPenalty = false)
{
    float value = maxValue / totalSeconds / m_GameManager.RegensPerSecond;

    if (combatPenalty && m_Character.InCombat) value *= m_GameManager.m_InCombatPenalty;

    return value;
}
 
Attached is the repro.

I added the package to a new project... the new problem does not happen until you apply the fix you provided in my previous post. Comments in the script I provided will explain.
 

Attachments

  • UCC Attribute Repro.unitypackage
    123.2 KB · Views: 2
Thank you for the repro scene. I'll send you a new version of the AttributeManager that looks like it fixes things - please verify after you get it!
 
Top