| 04-12-2006, 07:01 AM | #1 |
Hi peoples Its possible to detect when a unit is under attack and is in attack? If yes can give some examples plz? tnx in advance |
| 04-12-2006, 09:22 AM | #2 |
Hello, and welcome to Wc3Campaigns! :) I am not totally sure about what you mean, maybe you could elaborate a bit? |
| 04-12-2006, 10:00 AM | #3 |
tnx man i try to make a stealthfrom rogue i want to make a trigger type this: if "unit" is combat have "example ability" if isnt in combat have " second example ability" |
| 04-12-2006, 01:42 PM | #4 |
You mean somthing like this? If unit is being attacked then give it ability 1 If unit is not being attacked give it ability 2 |
| 04-12-2006, 03:43 PM | #5 |
Yes and if is possibile, if he attack give it ability 2 |
| 04-12-2006, 04:12 PM | #6 |
You'll need loops for that, Blade can explain better. |
| 04-12-2006, 07:42 PM | #7 |
The easiest thing would just be to save the old life in a variable in the start of the loop, and then check a while later if the life has increased or decreased. If it has decreased, the unit is most likely under attack and you can add the ability. |
| 04-12-2006, 08:02 PM | #8 |
oky can you give 1 example trigger plz? (for not go in wrong mode :P) tnx for your help peoples |
| 04-12-2006, 08:28 PM | #9 |
the var at the begin and check at the end doesnt work if the animation damage step is different for each unit that is attacking so you would want to set it all the same or below a certain number you can check after |
| 04-13-2006, 04:34 PM | #11 |
You have it run the code every .10 seconds (which could possibly lead to lag), and as far as I know, the events work as an "or" statement meaning: Every .10 seconds -or- If a unit is attacked, try removing the periodic event, because that has no values which could lead to further map errors. |
