HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Enlighten me on attackdetect

08-26-2007, 08:37 AM#1
Lordy
Hey,

in my map there is 1 hero for which I need to differentiate between attacks and dmg from other sources. Naturaly, I downloaded the attack detect system =)
I looked at it and saw it uses a frost orb ability to add a buff to the attacked unit when when it takes damage from an attack.
Okay, that sounds easy. But if detecting an attack is as simple as detecting and then removing a dummy buff, what is the system for then?
Also the system says it has some problems: "You can't use orb or arrow abilities in your map" Why not exactly? I have no experience using orbs. Can't you give a unit 2 orb abilities?
It also says "you can't damage a unit the instant it is damaged" why not?
08-26-2007, 08:38 AM#2
darkwulfv
Well, to describe the orbs:

Orbs almost NEVER stack. It would, therefore, mess up either the system or your orbs.
08-26-2007, 09:05 AM#3
Pyrogasm
The system recycles triggers so that you don't leak events like you would using emjlr3's AttackDetect sample.
Quote:
Originally Posted by Lordy
It also says "you can't damage a unit the instant it is damaged" why not?
It creates an infinite loop if you do and it has to do with the way detecting it works.
08-26-2007, 05:34 PM#4
emjlr3
leak events?

did not know they leaked
08-26-2007, 05:36 PM#5
Rising_Dusk
Quote:
Orbs almost NEVER stack. It would, therefore, mess up either the system or your orbs.
Orbs are the most efficient and most accurate method to achieve any attack detection system. Period. To be fair, I use slow poison for all of mine.
08-26-2007, 06:18 PM#6
Vexorian
you can't recycle triggers...
08-26-2007, 09:58 PM#7
Pyrogasm
I didn't mean "recycle" literally.

I mean that it uses 1 trigger for each unit and simply destroys that trigger when the unit no longer exists (dies).

And yes, emjlr3, by continually adding events to a trigger that register when a specific unit takes damage you're leaking them when those units no longer exist. You could eventually end up with a trigger that had 1,000 events, but only 25 of them will ever fire because the units don't exist anymore.
08-26-2007, 11:25 PM#8
emjlr3
how does that pertain the alternate A.D.S. I made?
08-27-2007, 12:04 AM#9
Pyrogasm
Quote:
Originally Posted by emjlr3
how does that pertain the alternate A.D.S. I made?
Yours leaked events... didn't it?

Maybe that was Shadow1500's sample of showing damage as floating text.
08-27-2007, 12:39 AM#10
Rising_Dusk
Quote:
Seriously? Aren't all your abilities triggered? If they aren't then sure, orbs are OK.
Hunh? I use an orb effect with the EVENT_UNIT_DAMAGED trigger and then detect the presence of the buff from the orb. If the buff is there, then the damage dealt was from an attack. So even though it's triggered, it's still based on the principle of orb effects. Maybe you misread what I posted or maybe I wasn't clear enough. No worries. :p
08-27-2007, 01:42 AM#11
Rising_Dusk
Quote:
That's why I asked whether all your abilities were triggered or not
Nah, not all of them are triggered. I do know what you mean now though. It's actually how I do it in my dungeon crawler map. If everything is triggered, you can make your own physical/magickal detection quite easily. This is also how I imagine you'll achieve it in O. Also, if you control all damage via triggers, makes things like your spell criticals and attribute-based damage stuff easy too. Good stuff.
08-27-2007, 01:37 PM#12
cohadar
Quote:
Originally Posted by Pyrogasm
I didn't mean "recycle" literally.

I mean that it uses 1 trigger for each unit and simply destroys that trigger when the unit no longer exists (dies).

And yes, emjlr3, by continually adding events to a trigger that register when a specific unit takes damage you're leaking them when those units no longer exist. You could eventually end up with a trigger that had 1,000 events, but only 25 of them will ever fire because the units don't exist anymore.

Too bad we don't have TriggerRemoveEvent...
But who knows maybe unit events are recycled when unit is removed?
Did anyone try to test this?

So let me get a couple of things strait here.
In order to do on attack detection I have to register EVENT_UNIT_DAMAGED
to every unit on the map, and then have an orb effect on every hero (with low duration I guess)
to actually see if unit is damaged with an attack? Is that all?

Is there any way to avoid that event "leak" thing?
Is there any limit to how low that orb effect duration can be?
08-27-2007, 01:50 PM#13
Rising_Dusk
Quote:
Too bad we don't have TriggerRemoveEvent...
Actually, we do in a way.
Collapse JASS:
native ResetTrigger     takes trigger whichTrigger returns nothing

It's an interesting function and I've put it to the test a lot in finding ways to have to create fewer triggers. I've managed to find that it can cause handle indexing failures, which screws cache users, but can still make it useful for other array/struct/etc. driven maps.
08-27-2007, 04:40 PM#14
emjlr3
u only need .01 of an orb effect to register it, which is the lowest you can make it

as far as these trigger events stacking up....a dynamic trigger for each unit works, just remove it when the unit is done, or just add units to one trigger, and every x seconds create a a new trigger, grab all units, register new ones, etc., if you are really that worried and want to use 1 trigger

in anycase, 1 trigger/unit is far from bad, and it is in use on a td map I am working on ATM, which will have a good bit more units at a time then most any other map there is, other then like LOTR or something, with no slowdown/bad stuff/etc.

btw this is the first time I have heard of an "event leak", and it being a big deal
08-27-2007, 04:59 PM#15
cohadar
Can I by any chance get that trigger of yours?

I looked at that demo map but it uses too many support libraries that I don't use
and it would be silly to include them just so I could use on_attack.

I could write it myself ofc, but if you already have a good solution I would like to use it.

I am worried about that event stuff because I have a survival map,
and around 50,000 units passes through it in a game......