| 07-01-2004, 12:01 AM | #1 |
Hey people, I'm having a little trouble with some floating text. I have a map with units that respawn every 30 seconds, after you killed them that is. That part works perfectly and all but i wanted to have some floating text to count down. Like first 30 seconds until revival 29 seconds until revival 28 seconds until revival And so on... I have no problem when I'm delaing with just one death, but as soon as i kill another unit during theese seconds, I'm fucked. The whole thing becomes a mess, i've managed to clean it up a bit and what's happening now is that when i kill a new unit this happens: The other counters stop and the one counting counts too fast, if theres 3 counters active it counts 4 seconds and if there two it counts 3. So, i believe there is a good way to deal with this and mine isn't. Here's the code: DiesMessage Events Unit - A unit owned by Neutral Hostile Dies Conditions Actions Custom script: local texttag countdown Custom script: local integer unittime For each (Integer A) from 1 to 30, do (Actions) Loop - Actions Floating Text - Create floating text that reads ((Revive in: + (String(unittime))) + Seconds) at (Position of (Dying unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency Set unittime = (unittime - 1) Set countdown = (Last created floating text) Wait 1.00 seconds Floating Text - Destroy countdown Please, help me out! |
| 07-01-2004, 01:30 AM | #2 |
Your problem is that your not prefacing your locals overriding global with udg_ however, that won't help you because you have two locals. Get rid of unit time as it does nothing. And you'll be fine. Except your leaking a location and floating text lasts 5 seconds before they get hidden and your destroying it after 1. |
| 07-01-2004, 10:17 AM | #3 |
Ops, seems like i forgot about udg_ Well, no unittime you say? Bah, pain to manually set the floating text messages, and then i can't use a loop. Or do you know a better solution? |
| 07-01-2004, 03:06 PM | #4 |
30-Integer A value. Should get you the time. |
| 07-01-2004, 09:17 PM | #5 |
I tried that and i also tried doing get time left on countdown timer but it still refuses to work... It continues to stop and count incorrectly. Thanks anyways, i cant give you rep since my IE is fucked, sry =)( |
| 07-01-2004, 09:28 PM | #6 |
Well, you have a wait inside a loop, isn't that kind of on the "do not do" list? |
| 07-01-2004, 10:13 PM | #7 |
Yea, i've heard so too but... Well, i've given up on the floating text, I'll do something else. |
| 07-02-2004, 01:57 PM | #8 |
Nah, just do this: Write the complete trigger using two local variable hacks like you were doing originally. Then when it's finished in theory, convert it to custom text, and rename your local variables and replace all usages of it in the trigger with the correct name. ~Cubasis |
