Has anyone used the "Last Attacker" action before and got it to work? It always returns blank for and seems like it doesn't work correctly.
Does it only work in a specific event type?
Yes it does, you'll need a triggering unit that has been attacked.
If any unit gets attacked by an ability thats leaves an effect that adds a specific behaviour:
Unit - Any Unit attribute points changed
Local Variables
Conditions
((Triggering unit) has "behaviour") == true
Actions
Unit - Kill "last attacker"
Ahh okay, so it doesn't work for the normal generic attack command that
doesn't add any behaviors etc?
I ended up just storing the last attacker in a global, couldn't find any
other way to get the last attacker :(
You dont need a condition that ws just an example. If you leave out the condition, any unit (watch the event!) that attacks gets killed according to that previous trigger. You can adjust the condition and action to your will.
But only certain events will give you a last attacker e.g. 'unit dies' 'unit property changes' 'unit uses ability'
If an event gives you a 'triggering unit' you can get the 'last attacker'.
Yeah, what I'm doing appears like it should be simple, but I haven't figure out any other way to get it to work.
Basically I have heroes, and when one "dies" I need to find out who did the killing blow. The problem is I'm using a system similar to the revival system used in the campaign.
This basically means the hero never dies, so you can't use that event. Also it's done via a behiavior which hooks into the combat response, and I haven't found any way of referencing the unit that caused the damage, resulting in the combat response firing.
It's easy to test, pick any unit, create a behavior for it, edit the combat response field and tick "Fatal". This will stop the unit from dying and allows you to handle what happens on a fatal blow.
Unfortunately doing this also stops the "fatal" damage that you can refer to in triggers.
This basically means the hero never dies, so you can't use that event.
Also it's done via a behiavior which hooks into the combat response, and
I haven't found any way of referencing the unit that caused the damage,
resulting in the combat response firing.
<</quote>>
Well you can test the condition i used earlier.
Events
Unit - Any Unit is revived
or
Unit - Any Unit Enters (respawn area)
or
Unit - Any Unit is being removed from the game
try to get an event that doesnt put too much stress on the game (not any unit takes damage for instance)
Local Variables
Conditions
((Triggering unit) behavior 1) == iamdeadbehaviour
Actions
Variable - Set Player #[(owner of (last attacker))]][0] = Player #[(owner of (last attacker))][+ 1]
(i dont know if you want to save it in an integer array like this or load it into a data table)
The only thing that could obstruct this trigger is that the hero that died, is attacked after he 'dies'.
Unit - Any Unit Enters (respawn area) and Unit - Any Unit is being removed from the game aren't really any use because I need to be able to detect that they have been made unconscious to begin with. Since there is no event for behaviors being applied you can only do this in roundabout way.
When does a unit is revived fire? I assumed this was after a unit gets back up, back I guess it could fire when they actually take the kiling blow since the combat response is stopping them from dying.
<<quote>>Unit - Any Unit Enters (respawn area) and Unit - Any Unit is being
removed from the game aren't really any use because I need to be able to
detect that they have been made unconscious to begin with. Since there
is no event for behaviors being applied you can only do this in
roundabout way.
When does a unit is revived fire? I assumed this was after a unit gets
back up, back I guess it could fire when they actually take the kiling
blow since the combat response is stopping them from dying.<</quote>>
There is no event that fires specifically for a behaviour, thats why you use conditions to filter on the behaviour. Do you never use conditions?
To be honest, I haven't used revived myself.
Quote:
It's easy to test, pick any unit, create a behavior for it, edit the combat response field and tick "Fatal". This will stop the unit from dying and allows you to handle what happens on a fatal blow.
Who applies this behaviour? Target, Source Unit, Caster?
Of course I have used conditions, but that doesn't help when there is no suitable event.
The unit has the behavior to begin with, that's how it works.
Your hero has a behavior that stops them for dying,
This behavior can do an effect when the fatal blow occurs
You can use this effect to produce a damage dummy effect that causes 0 damage to your unit, this is the only way to detect it via a trigger afaik
The problem is that it appears to be the Hero itself that creates the dummy damage effect that lets you get the trigger, so there is no link back to the unit that did the fatal damage to your hero.
Of course I have used conditions, but that doesn't help when there is no
suitable event.
The unit has the behavior to begin with, that's how it works.
Your hero has a behavior that stops them for dying,
This behavior can do an effect when the fatal blow occurs
You can use this effect to produce a damage dummy effect that causes 0
damage to your unit, this is the only way to detect it via a trigger
afaik
The problem is that it appears to be the Hero itself that creates the
dummy damage effect that lets you get the trigger, so there is no link
back to the unit that did the fatal damage to your hero.
<</quote>>
So the behaviour is passive and will give you an effect.
The real problem will be finding a good Event (with or without a condition).
Maybe you could give this one a shot?
Untitled Trigger 001
Events
Unit - Any Unit specialization progress is Completed
Local Variables
Conditions
(Triggering progress effect) == dummy damage effect
Actions
Variable - Set Player #[(Owner of (Returns the unit who last attacked the specified unit (Triggering unit)))][0] = Player #[(Owner of (Triggering unit))][(+ (1))]
Yeah I think I've tried that one as well, the problem is Last Attacker
is always empty for some reason. Is it supposed to be a number?
<</quote>>
According to the trigger, it should return a specific unit.
So I've tested some different triggers, this is an example of a simple one:
Untitled Trigger 001
Events
Unit - Marauder [44.69, 29.75] is attacked
Actions
Unit - Kill (Returns the unit who last attacked the specified unit Marauder [44.69, 29.75])
And the action seems broken, or at least not useable for user players.
So we will have to look at a different trigger.
Further testing:
Events
Unit - Any Unit is attacked
Local Variables
Conditions
((Triggering unit) can create Sentry - Guardian Shield (Apply Behavior) on Sentry [42.17, 19.83]) == true
Actions
Unit - Kill (Attacking Unit)
If you use 'Attacking Unit' instead of 'Last Attacker' it will return the correct Unit. However, Attacking Unit really requires the 'Unit is Attacked' Event. This will trigger everytime a unit is attacked. You'll have to make good conditions to get it work correctly.
Yeah that's what I said earlier, and is basically what I'm doing. I have a trigger with Any Unit is Attacked and use that to store the player number of the last attacker.
Normally you would just use a unit takes fatal damage but it's not possible with this type of behavior.
Anyhow I've tested it out and Any unit is attacked with condition attacked unit is heroic seems to work okay, and doesn't seem to impact on performance - I don't really have any other choice anyway by the look of it.
<<reply 177900>>
"Thats what I said earlier"
Cant find where you said that
Anyhow, it triggers every time the unit is attacked, so also the "last time" the hero is attacked.
If you want to be more precise you could make an event for " 'Unit in Unit Group' (hero unit group) is attacked" or 'each hero' (in a unit array). That way it wont fire up that much. So if you want to be really sure that the last attacker is indeed the "killer", is the unit turned invulnerable when the effect occurs?
Because I guess the reason you're asking is because the trigger doesn't work well this way?
I have a bad feeling it's not going to change the situation though, since the effect is still spawned as a result of the damage response which only seems to reference the one unit and contains no reference to the damaging unit or anything else.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Has anyone used the "Last Attacker" action before and got it to work? It always returns blank for and seems like it doesn't work correctly.
Does it only work in a specific event type?
Yes it does, you'll need a triggering unit that has been attacked. If any unit gets attacked by an ability thats leaves an effect that adds a specific behaviour:
Unit - Any Unit attribute points changed Local Variables Conditions ((Triggering unit) has "behaviour") == true Actions Unit - Kill "last attacker"
Ahh okay, so it doesn't work for the normal generic attack command that doesn't add any behaviors etc?
I ended up just storing the last attacker in a global, couldn't find any other way to get the last attacker :(
You dont need a condition that ws just an example. If you leave out the condition, any unit (watch the event!) that attacks gets killed according to that previous trigger. You can adjust the condition and action to your will.
But only certain events will give you a last attacker e.g. 'unit dies' 'unit property changes' 'unit uses ability' If an event gives you a 'triggering unit' you can get the 'last attacker'.
I don't think this is the case, I've had events with triggering player but the last attacker was still empty.
Anyhow it's not going to be enough for what I want so i'll stick with recording it manually.
woops, did I write player? i meant UNIT. You need a unit that has been attacked, not a player.
What are you trying to do? Maybe there is another solution.
Yeah, what I'm doing appears like it should be simple, but I haven't figure out any other way to get it to work.
Basically I have heroes, and when one "dies" I need to find out who did the killing blow. The problem is I'm using a system similar to the revival system used in the campaign.
This basically means the hero never dies, so you can't use that event. Also it's done via a behiavior which hooks into the combat response, and I haven't found any way of referencing the unit that caused the damage, resulting in the combat response firing.
It's easy to test, pick any unit, create a behavior for it, edit the combat response field and tick "Fatal". This will stop the unit from dying and allows you to handle what happens on a fatal blow.
Unfortunately doing this also stops the "fatal" damage that you can refer to in triggers.
<<quote 177253>>
This basically means the hero never dies, so you can't use that event.
Also it's done via a behiavior which hooks into the combat response, and
I haven't found any way of referencing the unit that caused the damage,
resulting in the combat response firing.
<</quote>>
Well you can test the condition i used earlier.
Events
Unit - Any Unit is revived
or
Unit - Any Unit Enters (respawn area)
or
Unit - Any Unit is being removed from the game
try to get an event that doesnt put too much stress on the game (not any unit takes damage for instance)
Local Variables
Conditions
((Triggering unit) behavior 1) == iamdeadbehaviour
Actions
Variable - Set Player #[(owner of (last attacker))]][0] = Player #[(owner of (last attacker))][+ 1]
(i dont know if you want to save it in an integer array like this or load it into a data table)
The only thing that could obstruct this trigger is that the hero that died, is attacked after he 'dies'.
- double post, damn these forums get buggier every day
Unit - Any Unit Enters (respawn area) and Unit - Any Unit is being removed from the game aren't really any use because I need to be able to detect that they have been made unconscious to begin with. Since there is no event for behaviors being applied you can only do this in roundabout way.
When does a unit is revived fire? I assumed this was after a unit gets back up, back I guess it could fire when they actually take the kiling blow since the combat response is stopping them from dying.
<<quote>>
Unit - Any Unit Enters (respawn area) and Unit - Any Unit is beingremoved from the game aren't really any use because I need to be able to
detect that they have been made unconscious to begin with. Since there
is no event for behaviors being applied you can only do this in
roundabout way.
When does a unit is revived fire? I assumed this was after a unit gets
back up, back I guess it could fire when they actually take the kiling
blow since the combat response is stopping them from dying.<</quote>>
There is no event that fires specifically for a behaviour, thats why you use conditions to filter on the behaviour. Do you never use conditions?
To be honest, I haven't used revived myself.
Who applies this behaviour? Target, Source Unit, Caster?
Of course I have used conditions, but that doesn't help when there is no suitable event.
The unit has the behavior to begin with, that's how it works.
The problem is that it appears to be the Hero itself that creates the dummy damage effect that lets you get the trigger, so there is no link back to the unit that did the fatal damage to your hero.
<<quote 177297>>
Of course I have used conditions, but that doesn't help when there is no
suitable event.
The unit has the behavior to begin with, that's how it works.
Your hero has a behavior that stops them for dying,
This behavior can do an effect when the fatal blow occurs
You can use this effect to produce a damage dummy effect that causes 0
damage to your unit, this is the only way to detect it via a trigger
afaik
The problem is that it appears to be the Hero itself that creates the
dummy damage effect that lets you get the trigger, so there is no link
back to the unit that did the fatal damage to your hero.
<</quote>>
So the behaviour is passive and will give you an effect.
The real problem will be finding a good Event (with or without a condition).
Maybe you could give this one a shot?
Untitled Trigger 001
Events
Unit - Any Unit specialization progress is Completed
Local Variables
Conditions
(Triggering progress effect) == dummy damage effect
Actions
Variable - Set Player #[(Owner of (Returns the unit who last attacked the specified unit (Triggering unit)))][0] = Player #[(Owner of (Triggering unit))][(+ (1))]
Yeah I think I've tried that one as well, the problem is Last Attacker is always empty for some reason. Is it supposed to be a number?
<<quote 177363>>
Yeah I think I've tried that one as well, the problem is Last Attacker
is always empty for some reason. Is it supposed to be a number?
<</quote>>
According to the trigger, it should return a specific unit.
So I've tested some different triggers, this is an example of a simple one:
Untitled Trigger 001
Events
Unit - Marauder [44.69, 29.75] is attacked
Actions
Unit - Kill (Returns the unit who last attacked the specified unit Marauder [44.69, 29.75])
And the action seems broken, or at least not useable for user players.
So we will have to look at a different trigger.
Further testing:
Events
Unit - Any Unit is attacked
Local Variables
Conditions
((Triggering unit) can create Sentry - Guardian Shield (Apply Behavior) on Sentry [42.17, 19.83]) == true
Actions
Unit - Kill (Attacking Unit)
If you use 'Attacking Unit' instead of 'Last Attacker' it will return the correct Unit. However, Attacking Unit really requires the 'Unit is Attacked' Event. This will trigger everytime a unit is attacked. You'll have to make good conditions to get it work correctly.
Yeah that's what I said earlier, and is basically what I'm doing. I have a trigger with Any Unit is Attacked and use that to store the player number of the last attacker.
Normally you would just use a unit takes fatal damage but it's not possible with this type of behavior.
Anyhow I've tested it out and Any unit is attacked with condition attacked unit is heroic seems to work okay, and doesn't seem to impact on performance - I don't really have any other choice anyway by the look of it.
<<reply 177900>>
"Thats what I said earlier"
Cant find where you said that
Anyhow, it triggers every time the unit is attacked, so also the "last time" the hero is attacked.
If you want to be more precise you could make an event for " 'Unit in Unit Group' (hero unit group) is attacked" or 'each hero' (in a unit array). That way it wont fire up that much. So if you want to be really sure that the last attacker is indeed the "killer", is the unit turned invulnerable when the effect occurs?
Because I guess the reason you're asking is because the trigger doesn't work well this way?
KratsAU you can thank Blizzard for the new patch!
from the patch notes:
So when your effect occurs, get the damaging unit (should be working now)
I'm not patched yet (SEA), but hopefully it does.
I have a bad feeling it's not going to change the situation though, since the effect is still spawned as a result of the damage response which only seems to reference the one unit and contains no reference to the damaging unit or anything else.