• 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.

Increase next attack damage by GUI

Status
Not open for further replies.
Level 2
Joined
Jul 3, 2014
Messages
14
Hi,
How do something like this: next basic attack deals bonus physical damage and slows the target's movement and attack speed for 2 seconds.
I tried it over spell which activated to triggering unit "ice arrows", then when is ice arrows used deactivate it, but it doesnt work and animation doesnt working too.
And when I try it over "add abillity", unit will stop moving and attacking.
 
Level 8
Joined
Jul 8, 2013
Messages
249
Well if you DON'T want the ability to be autocastable, you just want the NEXT attack after casting to deal bonus damage and a slow, then I would do something like this:

1) Make a custom ability based off Berserk but without giving a speed bonus or making the user take more damage. Berserk is a good idea because it does not interrupt the user's current orders but does place a buff on the user. Just make the buff look pretty and let the owner of the unit know the next attack will cold the enemy

2) Now you have some options. Here's a relatively complicated one: make a dummy unit and give it an ability based on slow or acid bomb or really any other single target slow. I'll assume you based it on Slow. And define a point variable TempPoint so you can clear leaks

Then trigger something like this:
  • Cold Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Your Buff from Berserk) Equal to True
    • Actions
      • Unit - Remove Your Buff from Berserk buff from (Attacking unit)
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Dummy Caster (Main) for (Owner of (Attacking unit)) at TempPoint facing Default building facing degrees
      • Unit - Add Slow to (Last created unit)
      • Unit - Order (Last created unit) to Human Sorceress - Slow (Triggering unit)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing 10.00 damage of attack type Pierce and damage type Normal
      • Custom script: call RemoveLocation (udg_TempPoint)
If you want the victim to look blue and colded then just add an action to change its vertex coloring. And create a unit group for units hit by this ability. Then you'll need to make a second, initially off, periodic trigger which this trigger will turn on. That second trigger will check every .1 seconds or something for units in the unit group that don't have the slow debuff anymore and will change their vertex coloring back to normal and remove them from the unit group. If that unit group is empty, that second trigger should then turn itself off.

Oh and regarding dealing 'physical damage', that just means you want the triggered damage you inflict to match the attacking unit's attack type (I assumed pierce at random) and to have normal damage type so it's reduced by armor.

2) Here's a relatively simpler option:

First trigger:
  • Add Frost Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Berserk Ability
    • Actions
      • Unit - Add Frost Attack to (Triggering unit)
Second Trigger:
  • Remove Frost Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has buff Berserk) Equal to True
    • Actions
      • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing 10.00 damage of attack type Pierce and damage type Normal
      • Wait 0.20 game-time seconds
      • Unit - Remove Frost Attack from (Attacking unit)
You may need to adjust that wait.


Of these two options, 1 will be a bit more complicated but will ultimately be less buggy with some tweaking since 2 will require using waits, which are always problematic.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
I like those abilities.

First of all the concept of those abilities is different from what you say:
The ability itself is a regular buff that is cast on you and has no effect.
Then when a unit takes damage, check if the attacker has that buff and if so then remove the buff and add some shiny effect.

This system is GUI / MUI
Difficulty: 3 / 10
Time to create: 6 / 10
I didn't check for leaks. But next to that idc :D

Make an ability based of Orc - Berserk. (Or Channel if you know what you have to do.)
Then set the Attack Speed Increase, Damage Taken Increase and the Movement Speed Increase to 0.
The duration of this ability is the time you have to use a basic attack after you have cast it. Not the duration of the slow ofc.
Make a new buff and add that buff to the new berserk ability.
Add the berserk ability to your unit.

Now you have completed the caster.



Lets head on to the spell effect.
Make a dummy unit and give him a new spell based on Undead - Cripple
Set whatever values of that spell you want. Idc.
(If you dont know how to make a dummy unit then tell me.)
(Be sure to set casting point to 0 and model to null.)



Lets go to the last part: the triggers:
First of all, you have to be able to detect basic attacks.
If you already have a system that detects that, then you have no worries and you can add your stuff to that.
If not then use this: (This system excludes buildings. In case of this ability that is probably what you want.)
Make an ability based of Orc - Envenomed Spears and set the duration to 0.01 and the damage to 0.
Make a buff and add it to that ability.
This trigger has to be runned every time a unit takes damage.
  • Taking Damage
    • Events
    • Conditions
      • ((Triggering unit) has buff AA Buff ) Equal to True
    • Actions
      • Unit - Remove AA Buff buff from (Damage source)
To add the proper events to that trigger you need the following line in any map initialization trigger:
  • Unit Group - Pick every unit in (Units in (Entire map)) and do (Actions)
    • Loop - Actions
      • Unit - Add Envenomed Spears to (Picked unit)
      • Trigger - Add to Taking Damage <gen> the event (Unit - (Picked unit) Takes damage)
And you need this trigger:
  • Entering unit
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
    • Actions
      • Unit - Add Envenomed Spears to (Entering unit)
      • Trigger - Add to Taking Damage <gen> the event (Unit - (Entering unit) Takes damage)
Both of those triggers will add a new event to the Taking Damage trigger and gives those units a buff on every basic attack.



Now we have to find out when a unit uses a basic attack on another unit and it has the berserk buff.
So call this inside your Basic Attack System.
This will remove the buff (So you cannot make use of the same effect twice when you only cast the ability once.)
Then it creates a dummy unit and order it to cast cripple on the targeted unit. (This is your shiny slow and attack speed reduction.)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ((Damage source) has buff Berserk) Equal to True
    • Then - Actions
      • Unit - Remove Berserk buff from (Damage source)
      • Unit - Create 1 Dummy for (Owner of (Damage source)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Undead Necromancer - Cripple (Triggering unit)
    • Else - Actions


That was it.
I hope I didnt forget anything, but this should be all that you need.

EDIT:
Forgot bonus attack damage.
Add the following to where the dummy is created:
  • Unit - Cause (Damage source) to damage (Triggering unit), dealing 500.00 damage of attack type Normal and damage type Normal
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
@Melth
You do know that Unit is attacked event is called when a unit is starting to attack do you?
That means that the projectile is not yet on its destination, nor the swing has come to its target.
The duration is different for each unit and is ussually bewteen 0.3 seconds and 0.7 seconds.
This is therefor a very bad way to detect basic attacks.

The other part of the first option is indeed very good.


For the second option... Same attacked event stuff.
The wait timer removes most event response variables and therefor Attacking unit might be null.
I havent tested this but be carefull using wait timers in GUI.
(Same odd effects can occur with issue order. ALWAYS use that as the last action.)
 
Use this instead of poison abilities, which does not work with special projectiles (Missile Bounce, Splash, Cleave Effects, etc.)

Upon receiving damage, have a dummy Acid Bomb the target (Cripple doesn't seem to stack even with different buffs). Also deal your bonus damage, since Acid Bomb is not physical.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
@Mythic
Instead of the poison ability, I trigger the recieved damage of 0, 1 and 2 to determine what attack it was and it works smooth with bounces.
The only problem is that you have to register all units and their damage to let it work... on my maps I already do that because I use my own damage/armor/spell/critical strike/accurracy/etc system.

I do splash (cleave is also splash) damage as pick every unit in range and deal damage.

I kind of dislike having massive triggers, especcially GUI triggers.
Once I saw those triggers, I was like "NO WAY!"
But if you are so confident about it, what can it do better than what I use?
 
it works smooth with bounces.
You mean the damage modification is done after removing the buff, thus letting the bounce through?
I kind of dislike having massive triggers, especcially GUI triggers.
PDD is not GUI, it's JASS. You just have to copy-paste the variable creator trigger, then the JASS code into your map, and finally edit the Damage Modification trigger itself(it has a few examples on how to use it).
what can it do better than what I use?
That kind of damage detection has an infinite memory leak, since dead units' events are not removed. Damage Detection Systems fix that; they recreate the trigger every <short amount of time> to prevent leaks.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
You mean the damage modification is done after removing the buff, thus letting the bounce through?
No. I mean that I don't use any basic attack buff any more but instead reducing the damage of all units to 1 (with an ability that reduces basic attack damage to 1) and use 0 damage for abilities.
So if a unit takes damage and the damage is 1, then it has been hit by a basic attack.
That is why I need to trigger the damage after all.


PDD is not GUI, it's JASS. You just have to copy-paste the variable creator trigger, then the JASS code into your map, and finally edit the Damage Modification trigger itself(it has a few examples on how to use it).
I didn't say that it was GUI but I dislike large GUI triggers more than I dislike large JASS triggers.
But most of the code in that trigger is actually depending on how you want to use it.
The point is that I get to that page and I see one big pile of information. And in those complex systems, that just goes behond the limit of how much I can understand :)
My code is simple and SHORT!

That kind of damage detection has an infinite memory leak, since dead units' events are not removed. Damage Detection Systems fix that; they recreate the trigger every <short amount of time> to prevent leaks.
I actually don't really care much about memory leaks but I can understand that not everyone has a super-pc as I have XD

If you use a little bit of JASS code, you can destroy a trigger and reset it.
So if you make a trigger:
Trigger1
Events: Unit takes damage X (number of units in map + units that were in the map)
Actions: Call Damage System

And the Damage System is the one that does whatever you want.
You can retrieve attacking unit, targeting unit, damage amount, etc by saving it into a variable.

Once in a while you say:
call DestroyTrigger(gg_trg_Trigger1)
set gg_trg_Trigger1 = CreateTrigger()
call TriggerAddAction(gg_trg_Trigger2, function Action)
loop for every unit in map:
call TriggerRegisterTakesDamageEvent(gg_trg_Trigger1, EnumUnit())

EDIT:
I have done a test by adding unit takes damage event 1000 times per second... (1000 units are created on your map per second?)
each second I add about 0.7 mb... That includes all other leaks that I have on my map :)
Maybe I should care about leaks if I share something :)
But removing leaks is no problem.

I should thank you though. If you never told me that leak, I would never searched for a way to remove it.
I knew it Exists but I didn't have any motive to search for a solution XD
 
Last edited:
But most of the code in that trigger is actually depending on how you want to use it.
That's the point, you can put your current code in the modification trigger since it is just run by the PDD. An advantage of the PDD is that it differentiates between physical, spell, and triggered damage so you no longer have to reduce damage to identify.

It also allows you to change the damage taken, not by healing or triggering another instance of damage for increase.
 
Status
Not open for further replies.
Top