Jump to content

Recommended Posts

Hello, for this purpose you need a stopwatch and events:


    private readonly Stopwatch _combatTimer = new Stopwatch();


    public void Initialize()
    {
        EventsLua.AttachEventLua(LuaEventsId.PLAYER_REGEN_DISABLED, CombatStart);
        EventsLua.AttachEventLua(LuaEventsId.PLAYER_REGEN_ENABLED, CombatEnd);
    }


    private void CombatStart(object context)
    {
        _combatTimer.Restart();
    }


    private void CombatEnd(object context)
    {
        _combatTimer.Reset();
    }

usage in a method for example:

        if (_combatTimer.ElapsedMilliseconds > 8000)
        {
            Logging.Write("In combat since 8 seconds");
        }

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...