• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Passive Counter Attack

Status
Not open for further replies.
Level 7
Joined
Dec 14, 2012
Messages
192
Hello there~

Big Edit: Solved the problem, especial thank to Rulerofiron99 for that :3

The idea of the ability is, to counterattack an enemy if an attack has been evaded. After some thinking, the idea of creating an illusion seemed rather appealing to me - If an attack is evaded, an illusion is created that attacks the source of the evaded attack, dealing normal hero damage + adding a debuff onto the enemy. That train of thought fits my Hero, the Demoness, very well as I think.

Anyway, before I post the triggers, a few things to note:
- The ability that leaves the debuff is an aversion of inner fire, that reduces attack damage and armor. The ability is called seduce and is an ability of the Demoness, that can be triggered through this illusion-counter-attack, but the level of the debuff is not set after the base ability level(Seductive Bane), but rather after seduce(With an exception of the first level, which is always applied, even if Seduce has not been learned by the Hero).
- The ability of the "Counter Attack Dummy" is a modified "Item Illusions"
- The trigger has one, possibly two, situational problems...
1. If an illusion of the Demoness, that actually does damage(which the normal illusions would not do), would be created, that illusion would vanish once it dealt damage.
2. I think... If two instances of the trigger would spawn at the exact same time, it could create a bug~ Not sure about that one - and it seems highly unlikely anyway.

SO now, to the triggers~ First the setup+coded evasion:

  • Seductive Bane Setup and Evasion
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Seductive Bane for DamageEventTarget) Greater than or equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Random percentage) Less than or equal to ((Real((Level of Seductive Bane for DamageEventTarget))) x 7.00)
            • Then - Actions
              • Set DamageEventAmount = 0.00
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (DamageEventSource is A flying unit) Equal to False
                • Then - Actions
                  • Set TempVariableForCounter = DamageEventSource
                  • Unit - Create 1 Counter Attack Dummy for (Owner of DamageEventTarget) at (Position of DamageEventTarget) facing Default building facing degrees
                  • Set CasterUnit = (Last created unit)
                  • Set TargetUnit = DamageEventTarget
                  • Custom script: call IssueTargetOrderById(udg_CasterUnit, 852274, udg_TargetUnit)
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                • Else - Actions
            • Else - Actions
        • Else - Actions
This Trigger creates a full-triggered evasion, necessary for this ability. Furthermore, it creates the illusion, which is needed for the counterattack.

  • Seductive Bane Counterattack
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of TempVariableForCounter) Not equal to No unit-type
      • ((Triggering unit) is an illusion) Equal to True
    • Actions
      • Set CounterAttackIllusion = (Triggering unit)
      • Custom script: call UnitAddAbility(udg_CounterAttackIllusion, 'Aloc')
      • Unit - Order (Triggering unit) to Attack TempVariableForCounter
      • Set TempVariableForCounter = No unit
This trigger checks if a Demoness illusion is created and orders it to attack a unit-variable - which was stored in the last trigger. Note that at the end, the variable is once again emptied. It works out like this, because the whole trigger is executed instantly.

  • Seductive Bane Illusion destroy and Debuff
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Demoness
      • (DamageEventSource is an illusion) Equal to True
    • Actions
      • Unit - Create 1 Counter Attack Debuff Dummy for (Owner of DamageEventSource) at (Position of DamageEventTarget) facing Default building facing degrees
      • Unit - Set Level of Seduce (Non-Hero) for (Last created unit) to (Level of Seduce for DamageEventSource)
      • Unit - Order (Last created unit) to Human Priest - Inner Fire DamageEventTarget
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add a 0.50 second Generic expiration timer to DamageEventSource
This trigger creates the Dummycaster, that casts the "Seduce" debuff and removes the illusion after it attacks(which is rather important to do)


Soo~ These are the trigggers for the skill. If you find any glaring mistake, please tell me so I can fix it~
 
Last edited:
Level 25
Joined
Jul 10, 2006
Messages
3,315
A simple way would be to trigger on Unit Is Attacked, check your chance against a random percentage, and then do:
- Play attack animation
- Determine hero's attack damage - Here's a system that does it http://www.hiveworkshop.com/forums/spells-569/damage-calculating-system-1-3v-gui-216198/
- Make a dummy unit to cast the debuff

For your evasion, you'll need to use a damage detection system to make a custom evasion that can be triggered.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Hm, I see~ But your suggestions seem to have one flaw:
I do not wish her to "randomly" counter attack, I wish that she counters an attack IF she is attacked.
Also, no one cleared the issue of the range. I want the counter to also work ranged, but only to a certain range, like 500 for example.
A simple way would be to trigger on Unit Is Attacked, check your chance against a random percentage, and then do:
- Play attack animation
- Determine hero's attack damage - Here's a system that does it Damage Calculating System 1.3v [GUI]
- Make a dummy unit to cast the debuff

For your evasion, you'll need to use a damage detection system to make a custom evasion that can be triggered.

I'll try this way, for now~ Gotta look through that damage calculating system, though~ Never used that one before.

In any case, how exactly can an evasion be triggered?
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Like this:
  • DMGS CritEvadeBlock
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Evasion for DamageEventTarget) Greater than or equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • (Random percentage) Less than or equal to (Real(Level of Evasion for DamageEventTarget) * 15)
          • Then - Actions
            • Set DamageEventAmount = 0
            • //trigger your counterattack here
          • Else - Actions
        • Else - Actions
 
Level 7
Joined
Dec 14, 2012
Messages
192
Like this:
  • DMGS CritEvadeBlock
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Evasion for DamageEventTarget) Greater than or equal to 1
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • (Random percentage) Less than or equal to (Real(Level of Evasion for DamageEventTarget) * 15)
          • Then - Actions
            • Set DamageEventAmount = 0
            • //trigger your counterattack here
          • Else - Actions
        • Else - Actions
Ah, I see~ Just to ask, though... If I want to change the evasion rate to, lets say, 8% per level, I would change that random percentage part to *8 at the end, correct?


Okay, with this trigger, I can easily create the "counter-attack" part I think, that even with the debuff. However, I wonder: How can I limit the range in which the counterattack can be executed?

But I'l be sure to test this newfound knowledge once I get to do so(Right now, I am not at my home~). Thanks very much for the help, ill report back once I tested things out.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Ah, I see~ Just to ask, though... If I want to change the evasion rate to, lets say, 8% per level, I would change that random percentage part to *8 at the end, correct?

Yep, and of course you can do it a different way:
Save each level's evasion to an array variable:
  • Set Evasion[1] = 10%
  • Set Evasion[2] = 14%
  • Set Evasion[3] = 25%
And then the condition changes to:
  • (Random percentage) Less than or equal to (Evasion[Level of Evasion for DamageEventTarget])
For the range, you can get the distance between DamageEventTarget and DamageEventSource, and compare that to the range you want.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Yep, and of course you can do it a different way:
Save each level's evasion to an array variable:
  • Set Evasion[1] = 10%
  • Set Evasion[2] = 14%
  • Set Evasion[3] = 25%
And then the condition changes to:
  • (Random percentage) Less than or equal to (Evasion[Level of Evasion for DamageEventTarget])
For the range, you can get the distance between DamageEventTarget and DamageEventSource, and compare that to the range you want.
Okay, thanks ^.^

Now I'd like to clarify: That "counter-attack" is basically an "extra-attack", not affected by attack speed. If it does executed via triggers, will that somehow conflict within the flow of attacks?
Then... If the Demoness dodges an aerial attack for example or a ranged attack, will she actually counter it on range? The thing is, the demoness is a melee hero, but I would neither want her to always need to walk up to the enemy to counter them, nor be unable to counter attacks out of melee range. Also, it would not be wishable, if she would change her primary attack target everytime she counter-attacks.

Gawd, way too many questions o_O Sorry for that >.< just want to make sure that all instances are okay.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Level 23
Joined
Apr 16, 2012
Messages
4,041
I'm not sure how we'll make the hero face the target, hopefully the simple Unit - make unit face unit action will work for this.

It takes some time to spin tho, even if you say make unit face unit in 0.00 seconds it will still take him as long as it would take him normally(ordering to spin like moving that way etc) so you would have to take that to mind otherwise it would look weird :D

also if my understanding of current solution (ordering to attack) would break any action the unit does, for this I would just do Unit - damage unit for some value, it doesnt interrupt the unit or its orders(if it does correct me) and you dont need to face the unit nor to see it
still requires the DDS tho
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
for this I would just do Unit - damage unit for some value, it doesnt interrupt the unit or its orders(if it does correct me) and you dont need to face the unit nor to see it

That's the idea yes.

Another problem is adding timing to it - since the hero takes half a second or so to animate.

I think perhaps the best solution would be to create a dummy hero that does the attack, and while it is doing so, set the real hero's vertex colouring to 100% transparent.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Hmm... Interesting. I think this "dummy hero"-solution could offer another interesting possibility.
My Hero - the Demoness - is a succubus-like hero(as one could guess). I based her to be a sort of assassin - she has rather low armor(especially as she has negative base armor), extremely low health but very high attack speed, can get invisible and has a ability, that she can activate to gain a tremendous amount of lifesteal.
Anyway, to a succubus-theme, illusions would also fit rather well.
So I am thinking of the following: Demoness evades an attack, then an illusions is created(Basically, a copy of the Demoness, only that this copy does neither have items nor abilities except the passive critical strike ability). This illusion would be created in front of the enemy, that is supposed to get counter-striked in the face~ So that illusion would execute the attack and vanish after that one attack.

I think this idea is rather nice~ Question I have, though... How can I "copy" my a unit? After all, this illusion should have the same level/stats as my Demoness.

In any case, could this idea work out? I find it rather nice.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Best way would be to make an illusion using a dummy caster. Note that you can't order a unit to cast illusion using GUI, you need to use a custom script with a custom order id, I don't have it on hand right now.

Anyway, if you still haven't come right with the evasion, I've been working on a system that handles critical strikes, evasion and damage block, and it will be extremely easy to trigger your evasion using it: http://www.hiveworkshop.com/forums/spells-569/gui-damage-modification-system-1-00-a-227662/

EDIT: Here's the code for making an illusion using triggers.
  • Actions
    • Set CasterUnit = (Random unit from (Units in (Playable map area)))
    • Set TargetUnit = (Random unit from (Units in (Playable map area)))
    • Custom script: call IssueTargetOrderById(udg_CasterUnit, 852274, udg_TargetUnit)
 
Level 7
Joined
Dec 14, 2012
Messages
192
Best way would be to make an illusion using a dummy caster. Note that you can't order a unit to cast illusion using GUI, you need to use a custom script with a custom order id, I don't have it on hand right now.

Anyway, if you still haven't come right with the evasion, I've been working on a system that handles critical strikes, evasion and damage block, and it will be extremely easy to trigger your evasion using it: http://www.hiveworkshop.com/forums/spells-569/gui-damage-modification-system-1-00-a-227662/

EDIT: Here's the code for making an illusion using triggers.
  • Actions
    • Set CasterUnit = (Random unit from (Units in (Playable map area)))
    • Set TargetUnit = (Random unit from (Units in (Playable map area)))
    • Custom script: call IssueTargetOrderById(udg_CasterUnit, 852274, udg_TargetUnit)
Okay~ I'll try to use your system then, possibly.
In any case, the code for making an illusion~ Why is there the phrase "Random unit from" in there o_O? Kind of confusing, to be honest.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Okay~ I'll try to use your system then, possibly.
In any case, the code for making an illusion~ Why is there the phrase "Random unit from" in there o_O? Kind of confusing, to be honest.

That was just for testing. I probably should have changed those to comments...

But it should be obvious - you set the caster unit to the dummy, and the target unit to your hero.

Anyway, the next part will be to detect when an illusion is summoned, and order it to attack your target.
 
Level 7
Joined
Dec 14, 2012
Messages
192
That was just for testing. I probably should have changed those to comments...

But it should be obvious - you set the caster unit to the dummy, and the target unit to your hero.

Anyway, the next part will be to detect when an illusion is summoned, and order it to attack your target.
Ah, I see~ Well, I just was a bit confused ^^"

You said "order to attack your target"... But that "target" does confuse me in there. Why? Well~ the "Target" would be the enemy, that has attacked and is being countered. Does this script get that target?
And also, I wonder~ Couldn't one just create a unit and set it's stats to the Demoness' stats?
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
I might be wrong here but you cant store the normal attack right. you got to set a damage number. if you really want to "replay" with a counter attacj you should count damage done and divide it with number of attacks. But the best way would be to simple say "reflect 10 damage + str * 0.2"
 
Last edited:
Level 7
Joined
Aug 19, 2012
Messages
244
i seems you two have some good time there, lol
btw, i have edit my last post
seriously, i don't get it, i'm not understand all the post here
i have a really bad English

making a clone?
one question, what we do after the dummies finished his work?
just kill him or remove it?
if i kill him, it will make blood and sound, how to remove it?
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
i seems you two have some good time there, lol
btw, i have edit my last post
seriously, i don't get it, i'm not understand all the post here
i have a really bad English

making a clone?
one question, what we do after the dummies finished his work?
just kill him or remove it?
if i kill him, it will make blood and sound, how to remove it?

dummy has no model, how could they make blood and sound ?
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
if you see a post by lucy in page 1, you will see if she talking about illusion, you know,
another offense

EDIT : the page is change :(, just find it out

yes, sorry if I'd offended you.. didn't mean to, it's just the thread had a long wall of texts, I am lazy to read through all of them.

anyway, I wanted to know whether the problem is already solved, if it hadn't, then I might try to make it.
 
Level 7
Joined
Dec 14, 2012
Messages
192
Take the thread all you want xDD

yes, sorry if I'd offended you.. didn't mean to, it's just the thread had a long wall of texts, I am lazy to read through all of them.

anyway, I wanted to know whether the problem is already solved, if it hadn't, then I might try to make it.
Well, with some help, I am right now trying to create the trigger. It is pwetty harsh~ And there are a few instances, in which it may conflict somehow. I'll soon be finished, though~ And then I shall - as always - update the topic and post here.

Just as a little status report:
THe ability I am now trying to create is practically:
If Demoness evades an enemy attack, an illusion is created, which is practically a copy of the Demoness. The illusions cannot use any abilities, except the passive critical strike, and will run up to the enemy, whose attack was dodged, and will attack that enemy, applying a de-buff that reduces damage dealt and done by them~ Or some different de-buff xD. It surely will apply a debuff.
In any case, I am still unsure about a few things: Do I want the illusion to stay a few seconds, or do I want to remove it once it has attacked? If it stays longer, I have to set it damage output to zero right after it has attacked - furthermore, I have to think about another thing...
The Illusion should definetely not be controllable. However, if I want it to partially serve as a bait, I need to make it "targetable" - and that means, I cannot use the locust ability. If I create the copy for a different player - like neutral-passive - it gets noticed way too easily. If I remove all of the illusions abilities except the passive, it can still be ordered to attack and walk around - which is not wanted. It is a little big bit annoying, kinda~
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
you could null the selection for the illusions.

  • nulling selection
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Paladin
      • ((Triggering unit) is an illusion) Equal to True
    • Actions
      • Selection - Remove (Triggering unit) from selection for (Triggering player)
also, i agree with you for setting the damage output to zero.

my suggestion is to make an ability that works like normal attack, basically it's just an ability that deals no damage but plays the attack animation, and then create the chance for that abilities for critical purpose.

  • nulling attacks
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of DamageEventSource) Equal to Paladin
      • (DamageEventSource is an illusion) Equal to True
    • Actions
      • Set DamageEventAmount = 0.00
  • creating illusion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Normal Attack
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random real number between 0.00 and 100.00) Less than or equal to 30.00
        • Then - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (2.00 x 100.00) damage of attack type Spells and damage type Normal
        • Else - Actions
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Normal and damage type Normal
it's just my suggestion. what i don't know is to make the created illusion cast the ability to the enemy.
 
Level 7
Joined
Dec 14, 2012
Messages
192
@TwoVenomous: What an interesting approach. That "nulling selection"-trick could be useful in the future. However, I have decided to simply use the locust ability~ Balancing issues, you see? The ability is already pretty strong~ And the hero is somewhat hard to balance. My Demoness is a very... extreme hero xD

Anyway, I got the ability finished. My trigger have one but one flaw~ If you want to know, just wait a second and look at my topic, I shall edit it now.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
@TwoVenomous: What an interesting approach. That "nulling selection"-trick could be useful in the future. However, I have decided to simply use the locust ability~ Balancing issues, you see? The ability is already pretty strong~ And the hero is somewhat hard to balance. My Demoness is a very... extreme hero xD

Anyway, I got the ability finished. My trigger have one but one flaw~ If you want to know, just wait a second and look at my topic, I shall edit it now.

The null selection thing works, but not really. It has a delay. In single player, you can select and right click order it if you're quick enough. On battle.net where there is more delay, the time between selection and deselection is even longer.

You don't have to use Locust; IIRC illusions don't have any abilities anyways.

Here's how you can do the unsummoning:
- When the illusion is created, add it to a unit group called "DemonessEvasionIllusions" or something.
- Use the damage system to detect if a unit is dealt damage by a unit in this unit group. If it is, you can remove the illusion and apply the debuff.
 
Level 7
Joined
Dec 14, 2012
Messages
192
The null selection thing works, but not really. It has a delay. In single player, you can select and right click order it if you're quick enough. On battle.net where there is more delay, the time between selection and deselection is even longer.

You don't have to use Locust; IIRC illusions don't have any abilities anyways.

Here's how you can do the unsummoning:
- When the illusion is created, add it to a unit group called "DemonessEvasionIllusions" or something.
- Use the damage system to detect if a unit is dealt damage by a unit in this unit group. If it is, you can remove the illusion and apply the debuff.
Ah~ using a unit group could work out well.

They have abilities, elsewise, my trigger wouldn't work~ But no usable abilities. However, they do have passive abilities as it seems.

But Locust would still have to be used - it would be rather annoying if the player could control the unit in any way - commanding it to attack something is already bad.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
Ah~ using a unit group could work out well.

They have abilities, elsewise, my trigger wouldn't work~ But no usable abilities. However, they do have passive abilities as it seems.

But Locust would still have to be used - it would be rather annoying if the player could control the unit in any way - commanding it to attack something is already bad.

There's another solution for the commanding. You can intercept the unit's orders, and force it to attack its proper target if it gets told to do anything else.

This is how Spectre's ultimate works in DotA.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
I think it would look great if the counter attack spawned a same unit(illusion) with 0%, 0%, 0% vertex coloring(totally black model) with locust just running to the target unit hitting it once and then disappearing :D
but ow well, you could catch the event of ordering and reordering the unit to attack the desired target but you would have to do some if-ing to not make endless loop(you dont want to catch the order you do with triggers :D )
I have done something very similar with a unit which worked basically as the guardian of paladins in WOW(the suckers which run around you and hit everything you hit and redirect dmg), when I ordered my hero summoning it to go somewhere it was ordered to follow the hero and when I ordered the hero to attack something, it attacked the target
however for point attacks this may require a looping trigger
 
Level 7
Joined
Dec 14, 2012
Messages
192
I think it would look great if the counter attack spawned a same unit(illusion) with 0%, 0%, 0% vertex coloring(totally black model) with locust just running to the target unit hitting it once and then disappearing :D
but ow well, you could catch the event of ordering and reordering the unit to attack the desired target but you would have to do some if-ing to not make endless loop(you dont want to catch the order you do with triggers :D )
I have done something very similar with a unit which worked basically as the guardian of paladins in WOW(the suckers which run around you and hit everything you hit and redirect dmg), when I ordered my hero summoning it to go somewhere it was ordered to follow the hero and when I ordered the hero to attack something, it attacked the target
however for point attacks this may require a looping trigger
Interesting~ I'll keep these things in mind, probably may use them some time.
But yeah, I did the recoloring already xD Sooo Shadowy.


@RuleroFiron99: You mean something like: If Unit gets is issued any order, then order top stop; then issue attack correct target
Something like that?
 
Level 7
Joined
Dec 14, 2012
Messages
192
You don't need to order them to stop; just order them to attack the target.

But be careful! You need to turn off the trigger before you do this order and on again afterwards, otherwise it will cause an infinite loop.
Well, I guessed that already.
I wonder, though~ without the "stop" order... Would it even make any difference?
 
Status
Not open for further replies.
Top