• 🏆 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!

[General] Lightning Attack & Feedback(mana break)

Status
Not open for further replies.
Level 11
Joined
Sep 11, 2013
Messages
327
Hi again!
How can i trigger the Lightning attack effect on a specifc type of unit(I want the unit to attack with that effect)?
The problem is that, my unit has lightning attack and mana break and i think those 2 are orb effects and only the mana break is visible and i need to see how the unit attack with that lighting attack(only for graphic effect)

The help will be appreciated!:peasant-bowing:
 
Level 12
Joined
Jan 10, 2023
Messages
191
You could try using the Bloodmage ability 'Sphere' as the base ability for the other effect. It also has attachment points, lightning shield or some others may also be preferable depending on the need.
 
Level 12
Joined
Jan 10, 2023
Messages
191
I don't understand how "Sphere" will help me to put lightning projectile on attack on a unit:peasant-confused:

It won't! You didn't specify that it was a projectile effect, you said attack effect, which is pretty vague imo, but you mentioned orb effects and that made me think of attachment effects.
 
Level 11
Joined
Sep 11, 2013
Messages
327
Use the Takes Damage event to trigger the effects of Feedback.

A unit takes damage -> Damage source has Feedback ability -> Subtract mana from Damage target

Then you can replace Feedback with something like Storm Hammers which serves solely as an Icon/Tooltip.
  • Untitled Trigger 001
    • Events
      • Unit - A unit Takes damage
    • Conditions
    • Actions
      • Unit - Set mana of (Damage Target) to ((Mana of (Damage Target)) - 100.00)
I don't know where is that "has" ability condition and i am not sure if i put the right action..

I need a little help:D

It won't! You didn't specify that it was a projectile effect, you said attack effect, which is pretty vague imo, but you mentioned orb effects and that made me think of attachment effects.
Sorry about that..
 
Level 12
Joined
Jan 10, 2023
Messages
191
If you use a custom script:
  • Custom script: If UnitRemoveAbility( unit, abilitycode ) == true then
  • Custom script: UnitAddAbility( unit, abilitycode ) // <- the function in the condition of the if/then would have removed it, I believe
  • < do other stuff >
  • Custom script: endif
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
To check if a Unit has an ability you simply check the Level of the ability using an Integer comparison. If it's 0 then the ability doesn't exist.
  • Conditions
    • (Level of Feedback (New) for (Damage source)) Greater than 0
The final result could look something like this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Feedback (New) for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Unit - Set mana of (Damage Target) to ((Mana of (Damage Target)) - 100.00)
      • Special Effect - Create a special effect attached to the origin of (Damage Target) using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
      • Special Effect - Destroy (Last created special effect)
I also added a Condition to check if the damage came from a normal attack. It's a Boolean comparison you can find at the bottom of the list of functions.

Note that this will now perform Feedback to multiple targets if your attacks deal splash damage. Also, you probably want to check if your (Damage Target) even has Mana to begin with. If you want to add the mana burn damage effect to it then you'll need to calculate how much mana was actually removed and then multiply that by some factor. It's not that difficult, I could show you how if you'd like.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
Work perfect! Thanks!


I still don't know why i need this:?
Look at the Event: A unit takes damage

That's ANY damage dealt. So if you cast Storm Bolt, Thunderclap, Chain Lightning, etc. the damage from those spells is going to run the Event.

So as a fix we exclude Spells from this by checking if it was a Normal Attack.

If you wanted to you could include Spells and for example create a mana burning Chain Lightning effect ;)
It can be pretty neat once you realize all of the possibilities.
 
Level 11
Joined
Sep 11, 2013
Messages
327
Look at the Event: A unit takes damage

That's ANY damage dealt. So if you cast Storm Bolt, Thunderclap, Chain Lightning, etc. the damage from those spells is going to run the Event.

So as a fix we exclude Spells from this by checking if it was a Normal Attack.

If you wanted to you could include Spells and for example create a mana burning Chain Lightning effect ;)
It can be pretty neat once you realize all of the possibilities.
I understand & i don't need chain lightning effect for the moment to burn mana :), but thanks for idea.

I just found out another problem, in the data field of "feedback" ability is Data - Damage Ratio - Heros (%) : 1.000.

That mean my trigger will don't do extra damage when it burn mana of the enemy..

Is there a simple way to solve this? I mean as long enemy has mana there will be 1 damage per 1 mana burned or something like that.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
I understand & i don't need chain lightning effect for the moment to burn mana :), but thanks for idea.

I just found out another problem, in the data field of "feedback" ability is Data - Damage Ratio - Heros (%) : 1.000.

That mean my trigger will don't do extra damage when it burn mana of the enemy..

Is there a simple way to solve this? I mean as long enemy has mana there will be 1 damage per 1 mana burned or something like that.
So now we're entering true custom ability territory. This is a pretty simple one to recreate though:
  • Feedback
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Feedback (Custom) for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet Feedback_Target = (Damage Target)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Feedback_Target is A structure) Equal to False
          • Or - Any (Conditions) are true
            • Conditions
              • (Max mana of Feedback_Target) Greater than 0.00
              • (Feedback_Target is Summoned) Equal to True
        • Then - Actions
          • Set VariableSet Feedback_Source = (Damage source)
          • -------- --------
          • -------- Create a special effect to visualize the burn: --------
          • Special Effect - Create a special effect attached to the origin of Feedback_Target using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
          • Special Effect - Destroy (Last created special effect)
          • -------- --------
          • -------- Get the amount of mana that should be burned based on hero/unit conditions: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Feedback_Target is A Hero) Equal to True
            • Then - Actions
              • Set VariableSet Feedback_Amount = 12.00
              • Set VariableSet Feedback_Multiplier = 1.00
            • Else - Actions
              • Set VariableSet Feedback_Amount = 24.00
              • Set VariableSet Feedback_Multiplier = 1.00
          • -------- --------
          • -------- Calculate the total mana burned: --------
          • Set VariableSet Feedback_ManaLost = ((Mana of Feedback_Target) - Feedback_Amount)
          • -------- --------
          • -------- If the unit had less mana than the amount being burned then account for this: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Feedback_ManaLost Less than 0.00
            • Then - Actions
              • Set VariableSet Feedback_Amount = (Feedback_Amount + Feedback_ManaLost)
            • Else - Actions
          • -------- --------
          • -------- Subtract the mana from the target: --------
          • Unit - Set mana of Feedback_Target to ((Mana of Feedback_Target) - Feedback_Amount)
          • -------- --------
          • -------- Get the summon bonus damage (if any): --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Feedback_Target is Summoned) Equal to True
            • Then - Actions
              • Set VariableSet Feedback_Amount = (Feedback_Amount + 20.00)
            • Else - Actions
          • -------- --------
          • -------- Deal the damage. The Feedback_Multiplier is the Ratio that can be found on the ability: --------
          • Unit - Cause Feedback_Source to damage Feedback_Target, dealing (Feedback_Amount x Feedback_Multiplier) damage of attack type Spells and damage type Normal
        • Else - Actions
Notes:
My Feedback damage is counted as a separate source of Spell damage which may be incorrect. Also, I assumed that the Summon bonus damage didn't add to the amount of mana burned. If it does, the fix is to subtract the mana after adding the bonus damage instead of before.

Edit: Fixed it so it doesn't work against structures.
 

Attachments

  • Custom Feedback 1.w3m
    19.8 KB · Views: 4
Last edited:
Level 4
Joined
May 12, 2022
Messages
22
I also tested a bit and came up with this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of 'Spell' for (Damage source)) Equal to 1
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Set VariableSet realTT = (Mana of (Triggering unit))
      • Unit - Set mana of (Triggering unit) to (realTT - 10.00)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Triggering unit)) Greater than 10.00
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 10.00)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of (Triggering unit)) Less than 10.00
            • Then - Actions
              • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - realTT)
            • Else - Actions
      • Special Effect - Create a special effect attached to the origin of (Damage Target) using Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
      • Special Effect - Destroy (Last created special effect)
It is a bit on the basic side and may not do the job as well as the trigger Uncle made but it seems to work at least.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
That'll work just fine but know that subtracting life from a unit bypasses armor/damage reduction and will not give kill credit. No experience will be rewarded, no bounty, and any triggers using the (Killing unit) Event Response will not function properly since there was no (Killing unit). Also, you can improve the efficiency of the trigger by replacing (Triggering unit) with a variable.
 
Status
Not open for further replies.
Top