| 12-30-2003, 07:49 PM | #1 |
I've been trying to get this trigger to work properly, but a small issue arose in the process. It involves opening and closing gates by units using certain abilities. Firstly, the unit I used was an Acolyte with the unit model of a Lever-destructible. Then I made two custom abilities based off different skills (1 based on roar, the other based on warstomp) and named them Open Gate, Close Gate, respectively. I gave the Lever these abilities. Now... The specified gate is supposed to open and close depending on which ability the Lever uses. Event - A unit casts an ability Condition - Ability being cast Equal to [Open Gate] Actions - If Destructible [Iron Gate 0021] is Alive Equal to True and If Casting unit Equal to [Lever 0044] then do Open [Iron Gate 0021] On a test run the trigger runs perfectly fine, until I try to close it. The map does not seem to detect the gate as being the same once it is open, it is as if the gate was Dead. Here's my trigger for closing it: Event - A unit casts an ability Condition - Ability being cast Equal to [Close Gate] Actions - If Destructible [Iron Gate 0021] is Alive Equal to True and If Casting unit Equal to [Lever 0044] then do Close [Iron Gate 0021] It does NOT close. But when I change the Action by using - If Casting unit Equal to [Lever 0044] then do Close [Iron Gate 0021] Voila! It closes! And another strange thing, I attacked the gate a few times before opening it, so a bit of it's HP went down the bar. I opened the gate, closed it, and it's HP was full again! Is there a way I can Open and Close the gate with the same HP's assuming the Gate was still alive? |
| 12-30-2003, 08:02 PM | #2 |
The problem you're facing is that gates are considered dead while open. |
| 12-30-2003, 08:04 PM | #3 |
For your first problem, I don't see why it matters if the gate is alive or not, since I'm pretty sure a trigger can't open and close a destroyed gate. If you need to though, you could just make a boolean variable (or something) like "GateIsAlive" and set it's initial value to True. And if the gate dies set it to False (is there even boolean variables?? I've never used one hehe. You could use a string or integer variable or something else like that though.) For the second one I'm just not sure, you may have to replace the gate with relative hp/mana of the previous gate whenever it's opened/closed. |
| 12-30-2003, 08:09 PM | #4 | |
Quote:
Gates opening also cause the event "Destructable Dies" to go off. I've worked with this before. What you have to do is make variables (would be best as an array) to keep track of whether the gate is open or not. Right before you open a gate set it to true, so that you know its open and not destroyed. When a gate opens it also loses HP data, so you'll have to store that in a variable before it opens as well, and reset it when it closes. |
| 12-30-2003, 08:40 PM | #5 |
I tried as you suggested Pheerbo, it works great, just needs more work than I would like. What I did was use an integer array that kept track of the gate's life before it opened, and when the gate closed I would use the integer variable to reset the gate's life back to the way it was. I also added a condition that checked if the gate's life was greater than 0, so it could only open if it is alive. Thanks alot. |
