Check how the timer is being handled and also what the codes inside look alike and check if you've done something wierd. If you need further help I suggest post relevant code to your issue, so we can address it better.
|
I seem to have an issue with my Cycle Events. I do have the modified Cycle Event Handler btw. Ok anyways here is the problem. I have setup an earning potential system for players in the wilderness. Tje problem though is that after every (cycle?) The timers seem to count down faster and faster. For example: The timer takes roughly about 3 minutes to complete and give the player some earning potential. However, the next time the timer reaches the said amount, it has happened much faster than the first time, as it takes no where near that 3 minutes. This continues to happen and every time its faster than the time before. Sorry if this is hard to understand it's just really hard for me to explain. I also use cycle events for my overloads, and the same issues happen. After the first time the overload wears off after 5 minutes, and seems to work perfectly, but then the next does doesn't last as long, and the one after that even less, and so on and so forth. Does anyone know what causes this, or where I could look to sort this out?
Check how the timer is being handled and also what the codes inside look alike and check if you've done something wierd. If you need further help I suggest post relevant code to your issue, so we can address it better.
Alright. I still have not figured this out. but here is my code for it.
One thing I did tamper with though was theCode:public static void addEarningPotential(final Client c) { CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() { @Override public void execute(CycleEventContainer container) { if (!c.inWild() || c.inFunPk() || c == null) { container.stop(); return; } if (c.inWild()) { if (c.epTimer >= 2500) { if (c.earningPotential < 100) { c.earningPotential += 10; c.epTimer = 0; c.sendMessage("<img=1><shad=16718084>Your Earning Potential has increased! It is now at "+ c.earningPotential +"%!"); } else if (c.earningPotential > 90 && c.earningPotential < 100) { c.earningPotential = 100; c.sendMessage("<img=1><shad=16718084>Your Earning Potential is now at 100%!"); } else if (c.earningPotential >= 100) { c.earningPotential = 100; } c.epTimer = 0; } else { c.epTimer += 1; } } } @Override public void stop() { } }, 1); }Before it wasCode:c.epTimer +=1;That seemed to keep it a little better but the same thing does happen just after a longer period of time.Code:c.epTimer++;
I do not recommend using 1 ms but rather 600ms since that's rs timing. Then add it respective like 4 or 5 ticks to the time. TEst and see if that'll help better or if it's still the same issue.
Code:public static void addEarningPotential(final Client c) { CycleEventHandler.getSingleton().addEvent(c, new CycleEvent() { @Override public void execute(CycleEventContainer container) { if (!c.inWild() || c.inFunPk() || c == null) { container.stop(); return; } if (c.inWild()) { if (c.epTimer >= 4) { if (c.earningPotential < 100) { c.earningPotential += 10; c.epTimer = 0; c.sendMessage("<img=1><shad=16718084>Your Earning Potential has increased! It is now at "+ c.earningPotential +"%!"); } else if (c.earningPotential > 90 && c.earningPotential < 100) { c.earningPotential = 100; c.sendMessage("<img=1><shad=16718084>Your Earning Potential is now at 100%!"); } else if (c.earningPotential >= 100) { c.earningPotential = 100; } System.out.print("pass time = "+c.epTimer); c.epTimer = 0; } else { c.epTimer += 1; } } } @Override public void stop() { } }, 600); }
Ah yes will try this lol. Completely forgot about that.
Edit: This code seems to be working better. However there are still times when the timer goes faster, and then the next time doesn't seem to go as fast. I'm not sure if it's just me or not but this is working a lot better. If you have any other suggestions please let me know.
Last edited by Project-Divine; 06-20-2015 at 04:04 AM. Reason: More information
The event is started when a player enters the wilderness, One thing I've noticed now after testing it out more is that sometimes the timer will reach said amount twice in rapid succession. And then it will carry on as normal for a couple of cycles and do it again. All while the timer still seems to be going faster and faster again. It must be something just wrong with the cycle events lol.. Any ideas?
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |