| 09-01-2003, 06:22 PM | #1 |
I've got this little trigger that I am using in my game to resurrect a fallen hero. It goes something like this... Event Unit - A unit Dies Condition Dying unit is A Hero = True Action Set (variable) = Hero Level of Triggering Unit x 3 If (variable) > 30, then set (variable) = 30 Game - Display to Player(owner of Triggering Unit "Your hero has died, and will resurrect in (variable) seconds" Wait (real(variable)) game seconds Hero - Instantly revive Triggering Unit at Center of (Location) Hero - Enable experience gain for (Triggering Unit) Camera - Pan camera for owner of Triggering Unit to position of triggering unit. If, then, multiple conditions [This If/Then handles the event that a resurrected hero's player left the game during the time it was waiting to respawn. It reassigns the hero to one of the former owner's allies] Okay, now here's the problem. The trigger works fine in the overwhelming majority of situations. I've played many dozens of games, with many dozens of hero respawns in the game (potentially hundreds of respawns), but on 3 different occasions, a hero didn't respawn. Never ever. It didnt happen to me, so I couldnt see if the "Your hero will respawn in n seconds" text came up, even in the replay, because it wasn't my hero. I am planning on adding a global text message to possibly help find out when the breakdown is happening (before or after the wait). But in the meantime, I thought I'd ask around to see if anyone has experienced something similar. |
| 09-01-2003, 07:50 PM | #2 |
I had a case where I had 30 heroes killed off at once, and with a similiar res trigger, only like 12 of them made it. It might have to do with how many trigger is allowed to run at once. Because if I took out the wait statement they all ressed fine. I tried adding them to a queue, but anything longer than a few seconds on the wait and it'll run into trouble with a large amount of triggers running (that also have waits). |
| 09-01-2003, 08:07 PM | #3 |
An alternative to using the Wait command would be to have a periodic event every 3 seconds. Have an integer array with 12 positions (or however many heros there can be). When a hero dies, set his integer to his level. The "Every 3.00 seconds" trigger subtracts 1 from the hero's integer, and if the integer is 0 it revives him. |
| 09-01-2003, 09:38 PM | #4 |
Thanks for the insight. I had a feeling it was due entirely to the wait. I might end up resurrecting the hero right away, and having the res'd hero just remain "paused" until the time out is up. It would also remove the need for the "if controller has left" code, as the hero would almost always instantly revive, and be turned over to the new owner. And I really like Panto's idea, but it feels a little bit like killing a fly with a bazooka. I'll see if I can come up with some other way of doing things, and if all else fails, that should definately work. At the very least, this idea deserves credit for thinking outside the box. Thank you for your help. |
| 09-02-2003, 04:43 AM | #5 | |
Quote:
I think that's the nicest thing anyone has said all day. :thrust: |
| 09-10-2003, 06:54 PM | #6 |
Hey, I know this thread is old news, but I wanted to add some info. First off, Panto, apparently you sometimes need a bazooka to kill the fly. All other options I tried really didn't cut it. I followed your advice, set up an array for the hero units themselves, and a second array for the countdowns for the heroes. Thank you for your idea, it really saved my sanity. That having been said, it worked...mostly. From time to time, heroes still weren't respawning. I added a debug command so I can see what was happening, and what I found surprised me. One of my conditions was "If hero is alive, do nothing". This was what was ruining it. There is a bug in Warcraft 3 where, sometimes, dead heroes are still considered to be alive by whatever evaluation that boolean does. SO BE WARNED mapmakers, that this boolean evaluation is broken. I will be writing to blizzard to see what is going on, and I'll post here with their response. |
| 09-11-2003, 02:45 AM | #7 |
It is important, in such situations, to have as many kinds of bazooka at hand as possible. I'm glad you got your solution. It's clear to me that your own hard work and willingness to sort out the problems logically is what led you to fix the problem. |
