HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Alternative to Unit attacked event

03-18-2009, 01:22 PM#1
0zyx0
In my map, I have a hero which has a passive ability that gives the hero a chance to curse his targets when he attacks. To trigger this, I am using the "Unit is attacked" event. This is very inefficient, because there can be hundreds of attacks going on at the same time in my map. Is there any way to do it in a better way?

EDIT:
I have a different problem now, look at my latest post.

EDIT AGAIN:
I do now have yet another problem, described at my last post.
03-18-2009, 01:32 PM#2
DioD
You can decrease number of attack events.

Make longer attack countdowns and swap less units.
03-18-2009, 07:45 PM#3
cosmicat
There are other problems with the "Unit is attacked" event - it fires even if the attacking unit doesn't actually attack (it doesn't wait for the damage; it's triggered when the attacking unit starts its attack animation).

If the curse is based entirely on another ability (like Banshee curse or something), the easiest way to cast it whenever the hero attacks is to give him Orb of Lightning (new). Give the hero a dummy "tooltip ability" (a passive that doesn't do anything, e.g. Endurance Aura with no buffs and no bonuses) and set up a trigger to give the hero your modified Orb of Lightning when the dummy ability is learned (Orb of Lightning has no icon) and make another trigger that levels up Orb of Lightning when your dummy spell is learned. Make as many versions of Curse as there are levels in your ability, and set up the Orb ability to cast Curse when it hits.

If you want this ability to work without Orb effects, there's a way, but it's even less efficient than your current plan.
03-18-2009, 09:46 PM#4
0zyx0
EDIT: What I posted here earlier didn't work at all.
03-18-2009, 10:09 PM#5
cosmicat
Are you sure the hero can't curse everything in range by targeting every unit and canceling before the attack actually goes through? (e.g. spam Stop command)
03-23-2009, 03:50 PM#6
0zyx0
I could use something based on orb of lightning, but that wouldn't stack with other orb effects. Is there any way to detect when an orb of lightning-based ability goes off?
03-23-2009, 04:12 PM#7
Blacktastic
Why not just use a coniditon of Unit Has Ability or Level of Ability for Unit so only those attacks get considered?

I mean if you don't want to use is attacked, you either use a damage detection engine or you use orbs.
03-23-2009, 04:34 PM#8
Rising_Dusk
Don't worry so much about events firing. It won't make a noticeable difference in your map. What you want to do, though, is what Blacktastic suggests - use conditions to limit the triggeractions that run. Those are the things that can slow down games, especially in your case with dummy spell casting.
03-23-2009, 04:37 PM#9
Kyrbi0
So if you're using conditions as you suggest, would it be better to use as many as possible to narrow it down (likely only 2, unit-type and "level of ability = 1"), or is 1 sufficient?
03-23-2009, 07:52 PM#10
0zyx0
Thank you all for your help! But how do I avoid the problem mentioned by cosmicat? Or don't I have to do anything at all about it?
03-23-2009, 08:19 PM#11
Bobo_The_Kodo
You don't use the 'a unit is attacked' event
03-23-2009, 08:28 PM#12
Kyrbi0
Wait, why not?
03-23-2009, 10:06 PM#13
Blacktastic
If you want to avoid the issue cosmic stated, you either use an orb or damage detection.

There is no other option.
03-24-2009, 03:22 AM#14
Kyrbi0
Oh, I know that. I was referring to Bobo_the_Kodo's comment, that you just "don't" (which I'd disagree with).
03-24-2009, 03:40 AM#15
Bobo_The_Kodo
You disagree that 'a unit is attacked' event procs when the unit starts damage point instead of ends damage point?