I know how to do this with triggers, but it's a bit messy (especially with lots of them, you need a very large array to keep track). Besides, I need to learn more about the data editor and thought this would be a good exercise. What I want to do is this: When an Archon is created, give it a timed life (let's say 90 seconds) after which it will turn back into the original units that created it (so if it was 2 dark templars, you'd get back 2 dark templars, but if it was 2 high templars you'd get that, or 1 of each) It's not necessary to restore their original health/shields/energy, but if that's relatively easy it'd be cool, too.
So, any ideas on how to go about doing this? All I've managed to do so far is give the archon a timed life, but it dies at the end.
That is actually pretty easy. When the archon spawns, give him a custom behavior (call it ArchonLifetime or something like that). Set it to the duration you want the archon to live, and put a new "set" effect on the behavior's "Effect - expire" field. The set will have two effects. The first is a suicide effect that will kill the archon. The editor has one of these built in (I'm pretty sure it's just called suicide). The second effect will be a Spawn effect, which you can edit to have it spawn two templars.
If you want to allow the same mix of HT/DT to be there after the despawn as before it, you'll have to make a separate behavior for each combination (3 of them) and 2 additional copies of the merge ability. For example, you'd have one merge ability for HT+HT, one for DT+DT, and one for HT+DT, with behaviors to match.
The last step (which you don't need) is to make it look pretty. Actors do this, but they're complicated if you're new to the data editor, so I suggest starting with what I said above, then checking an actor tutorial if you want to go further.
Ah, thanks. I have some experience with actors (mostly with Morph abilities and changing which animation plays for which ability), I've just never done much with behaviors before. I'll go give that a try.
The trigger thing was getting pretty difficult. Every time an Archon spawns I was storing it in an array, then I had another array that was either 1 (meaning HT+HT) 2 (DT+DT) or 3 (1 of each) and a third array to hold a timer for each of them. Then it ran into issues if you give a Merge order but one of the templars died before merging, or if the merging Archon was killed before it finished...
What you suggest sounds simple enough. I'll attach the results later.
Okay, I've run into a problem. I made 2 more copies of the Archon Warp ability, called one Dark Archon Warp and one Hybrid Archon Warp. High Templars have the High and Hybrid abilities, while Dark Templars have the Dark and Hybrid abilities. (see attached file)
Here's the problem I'm having: If I have the buttons separated on the command card like they are in the file, then...
2 High Templars can use either High or Hybrid warp (should only be able to use High)
2 Dark Templars can use either Dark or Hybrid warp (should only be able to use Dark)
1 HT + 1 DT can only use Hybrid (the way it should be)
The only solution I've found is to hide the button for the hybrid warp under the other High/Dark button, but this means that 1 HT + 1 DT can't merge at all, because the disabled button is still on top.
I've tried making a new Requirement that would hide the button, but haven't been able to find a way to say "2 High Templar are selected"
I know how to do this with triggers, but it's a bit messy (especially with lots of them, you need a very large array to keep track). Besides, I need to learn more about the data editor and thought this would be a good exercise. What I want to do is this: When an Archon is created, give it a timed life (let's say 90 seconds) after which it will turn back into the original units that created it (so if it was 2 dark templars, you'd get back 2 dark templars, but if it was 2 high templars you'd get that, or 1 of each) It's not necessary to restore their original health/shields/energy, but if that's relatively easy it'd be cool, too.
So, any ideas on how to go about doing this? All I've managed to do so far is give the archon a timed life, but it dies at the end.
@dgh64: Go
That is actually pretty easy. When the archon spawns, give him a custom behavior (call it ArchonLifetime or something like that). Set it to the duration you want the archon to live, and put a new "set" effect on the behavior's "Effect - expire" field. The set will have two effects. The first is a suicide effect that will kill the archon. The editor has one of these built in (I'm pretty sure it's just called suicide). The second effect will be a Spawn effect, which you can edit to have it spawn two templars.
If you want to allow the same mix of HT/DT to be there after the despawn as before it, you'll have to make a separate behavior for each combination (3 of them) and 2 additional copies of the merge ability. For example, you'd have one merge ability for HT+HT, one for DT+DT, and one for HT+DT, with behaviors to match.
The last step (which you don't need) is to make it look pretty. Actors do this, but they're complicated if you're new to the data editor, so I suggest starting with what I said above, then checking an actor tutorial if you want to go further.
Ah, thanks. I have some experience with actors (mostly with Morph abilities and changing which animation plays for which ability), I've just never done much with behaviors before. I'll go give that a try.
The trigger thing was getting pretty difficult. Every time an Archon spawns I was storing it in an array, then I had another array that was either 1 (meaning HT+HT) 2 (DT+DT) or 3 (1 of each) and a third array to hold a timer for each of them. Then it ran into issues if you give a Merge order but one of the templars died before merging, or if the merging Archon was killed before it finished...
What you suggest sounds simple enough. I'll attach the results later.
Okay, I've run into a problem. I made 2 more copies of the Archon Warp ability, called one Dark Archon Warp and one Hybrid Archon Warp. High Templars have the High and Hybrid abilities, while Dark Templars have the Dark and Hybrid abilities. (see attached file)
Here's the problem I'm having: If I have the buttons separated on the command card like they are in the file, then...
2 High Templars can use either High or Hybrid warp (should only be able to use High)
2 Dark Templars can use either Dark or Hybrid warp (should only be able to use Dark)
1 HT + 1 DT can only use Hybrid (the way it should be)
The only solution I've found is to hide the button for the hybrid warp under the other High/Dark button, but this means that 1 HT + 1 DT can't merge at all, because the disabled button is still on top.
I've tried making a new Requirement that would hide the button, but haven't been able to find a way to say "2 High Templar are selected"