• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[General] Continually attacking same target continually increases dmg?

Status
Not open for further replies.
Level 3
Joined
Sep 28, 2018
Messages
38
Unit ability in Angel Arena increases the damage dealt to a single-unit target the longer said target is attacked. Here's the description... "The longer your hero attacks the same enemy unit the more damage it does to it. Increases damage dealt per attack. Resets after a short period of time without attacks."

I'm curious about implementing something as such. Along the lines of while a unit is holding a specific item and is attacking the same enemy increase damage dealt to the target continually. If that makes sense please let me know. I don't know how to handle the increase damage as the ability doesn't show any buffs on the hero who has it nor does it show a debuff on enemies attacked by it. On top of that the triggers are unrecoverable. Tried digging around them for the better part of yesterday and came up empty.

Thanks in advance
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
Sounds a lot like the Incinerate ability but here's a helpful link:

I would use a Unit Indexer to track the Stacks, Stack Limit, and Attack Target of the hero that's using your item.

Then use a Damage Engine to detect when that hero deals attack damage and do the following:
1: Check if the damaged unit is equal to the hero's Attack Target. If it isn't, reset the Stacks to 0.
2: Set the damaged unit as the hero's Attack Target.
3: Increase the hero's Stack count by 1 (if < Limit)
4: Increase the damage dealt based on the number of active Stacks.

To handle the resetting of Stacks after a short period of time I'd use a Timer System that starts the same Timer again and again after each attack, resetting the Stacks if it ever manages to expire. This works because when you Start a timer that is already running it resets it, starting it over again. I attached a map with a GUI friendly timer system I threw together which can do exactly this.

Obviously the Stack Limit is optional so you don't need it.

Systems needed:

An alternative to a Unit Indexer system is a Hashtable but they're not as user friendly.
 

Attachments

  • GUI Timer System 4.w3m
    26.8 KB · Views: 16
Last edited:
Level 3
Joined
Sep 28, 2018
Messages
38
Sounds a lot like the Incinerate ability

I would use a Unit Indexer to track the Stacks, Stack Limit, and Attack Target of the hero that's using your item.
...

An alternative to a Unit Indexer system is a Hashtable but they're not as user friendly.

For a non-trigger approach, you could tinker the vanilla spell, Incinerate. Just remove the burst damage and its effects.
Vampirism Fire used this ability to stimulate damage stack for an item in its early days.

Thank you both for the swift and helpful responses! I believe the easier route is to manipulate Incinerate. It does almost what I'm wanting to do. The damage is increasing but by a static value set. Defaulty this is 1. Each subsequent continually adds 1 additional damage.

I want to increase damage based on % of a units attack. E.g. if the bonus dmg is 10% per attack, a unit who has two thousand (2000) base damage would add +200 each subsequent attack. So 1st atk- 2000, 2nd- 2200, 3rd- 2400, etc.

I don't know how to manipulate Incinerate in such a way as the field that's doing this, "Bonus Damage Multiplier" uses a constant defined in the editor. Is it possible to update this field so it dynamically uses a percentage (%) of attack of a unit who posses said ability or item with it?
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
Try using the SetAbilityRealLevelField function.

Example of modifying Carrion Swarm's Damage field to use the Caster's Strength attribute:
  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to Carrion Swarm
  • Actions
  • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Damage ('Ucs1') of Level: ((Level of (Ability being cast) for (Triggering unit)) - 1) to (45.00 + (Real((Abs((Strength of (Triggering unit) (Include bonuses)))))))
The Level indexing starts at 0 which is why you need to Subtract 1 from the Level of the ability being cast. 0 = 1, 1 = 2, 2 = 3, etc.

Remember to use the appropriate fields. Note how the Damage field here has the rawcode 'Ucs1'. That is exclusive to Carrion Swarm, if it were a different ability like Shockwave it'd use the rawcode 'Osh1' for it's Damage field. Press Control + D in the Object Editor to view Rawcodes.

Incinerate's Bonus Damage Multiplier field uses the rawcode 'Nic1'.

These aren't all guaranteed to work. Also, for certain abilities (from my experience mostly passive abilities like Item Attack Damage Bonus) you need to "refresh" the ability for these changes to apply:
  • Unit - Increase level of your ability
  • Unit - Decrease level of your ability
This will refresh the ability. The ability doesn't even need more than 1 Level for this to work... It's strange but it fixes the issue.
 
Last edited:
Level 3
Joined
Sep 28, 2018
Messages
38
Try using the SetAbilityRealLevelField function.

  • Unit - Increase level of your ability
  • Unit - Decrease level of your ability
This will refresh the ability. The ability doesn't even need more than 1 Level for this to work... It's strange but it fixes the issue.
So far this is the only way I've been able to detect Incinerate

  • Untitled Trigger 001 Copy Copy Copy 3 Copy Copy Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Incinerate) Equal to True
    • Actions
      • Game - Display to (All players) for 1.00 seconds the text: INCIN buff detect
Tried implementing but this doesn't appear to work as intended. Please give this a look and tell me what you think.

  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacked unit) has buff Incinerate) Equal to True
    • Actions
      • Countdown Timer - Start Untitled_Variable_002 as a One-shot timer that will expire in 3.00 seconds
      • Game - Display to (All players) the text: TIMER STARTED
      • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s Real Level Field: Bonus Damage Multiplier ('Nic1') of Level: ((Level of (Ability being cast) for (Triggering unit)) - 1) to ((Unit: (Triggering unit)'s Weapon Real Field: Attack Damage Point ('udp1') at Index:(Base Damage of (Triggering unit) for weapon index 0)) x 0.10)
      • Set VariableSet Untitled_Variable_001 = (Untitled_Variable_001 + 0.10)
      • Game - Display to (All players) the text: (String(Untitled_Variable_001))
      • Unit - Increase level of (Ability being cast) for (Triggering unit)
      • Unit - Decrease level of (Ability being cast) for (Triggering unit)
  • Untitled Trigger 002 Copy
    • Events
      • Time - Untitled_Variable_002 expires
    • Conditions
    • Actions
      • Set VariableSet Untitled_Variable_001 = 0.10
      • Game - Display to (All players) the text: TIMER EXPIRED
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
there will be issues with using
  • Unit - A unit Is attacked
it simply doesnt work the way you think. for example if your unit is near other units it can atk and u spam the stop key it will trigger super quick over and over. i suggest using the DMG engine that Uncle gave u

  • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: (Ability being cast))'s
the beginning of this is being set to nothing cause in this case no "ability is being cast" ull have set the ability manually

the same for these
  • Unit - Increase level of (Ability being cast) for (Triggering unit)
  • Unit - Increase level of (Ability being cast) for (Triggering unit)
also using the variables this way will cause the ability mess up if multiple units use the ability they will overwrite each other
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
Like Millzy said, you're using the wrong Event Responses. My example was based on a unit CASTING an ability, not ATTACKING a unit, different Events have different Event Responses. Also, that Timer/Real global variable will be shared by any and all instances of the trigger, meaning any unit that attacks with this item will cause the Timer to restart and the Real to change. Global variables are shared by all of your triggers/instances of triggers and their value can only be set to one thing at a time. The solution here is global variable Arrays, which you'd use alongside some form of Indexing (a Unit Indexer comes to mind) to have separate Real variables/Timers for each unit that has the item.

Anyway, this is what you'd want to do (IF it worked):
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has an item of type YourItem) Equal to True
    • Actions
      • Set VariableSet Dmg = ((Real((Base Damage of (Attacking unit) for weapon index 0))) x 0.20)
      • Ability - Set Ability: (Unit: (Attacking unit)'s Ability with Ability Code: Incinerate (Item))'s Real Level Field: Bonus Damage Multiplier ('Nic1') of Level: 0 to Dmg
      • Unit - Increase level of Incinerate (Item) for (Attacking unit)
      • Unit - Decrease level of Incinerate (Item) for (Attacking unit)
      • Game - Display to (All players) for 30.00 seconds the text: (String(Dmg))
I don't see the need for the timer or anything like that since Incinerate already has a duration.

Unfortunately, I can't get this to work. I've tried everything I can think of but this value simply won't change:
  • Ability - Set Ability: (Unit: (Attacking unit)'s Ability with Ability Code: Incinerate (Item))'s Real Level Field: Bonus Damage Multiplier ('Nic1') of Level: 0 to Dmg
Note that I can't confirm whether or not Increasing/Decreasing the level is necessary for Incinerate, I tested it with/without these functions but it wouldn't work regardless.


I think you'll have to rely on a much more complicated approach using the systems I described before. Also, regarding that, the whole stacks resetting if you switch targets is unnecessary, I think I misunderstood what you wanted the ability to do. I was thinking of something similar to Troll Warlord's stacking attack speed from Dota 2 which resets upon switching targets. In other words, Attack Target and Stack Limit are totally optional.
 

Attachments

  • Incinerate Not Working.w3m
    17.2 KB · Views: 6
Last edited:
Level 3
Joined
Sep 28, 2018
Messages
38
I think you'll have to rely on a much more complicated approach using the systems I described before. Also, regarding that, the whole stacks resetting if you switch targets is unnecessary, I think I misunderstood what you wanted the ability to do. I was thinking of something similar to Troll Warlord's stacking attack speed from Dota 2 which resets upon switching targets. In other words, Attack Target and Stack Limit are totally optional.
So I was fortunate enough to get in contact with the dev who made the ability I'm trying to implement.
Been tinkering with it but it's not working yet. I'm not sure why but I imagine it's something to do with correctly registering the event.

Please take a look!
 
Last edited:

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,953
I created what I think is exactly what you wanted.

I left a text message in the trigger so you can see how much bonus dmg you're dealing:
  • Game - Display to (All players) for 30.00 seconds the text: (String(SD_Bonus[SD_CV]))
Feel free to delete it.

WARNING: If your map already has a Unit Indexer/Damage Engine then don't import a new one. You only ever want 1 of each System in your map.
 

Attachments

  • Stacking Attack Damage U1.w3x
    66 KB · Views: 18
Level 3
Joined
Sep 28, 2018
Messages
38
I created what I think is exactly what you wanted.

I left a text message in the trigger so you can see how much bonus dmg you're dealing:
  • Game - Display to (All players) for 30.00 seconds the text: (String(SD_Bonus[SD_CV]))
Feel free to delete it.

WARNING: If your map already has a Unit Indexer/Damage Engine then don't import a new one. You only ever want 1 of each System in your map.
WOWWWWWWW this is PRECISELY what I wanted to do. Thanks so much for your time and effort on this Uncle! Much appreciated. Now time for me to dig in and learn from your implementation. Thanks again - you have my sincerest thanks ;)
 
Status
Not open for further replies.
Top