I've searched the forums on this site for this type of ability and none of them have been solved. It's a simple concept; Hero kills unit -> Hero gains energy. But doing it in the editor proved to be more complex.
I also have the ability and the 3 behaviours (for 3 levels) on my hero and command card with the necessary requirements. I tried to provide as many details as possible so this problem could finally be solved for once and for all. Thank you for any help at all in advance!
Damage response on attacker does not work when fatal. You need to get the damage response on attacker to add a buff that responds on defender when fatal.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
I'm not quite sure what the second part actually meant but I'm going to guess.
Behavior with damage response on defender when fatal will trigger using 'handled' an a effect that will apply a behavior with damage response on attacker will trigger using 'handled' a modify unit effect that gives energy.
I haven't tested it yet but is that what you were trying to say?
The damage response on attacker applies a buff to the unit being attacked that has a damage response on defender when fatal. It is not completely logical but has been proven to work.
Rollback Post to RevisionRollBack
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
The damage response on attacker applies a buff to the unit being attacked that has a damage response on defender when fatal. It is not completely logical but has been proven to work.
Does this mean I would have to have a damage response on every killable unit? I tried putting both behaviors on one unit triggering one another but it didn't work. There must be something I'm missing here.
Believe what DrSuperEvil is suggesting is in place of just a 'damage' effect on your weapon, use a set effect that applies a behavior with a damage response with a handled effect of modify unit + energy and then of course your damage effect. To ensure this only happens when said ability is active, I would have a validator requiring Energy Steal or whatever buff count > 0. I would also probably only have the applied behavior last for about 5-10 seconds, so you can't just hit 10 units and come eat energy from them later.
Believe what DrSuperEvil is suggesting is in place of just a 'damage' effect on your weapon, use a set effect that applies a behavior with a damage response with a handled effect of modify unit + energy and then of course your damage effect. To ensure this only happens when said ability is active, I would have a validator requiring Energy Steal or whatever buff count > 0. I would also probably only have the applied behavior last for about 5-10 seconds, so you can't just hit 10 units and come eat energy from them later.
I don't think so. He is probably referring to an 'attacker' damage response being able to apply a secondary behavior to the target unit (using the Handled effect field with an Apply Behavior effect), which in turn uses a 'defender' damage response that even triggers for the damage instance, which applied the behavior in the first place. You would instantly remove the behavior after the defender response triggered, so it is guaranteed it will only trigger for that one damage instance.
This might still sound confusing, so another clarification:
Unit has a behavior with a damage response set to 'attacker'
Unit causes one instance of damage to the target
Damage response triggers, executing the Handled effect
Effect applies a 2nd behavior, this time to the target
Damage response for the 2nd behavior triggers for the same instance of damage!
Handled effect removes the 2nd behavior and adds energy to the attacker.
Ah, from reading DrSuperEvil's solution, I made the chain backwards. However, fixing it foreward properly, it still doesn't work.
The damage response for the 2nd behavior should be defender and fatal right?
To locate the problem, I made the first behavior (attacker), the one on the unit that is supposed to gain energy, have a positive alignment, and the second behavior (defender, fatal), the one on the unit that dies, have a negative alignment. It turns out, the 2nd behavior (defender, fatal) was being applied to my unit, but not the 1st behavior (attacker). Assuming I was an idiot and had it right the first time (backwards), I reversed it again. The same negative behavior was still applied to my unit and the positive one was not.
There must really be something I'm missing. To clarfiy, this is what I did (that I thought was what you asked of me):
Hero has behavior (attacker)
When hero attacks a unit, that unit receives the damage, as well as a behavior
The behavior on the unit is set on defender while fatal
If the damage kills the unit, the behavior on the unit triggers the effect that will give its killer energy
The effect that gives me energy has both Effect: Transfer Unit - Value set to Target and Target: Impact Unit - Value set to Target
Strange. I tried it out, got a problem with the removal of the behavior (it is applied for every shot but the damage response triggers only on death), so I added an additional behavior handling the removal.
Now, if I uncheck the fatal flag for all behaviors, it works fine, regenerating energy on every shot, even the killshot. But as soon as I check fatal on the defender it doesn't work, no energy regenerated ever.
However if I leave out the removal behavior so the defender behavior stays indefinitely, it works again...
Well, for your specific application I guess a small duration on the behavior wouldn't hurt. I would avoid that for generic damage responses, because that would probably make them trigger multiple times unintentionally, but since we are talking about only fatal damage responses, thats no big deal I guess. You might get energy for units killed in a 0.0625 time interval after you last damaged them.
I might need to add, that this is easily doable in triggers, which doesn't include this hack-ish way of using damage responses. Keep in mind, that this might be unintentional behavior, which could be fixed in a future patch (...which would hopefully also fix the attacker damage responses to provide a replacement :) ).
I've searched the forums on this site for this type of ability and none of them have been solved. It's a simple concept; Hero kills unit -> Hero gains energy. But doing it in the editor proved to be more complex.
My chain goes as follows:
Ability(Behavior) - Ability: Behaviors(Behavior(Buff)) ->
Behavior(Buff) - Damage Response(Chance: 1)(Fatal: Enabled)(Location: Attacker)(Handled: Effect(ModifyUnit)) ->
Effect(ModifyUnit) - Effect: Transfer Unit(Value: Target) - Effect: Vitals(Energy Change: 30) - Target: Impact Unit(Value: Caster)
I also have the ability and the 3 behaviours (for 3 levels) on my hero and command card with the necessary requirements. I tried to provide as many details as possible so this problem could finally be solved for once and for all. Thank you for any help at all in advance!
Damage response on attacker does not work when fatal. You need to get the damage response on attacker to add a buff that responds on defender when fatal.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
I'm not quite sure what the second part actually meant but I'm going to guess.
Behavior with damage response on defender when fatal will trigger using 'handled' an a effect that will apply a behavior with damage response on attacker will trigger using 'handled' a modify unit effect that gives energy.
I haven't tested it yet but is that what you were trying to say?
The damage response on attacker applies a buff to the unit being attacked that has a damage response on defender when fatal. It is not completely logical but has been proven to work.
Contribute to the wiki (Wiki button at top of page) Considered easy altering of the unit textures?
https://www.sc2mapster.com/forums/resources/tutorials/179654-data-actor-events-message-texture-select-by-id
https://media.forgecdn.net/attachments/187/40/Screenshot2011-04-17_09_16_21.jpg
Does this mean I would have to have a damage response on every killable unit? I tried putting both behaviors on one unit triggering one another but it didn't work. There must be something I'm missing here.
@ZeroX33: Go
Believe what DrSuperEvil is suggesting is in place of just a 'damage' effect on your weapon, use a set effect that applies a behavior with a damage response with a handled effect of modify unit + energy and then of course your damage effect. To ensure this only happens when said ability is active, I would have a validator requiring Energy Steal or whatever buff count > 0. I would also probably only have the applied behavior last for about 5-10 seconds, so you can't just hit 10 units and come eat energy from them later.
I don't think so. He is probably referring to an 'attacker' damage response being able to apply a secondary behavior to the target unit (using the Handled effect field with an Apply Behavior effect), which in turn uses a 'defender' damage response that even triggers for the damage instance, which applied the behavior in the first place. You would instantly remove the behavior after the defender response triggered, so it is guaranteed it will only trigger for that one damage instance.
This might still sound confusing, so another clarification:
Ah, from reading DrSuperEvil's solution, I made the chain backwards. However, fixing it foreward properly, it still doesn't work.
The damage response for the 2nd behavior should be defender and fatal right?
To locate the problem, I made the first behavior (attacker), the one on the unit that is supposed to gain energy, have a positive alignment, and the second behavior (defender, fatal), the one on the unit that dies, have a negative alignment. It turns out, the 2nd behavior (defender, fatal) was being applied to my unit, but not the 1st behavior (attacker). Assuming I was an idiot and had it right the first time (backwards), I reversed it again. The same negative behavior was still applied to my unit and the positive one was not.
There must really be something I'm missing. To clarfiy, this is what I did (that I thought was what you asked of me):
Anything wrong here?
Strange. I tried it out, got a problem with the removal of the behavior (it is applied for every shot but the damage response triggers only on death), so I added an additional behavior handling the removal.
Now, if I uncheck the fatal flag for all behaviors, it works fine, regenerating energy on every shot, even the killshot. But as soon as I check fatal on the defender it doesn't work, no energy regenerated ever.
However if I leave out the removal behavior so the defender behavior stays indefinitely, it works again...
Well, for your specific application I guess a small duration on the behavior wouldn't hurt. I would avoid that for generic damage responses, because that would probably make them trigger multiple times unintentionally, but since we are talking about only fatal damage responses, thats no big deal I guess. You might get energy for units killed in a 0.0625 time interval after you last damaged them.
I might need to add, that this is easily doable in triggers, which doesn't include this hack-ish way of using damage responses. Keep in mind, that this might be unintentional behavior, which could be fixed in a future patch (...which would hopefully also fix the attacker damage responses to provide a replacement :) ).