LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   Fervor Pip Intervals (https://www.lotrointerface.com/forums/showthread.php?t=1950)

Mohrrin 12-09-2012 03:55 PM

Fervor Pip Intervals
 
1 Attachment(s)
Hello Everyone!

I'm new to writing Lua plugins, and I've undertaken the task of creating a metronome for champions that will allow them to see when they are about to receive a Fervor pip while in fervor stance.

Using resources from lua programmers Falstar and Garan (Fervor pip-bars and a timer, respectively) I have managed to create a plugin that will act as the metronome.

The idea was to start the fervor pip timer the moment you enter combat, and after that count four seconds to designate a pip.

There are 3 bars in my plugin, allowing for four unique states: (No lights, one light, two lights, three lights).

However, something seems to be off with the synchronization, as the metronome works fine, only the state that designates the pip is random per encounter. Sometimes it will fire when there are zero lights, sometimes it will fire when there is one light, etc. During the encounter, though, the pip will reliably fire in that same spot (tested for over three minutes).

Can anyone give me a clue as to why this may be?

I'm using Turbine.Engine.GetGameTime() for the sake of keeping time.

Attached is a zip of the plugin.

Thanks!

--- FYI ---

The current version of this code is an untested attempt to determine if the number of seconds on the clock are retained at the close of combat, and used to determine the next pip at the beginning of the next encounter.

moebius92 12-09-2012 10:37 PM

If I were a clever sort of person (and not horribly lazy), I might ask what generates the fervour. And then having asked that, I'd look at the start time of the Champion's Fervour effect, and then use that as the starting point, instead of the start of combat.

That is to say, what I expect happens is, once Champion's Fervour is started, every four seconds, it checks if the champ is in combat, and if they are, it adds a point of fervour.

I'd suspect this, primarily because that's the way I expect Red Haze works - once the Red Haze effect goes actives, every 15 seconds after its start time, it adds another point of fervour. And if you've got one method of generating fervour on a timed interval using an effect... why use something different for the stance?

I'd also suspect this, because I just checked it, and yes, it works the way I thought it does.

Mohrrin 12-09-2012 10:44 PM

I actually figured that out, also. I think I spent a little more time than necessary, but I eventually arrived to the activation of fervor stance (unfortunately for me, it was the last thing I tried, but I suppose I did learn a lot about how the game works, so that should be useful in the future).

I've been working on gathering empirical data now to find an appropriate constant for the time intervals to display the pips. I think I am almost finished with this plugin, and will post the finished product once it is completed.

Mohrrin 12-21-2012 09:17 PM

1 Attachment(s)
Just posting this so that I can get some feedback on the timer mechanic. Having issues when a player loses focus on the client -- it causes the metronome to get thrown off.

moebius92 12-23-2012 01:02 AM

I should start by noting that between the time I've spent investigating when fervour pips get generated and looking at your code, we're talking about ten minutes tops, and so I am speaking from a position of ignorance...

That said, have you tried getting the start time of the Champion's Fervour effect, and then using the current time to calculate how soon the next pip is going to occur? It should be something like:

(4 - ((Turbine.Engine.GetGameTime() - startTime) % 4))

(Turbine.Engine.GetGameTime() - startTime) will give you the total elapsed time since the effect started. (_ % 4) will give you how far into the current 4 second interval you are, and (4 - _) will give you the amount of time left in the current 4 second interval.

Since it doesn't depend on Update() to keep a timer running, Update() not firing won't affect the code.


All times are GMT -5. The time now is 05:47 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI