• 🏆 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 damage scaling with unit attack damage?

Status
Not open for further replies.
Level 5
Joined
Jun 21, 2013
Messages
116
I am trying to make a unit that would scale indefinitely, he gains 1 damage every time he kills a unit. However, in the late game phase, when he has 1000 damage, and his spells deal 200, spells are useless.
Is there any way to make a spell scale with unit's attack damage or attribute? Since I can't make infinitely many levels for abilities, but I can't find and event "spell hits a unit".
Help?
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Yes. The spells have to be triggered though or at the very least the damage must be triggered.

When your unit casts a spell like Thunder Clap, you would get the unit's location, create a group pick the units that are enemies, close enough, alive etc.

Then you would deal dmg based on the level of Thunder Clap + Value of the Str/Agi/Int of your unit w/ or w/o bonuses.

Or you could deal dmg based on the level of Thunder Clap + (Value of the number of kills that unit has * some factor.)

Edit: To clarify, you can't see a unit's attack damage to then deal damage based on that, but you can save how much damage they've gained therefore knowing how much they have and that allows you to deal damage based on the unit's attack damage.
 
Level 5
Joined
Jun 21, 2013
Messages
116
Yes. The spells have to be triggered though or at the very least the damage must be triggered.

When your unit casts a spell like Thunder Clap, you would get the unit's location, create a group pick the units that are enemies, close enough, alive etc.

Then you would deal dmg based on the level of Thunder Clap + Value of the Str/Agi/Int of your unit w/ or w/o bonuses.

Or you could deal dmg based on the level of Thunder Clap + (Value of the number of kills that unit has * some factor.)

Edit: To clarify, you can't see a unit's attack damage to then deal damage based on that, but you can save how much damage they've gained therefore knowing how much they have and that allows you to deal damage based on the unit's attack damage.

Thunder Clap is a simple spell. I was thinking of spells like Shockwave (cone damage), or Firebolt (delay until projectile reaches target), and that's what I ahve problems with.
 
Level 5
Joined
Feb 18, 2016
Messages
96
For target abilities you can make a custom buff to detect the objective and add it to the spell

  • Q spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SomeSpell
    • Actions
      • Set SpellTarget = (Target unit of ability being cast)
      • Set SpellCaster = (Casting unit)
      • Wait until ((SpellTarget has buff CustomBuff) Equal to True), checking every 0.10 seconds
      • Unit - Cause SpellCaster to damage SpellTarget, dealing ((Real((Strength of (SpellCaster) (Include bonuses)))) x 1.00) damage of attack type Chaos and damage type Enhanced
      • Set SpellCaster = No unit
      • Set SpellTarget = No unit
This should work with a 0.1 delay


For AOE damage you can try the same but first picking all units in range of ability cast and wait for the buff
  • W Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Another Spell lol
    • Actions
      • Set AnotherSpellTarget = (Units within 400.00 of (Target point ability being cast))
      • Unit Group - Pick every unit in AnotherSpellTarget and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of Casting unit)) Equal to True
            • Then - Actions
              • Wait until (((Picked unit) has buff AnotherBuff) Equal to True), checking every 0.10 seconds
              • Unit - Cause (Casting Unit) to damage (Picked unit), dealing (1.00 x (Real((Agility of (Casting unit) (Include bonuses))))) damage of attack type Spells and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup (udg_AnotherSpellTarget)
 
Level 11
Joined
Jan 2, 2016
Messages
472
Well for Firebolt ,maybe you could count the seconds it takes for the firebolt to reach the target.
Get position of casting unit , target unit , missle speed. So (position of target unit - casting unit)/missle speed = X and then after X seconds deal dmg. When i say position i mean the cooridinates of units. But i doubt this would be practical.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
Thunder Clap is a simple spell. I was thinking of spells like Shockwave (cone damage), or Firebolt (delay until projectile reaches target), and that's what I ahve problems with.


Okay. Then use this spell as a template and read this tutorial on how to index and what is going on.

Visualize: Dynamic Indexing

  • Laser Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Laser
    • Actions
      • Set Laser_MaxIndex = (Laser_MaxIndex + 1)
      • Set Laser_Caster[Laser_MaxIndex] = (Triggering unit)
      • Set Laser_Target[Laser_MaxIndex] = (Target unit of ability being cast)
      • Set TempLoc = (Position of Laser_Caster[Laser_MaxIndex])
      • Set TempLoc2 = (Position of Laser_Target[Laser_MaxIndex])
      • Unit - Create 1 Laser for (Triggering player) at TempLoc facing (Angle from TempLoc to TempLoc2) degrees
      • Set Laser_Dummy[Laser_MaxIndex] = (Last created unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Laser_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on Laser Loop <gen>
        • Else - Actions
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call RemoveLocation(udg_TempLoc2)
  • Laser Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Laser_CurrentIndex) from 1 to Laser_MaxIndex, do (Actions)
        • Loop - Actions
          • Set TempLoc = (Position of Laser_Dummy[Laser_CurrentIndex])
          • Set TempLoc2 = (Position of Laser_Target[Laser_CurrentIndex])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between TempLoc and TempLoc2) Less than or equal to Laser_Threshold
            • Then - Actions
              • Unit - Create 1 Laser (dummy) for (Owner of Laser_Dummy[Laser_CurrentIndex]) at TempLoc facing Default building facing degrees
              • Set TempUnit = (Last created unit)
              • Unit - Add a 0.50 second Generic expiration timer to TempUnit
              • Unit - Kill Laser_Dummy[Laser_CurrentIndex]
              • Unit - Order TempUnit to Undead Banshee - Curse Laser_Target[Laser_CurrentIndex]
              • Unit - Cause TempUnit to damage Laser_Target[Laser_CurrentIndex], dealing ((Real((Level of Laser for Laser_Caster[Laser_CurrentIndex]))) x 75.00) damage of attack type Chaos and damage type Universal
              • Set Laser_Dummy[Laser_CurrentIndex] = Laser_Dummy[Laser_MaxIndex]
              • Set Laser_Caster[Laser_CurrentIndex] = Laser_Caster[Laser_MaxIndex]
              • Set Laser_Target[Laser_CurrentIndex] = Laser_Target[Laser_MaxIndex]
              • Set Laser_CurrentIndex = (Laser_CurrentIndex - 1)
              • Set Laser_MaxIndex = (Laser_MaxIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Laser_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • Set TempReal = (Angle from TempLoc to TempLoc2)
              • Custom script: call SetUnitX(udg_Laser_Dummy[udg_Laser_CurrentIndex], GetUnitX(udg_Laser_Dummy[udg_Laser_CurrentIndex]) + udg_Laser_SpeedInterval * Cos(bj_DEGTORAD * udg_TempReal))
              • Custom script: call SetUnitY(udg_Laser_Dummy[udg_Laser_CurrentIndex], GetUnitY(udg_Laser_Dummy[udg_Laser_CurrentIndex]) + udg_Laser_SpeedInterval * Sin(bj_DEGTORAD * udg_TempReal))
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Custom script: call RemoveLocation(udg_TempLoc2)

In this example, the unit casts a "laser" on a target unit, the laser flies toward the unit until it "hits" it upon which it is damaged and blinded.

You just need to deal the damage as I described in my previous post.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
For target abilities you can make a custom buff to detect the objective and add it to
the spell
Dont do this.

But i doubt this would be practical.
It is indeed impractical because it doesnt work if the target is moving.

I would have to recommend using a missile system if you want to do it really good (aka coding the spells' effects yourself so you have maximum control over their behavior... and damage).

But it can be done much easier.
If you take a spell that has a buff... like Frost Wave (instead of Shockwave), you can use a Damage Detection System (DDS) to have a generic onDamage event.
If a unit that is damaged has that buff, you remove the buff and increase the damage based on the stacks of whatever you want to stack.
(The buff has to be removed so other damages wouldnt be count as this damage as well. If you still want to have the buff, then you should make a dummy unit and cast another ability that creates a different buff with the text and effects you want... DONT use the buff of the frost wave.)

For Firebolt, Storm Bolt, etc this is also a way to do it. However, these abilities have a stun which interrupts the target no matter what.
Acid Bomb however can be used instead as it doesnt stun the target... and still has a buff.
 
Status
Not open for further replies.
Top