• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Need a multistabile timer for stunning effect trigger. (GUI)

Status
Not open for further replies.
Level 3
Joined
Mar 22, 2010
Messages
40
Hi there.. Im needing help with a timer...

What i need:

A timer that goes on when triggered by a event that can be multi triggered... And i dont want all to get triggered by same.. like this:

If a unit gets hit then start timer... when timer expire then do action

But i dont want that to affekt other units if they gets hitter second after... then i want those units to accully have a timer so they get action as well in correct time.

Ok to explain this i have this:

Event
unit gets attacked
Action
Pause unit
Create a stun effekt on unit
< i need a timer here that would go for eatch and one unit that gets attacked. not that all gets unpused same time... but with their eatch 2 sec time or so... >
Unpause unit


Its for a td... and i got dmg detection system... so its event unit gets dmgaged.

Please help? :p
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
There is an edit button for altering your messages...

The principle is simply. You create a new timer and then start the timer with a certain time out and get it to run your expiry function.

The expiry function can get the timer which expied (GetExpiredTimer). You can then destroy the timer and thus prevent a leak.

Additionally you can also recycle timers, which is even better at preventing leaks as it does not load memory allocation and deallocation at all. You get many systems to do this and all you do is deposit timers to them (via a call) when you want to get rid of them and then instead of creating new timers, simply ask for one from the system.

To pass values along with the timer, you can eithor use an array index sytem and encode the index onto the timeout in a meaningless small number (so as not to alter duration) or you can use hashtables to store it to the timer (this is possible in GUI).
 
Level 3
Joined
Mar 22, 2010
Messages
40
Sorry but im soo lost... via call? and encode index onto the timer with number? and i dont know how to use hashtables xD...

Can you PLEASE write down the trigger? :S

I might understand better then, just a example plzz?
 
Status
Not open for further replies.
Top