• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Increase attack damage base on range or movement speed

Status
Not open for further replies.
Level 2
Joined
Mar 1, 2020
Messages
22
I want to make some passive spells like

- increase attack damage base on 10% range of attacking unit
or increase attack damage base on 10% movement speed of attacking unit

I think we will use Damage Engine. But how to make it increase to 15/20/25% depend on level of ability.
Thank you.
 
Level 16
Joined
May 2, 2011
Messages
1,345
Hello,

just to make it clear: there are two possibilities here:
  1. give bonus = 10% of maximum Attack range of attacking unit
  2. give bonus = 10% of the distance between attacking unit and Target unit at the instance of the attack (this can be more than max attack range if unit is running away, or less if unit is in melee range of the attacker)
which one of those you want?

also, yes you are right. Damage Detection System can be used to solve it. in fact, the movement speed % bonus will be very easy to code.
im not sure about the attack range. (I forgot if there is trigger function that pulls the attack range of attacking unit, but im sure there is one to get movespeed.)
 
Level 12
Joined
Feb 5, 2018
Messages
521
You can get attack range, with the new "get unit real field"
  • Set VariableSet AttackRange = (Unit: DamageEventSource's Weapon Real Field: Attack Range ('ua1m') at Index:0)
 
Level 12
Joined
Feb 5, 2018
Messages
521
Well how could I possibly know what version is he using. :)

He asked if it's possible and I gave an option how to do it.
 
Level 2
Joined
Mar 1, 2020
Messages
22
hmmmm, also
did this post get drafted?

yes but maybe he only has 1.26 like me
Yes, I only has 1.24e.
And I just want a skill like Enchantress Impetus (Dota), passive.
I also don't know how to do it => maximum Attack range of attacking unit :cute:
So... Thank you :cute: Hope your reply


You can get attack range, with the new "get unit real field"
  • Set VariableSet AttackRange = (Unit: DamageEventSource's Weapon Real Field: Attack Range ('ua1m') at Index:0)
Thank, but i just want to increase attack damage. Is that increase range :razz:
 
Level 12
Joined
Feb 5, 2018
Messages
521
I can't remember all the functions available in 1.24e. But here is a trigger that should work in that version.
It is just a quick draft to give you an idea how you could do it :)

  • Impetus
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Rifleman
    • Actions
      • -------- A quick draft on how to do it --------
      • Set VariableSet Loc1 = (Position of (Attacking unit))
      • -------- ------------ --------
      • Set VariableSet Loc2 = (Position of (Triggering unit))
      • -------- ------------ --------
      • Set VariableSet Distance = (Distance between Loc1 and Loc2)
      • -------- ------------ --------
      • Set VariableSet Damage = (Distance x 0.10)
      • -------- ------------ --------
      • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing Damage damage of attack type Spells and damage type Normal
      • -------- ------------ --------
      • Floating Text - Create floating text that reads (+ + (String((Integer(Damage))))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • -------- --->Remove Leaks<--- --------
      • Custom script: call RemoveLocation (udg_Loc1)
      • Custom script: call RemoveLocation (udg_Loc2)
 
Level 16
Joined
May 2, 2011
Messages
1,345
Yes, I only has 1.24e.
And I just want a skill like Enchantress Impetus (Dota), passive.
I also don't know how to do it => maximum Attack range of attacking unit :cute:
So... Thank you :cute: Hope your reply
Thank, but i just want to increase attack damage. Is that increase range :razz:

Becareful, Impetus in dota
  1. Checks distance between attacker and target at the time the attack projectile reaches the target,
  2. NOT the distance when the projectile is launched.

DDS system can do this.
your trigger will look like this:
Set TemporaryPoint01 = Position of DamageSource
Set TemporaryPoint02 = Position of Target
Set Distance = Distance between 2 points (Point01 and Point02)
Cause DamageSource to Damage Target with (YourBonus X Distance).

Your trigger should be working now.
All that remains is to remove leaks if any exists.



I can't remember all the functions available in 1.24e. But here is a trigger that should work in that version.
It is just a quick draft to give you an idea how you could do it :)

  • Impetus
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Rifleman
    • Actions
      • -------- A quick draft on how to do it --------
      • Set VariableSet Loc1 = (Position of (Attacking unit))
      • -------- ------------ --------
      • Set VariableSet Loc2 = (Position of (Triggering unit))
      • -------- ------------ --------
      • Set VariableSet Distance = (Distance between Loc1 and Loc2)
      • -------- ------------ --------
      • Set VariableSet Damage = (Distance x 0.10)
      • -------- ------------ --------
      • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing Damage damage of attack type Spells and damage type Normal
      • -------- ------------ --------
      • Floating Text - Create floating text that reads (+ + (String((Integer(Damage))))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • -------- --->Remove Leaks<--- --------
      • Custom script: call RemoveLocation (udg_Loc1)
      • Custom script: call RemoveLocation (udg_Loc2)

That actually seems good to remove leaks. Be careful However, this isnt exactly like impetus. I think it is better to use DDS in this case.
let me quote myself
  1. Checks distance between attacker and target at the time the attack projectile reaches the target,
  2. NOT the distance when the projectile is launched.

I think what @DoomBlade did was 2-) not 1-)
his trigger seems just fine. its up for @Norris to decide how exactly he wants the ability to work
 
Level 2
Joined
Mar 1, 2020
Messages
22
Thank you, both of you. I tried it and I have a problem.
Looks like damage was caused before the projectile touched the target. I don't know why and how to fix it

  • Untitled Trigger 005
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Archmage
    • Actions
      • Set Location = (Position of DamageEventSource)
      • Set Location2 = (Position of (Attacked unit))
      • Set DamageByRangeDistance = (Integer((Distance between Location and Location2)))
      • Set DamageByRangeDamage = (DamageByRangeDistance x 1)
      • Unit - Cause (Attacking unit) to damage (Triggering unit), dealing (Real(DamageByRangeDamage)) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation (udg_Location)
      • Custom script: call RemoveLocation (udg_Location2)
 
Level 12
Joined
Feb 5, 2018
Messages
521
Change the event to "DamageEvent becomes equal to 1.00 --> found under game value of real variable.

Also change Location2 = Position of DamageEventTarget

Also change the damage part to cause DamageEventSource to deal X damage to DamageEventTarget.
 
Level 12
Joined
Feb 5, 2018
Messages
521
Seems like you are missing the config file.
Maybe the owner of the tool could help you on this one.

I added a working damage engine from my map to your map and it still didn't work.
It works on my map tho.

@Bribe
 
Level 2
Joined
Mar 1, 2020
Messages
22
It crash when I use PDD
When Dark Ranger attack. It crash immediately

  • PDD Damage By Ranage
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • (Unit-type of PDD_source) Equal to Dark Ranger
    • Actions
      • Set Location = (Position of PDD_source)
      • Set Location2 = (Position of PDD_target)
      • Set DamageByRangeDistance = (Integer((Distance between Location and Location2)))
      • Set DamageByRangeDamage = (DamageByRangeDistance x 1)
      • Unit - Cause PDD_source to damage PDD_target, dealing (Real(DamageByRangeDamage)) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation (udg_Location)
      • Custom script: call RemoveLocation (udg_Location2)
 

Attachments

  • Physical Damage Detection v1.3.0.0 GUI.w3x
    42.4 KB · Views: 42
Level 16
Joined
May 2, 2011
Messages
1,345
thats wierd.

its says there that recommended version is 1.21b, and I also got it to work even in 1.26. it should work in 1.24 as well.


just to double check, did you follow the How to implement instructions?

why dont you try and download that Physical Damage Detection for GUI v1.3.0.0 and meddle with that map itself, see if its working there, and then move it to your map?

my guess is that you havent moved it to your map properly, but thats a guess. (maybe variables were not created while you copy)

first try your code on LFH map and if its not working there, then there is something is wrong with the code, if its working there, then it hasnt been moved properly.


Edit: so basically your mession now is to download LFH Physical Damage Detection for GUI v1.3.0.0 and check if your code works there perfectly or not.
if its working fine then import it to your map.

I see you probably have downloaded it already.
LFH wrote notes about life drain. I hope you are not using that for the damage.
 
Last edited:
Level 2
Joined
Mar 1, 2020
Messages
22
It seems like I had to update my warcraft 3. Hope my map compatible and everything alright.
 
Level 16
Joined
May 2, 2011
Messages
1,345
I have version switcher which switches between 1.26, 1.25 and 1.24 (you can find it if you search DotA utilites)

but its certainly weird. I am not expecting this to be version issue.

Be sure to back-up your warcraft before you use this.

Also, go post in LFH thread, he might be able to help you.
 
Last edited:
Level 14
Joined
Dec 12, 2012
Messages
1,007
To
It crash when I use PDD
When Dark Ranger attack. It crash immediately

  • PDD Damage By Ranage
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • (Unit-type of PDD_source) Equal to Dark Ranger
    • Actions
      • Set Location = (Position of PDD_source)
      • Set Location2 = (Position of PDD_target)
      • Set DamageByRangeDistance = (Integer((Distance between Location and Location2)))
      • Set DamageByRangeDamage = (DamageByRangeDistance x 1)
      • Unit - Cause PDD_source to damage PDD_target, dealing (Real(DamageByRangeDamage)) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation (udg_Location)
      • Custom script: call RemoveLocation (udg_Location2)

To me that looks like an infinite loop: On damage, you want source to deal damage to target. This will execute the trigger again, infinitely.

Please refer to the example in the test map on how to deal damage from within an OnDamage trigger (its the last line custon script in the GUI example), or just modifiy the dealt damage by modfying PDD_amount.
 
Level 2
Joined
Mar 1, 2020
Messages
22
Is this right? I tested it and it seem to be ok

  • PDD Damage By Ranage
    • Events
      • Game - PDD_damageEventTrigger becomes Equal to 1.00
    • Conditions
      • (Unit-type of PDD_source) Equal to Dark Ranger
    • Actions
      • Set Location = (Position of PDD_source)
      • Set Location2 = (Position of PDD_target)
      • Set DamageByRangeDistance = (Integer((Distance between Location and Location2)))
      • Set PDD_amount = ((Real(DamageByRangeDistance)) x 0.10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PDD_target Equal to Dark Ranger 0030 <gen>
        • Then - Actions
          • Custom script: call UnitDamageTargetEx(udg_PDD_source, udg_PDD_target, udg_PDD_amount, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNIVERSAL, null)
        • Else - Actions
      • Custom script: call RemoveLocation (udg_Location)
      • Custom script: call RemoveLocation (udg_Location2)
 

Attachments

  • Physical Damage Detection v1.3.0.0 GUI.w3x
    42.6 KB · Views: 33
Level 16
Joined
May 2, 2011
Messages
1,345
Now all that remains is that you are sure its doing what you were intended to do in the beginning, and not something slightly different.
just to make it clear: there are two possibilities here:
  1. give bonus = 10% of maximum Attack range of attacking unit
  2. give bonus = 10% of the distance between attacking unit and Target unit at the instance of the attack (this can be more than max attack range if unit is running away, or less if unit is in melee range of the attacker)
 
Status
Not open for further replies.
Top