Timer help

For questions about using Classic.

Post » Wed Dec 28, 2011 2:16 am

I'm making a game which runs in real-time and not turn-based. With the help of this community and the S plugin I've managed to finish the guts of a semi-complicated ability system (yay, thanks!) but ran into an issue in putting finishing touches on it. I need to create a cast time for each ability. Each character and NPC can use one ability at a time that takes some pre-set time to use. I was wondering what the most accurate way to implement this would be.

I've read about issues with frame-rate and timers, which I would like to avoid. In addition, I read that using the timer behavior can cause issues when dealing with multiple instances of an object, or something of that nature, and that "Every X" command botches picking.

Not sure what other issues there are, but what would be the best way to implement a cast-time when an ability is used so that:

1. The timer is as accurate as possible since it will be necessary for balancing issues
2. The timer avoids known bugs
3. The timer preserves the real-time nature of the game so that other events can run freely while the timer counts down.
4. The timer works with instances of the same object.

Thanks for your input :)Juryiel2011-12-28 03:39:04
B
11
S
2
G
3
Posts: 283
Reputation: 1,968

Post » Wed Dec 28, 2011 3:57 am

The timer behavior works fine. "on timer" is a triggered event, so it will be evaluated out of order of the rest of the event sheet. You also can't see how much time is left on the timer.

You can also use a variable. Set it to the number of seconds you want and subtract TimeDelta from it every tick. The timer is done when it's less than or equal to 0. The main advantage this has over the behavior is you can see how much time is left.

The only inaccurate way is using "every x milliseconds" to decrement a timer when x is close to 1000*TimeDelta.
B
79
S
24
G
54
Posts: 4,755
Reputation: 40,773

Post » Wed Dec 28, 2011 4:02 am

I see, thanks for the input, sounds like I need to use a variable as you mentioned because I do need to see how much time is left. Thanks!
B
11
S
2
G
3
Posts: 283
Reputation: 1,968


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests