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

Bouncing Attack

Status
Not open for further replies.
Level 8
Joined
Aug 5, 2014
Messages
194
I know there are many threads about bouncing attack, but none of the answer on my question. I need to increase damage with each bounce. I tried to:

Set damage loss factor to value higer than 1.00, for example 2.00. And it works very odd, because:

First target(default damage) -> second target(no damage at all) -> Third target(default damage) -> fourth target(no damage at all) ->fifth target(default damage)

Is if set damage loss factor to 3.00:

First target(default damage) -> second target(no damage at all) -> Third target(x3 damage) -> fourth target(no damage at all) ->fifth target(x9 damage)

When i set damage loss factor to negative value, all units just recivie default damage. And for some reason negative value works with chain lightning spell.

Is there any way to get damage increase with bouncing attack using only object editor?
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
use chain lightning as base, and set data-damage reduction per target to a negative value.

(setting negative values -

a. go to "File - Preferences" and allow negative values.
b. go to the value you want to change and press shift when you double click the field in object editor. then you can enter negative numbers.
)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
Level 8
Joined
Aug 5, 2014
Messages
194
You could script the bounce instead of using the ability with a missile system like this: Missiles and a Damage detector like this: Damage
I would write you a pseudocode, but I'm preffer using a code instead of GUI so I have to know what is your prefference first.
Yes, i planned to use damage detection system, if nothing gonna help. Relativistic missles could be handy, but im working with pre reforged 1.31 version.

Thank you for your offer of help. If it wount trouble you i will prefer GUI version, because its more readable for me. But i dont mind to have jass version, if other is not posdible.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
The relativistic missiles has also a pre-1.31 version, so you could use it as well, the problem is if you preffer GUI past it to your map would be hard, so better search other system, the most important thing is it should run a trigger when the missile reaches its target and also allows you store an integer, for the code you need store 3 things: the unit source, the damage and the number of bouncing, also make it MUI, the system would look like this:
(Asumming you are using the Damage Engine 3A.0.0.0 and 3.8.0.0)
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Spell = <Your spell>
      • Set CheckArea = <Your area>
      • Set MaxBounces = <The number you wanna>
      • Set DamageFactor = <Your damage factor>
      • Set DamageBanned = <Some integer except -1, 0, 1, 2, 3, 4>
      • Set Recycle[0] = 1
  • Bounce
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • DamageEventType Not equal to DamageBanned
      • ((Level of Spell for DamageEventSource) Greater than 0
    • Actions
      • Set TempLoc = (Position of DamageEventTarget)
      • -------- I think this is the how you wanna check the avaible units --------
      • Set TempGroup = (Units within CheckArea of TempLoc matching ((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is An structure) Equal to False)))
      • Set TempUnit = (Random unit of TempGroup)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • -------- Create the next missile --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempUnit Not equal to No unit
        • Then - Actions
          • -------- The Dynamic Indexing is not an option, you need allocation --------
          • -------- There are systems for that, but the main idea is: --------
          • Set Index = Recycle[0]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recycle[Index] == 0
            • Then - Actions
              • Set Recycle[0] = Index + 1
            • Else - Actions
              • Set Recycle[0] = Recycle[Index]
          • Set Source[Index] = DamageEventSource
          • Set Damage[Index] = DamageEventAmount
          • Set Bounce[Index] = MaxBounces
          • -------- Depending on how works the missile system you picked, you should do something like this --------
          • Do the stuff
          • The target is the TempUnit
          • Store the Index integer
          • Store the next trigger as the callback when the missile reaches the target
          • Create and lauch the missile
        • Else - Actions
  • OnHit
    • Events
    • Conditions
    • Actions
      • Set Index = <The stored integer>
      • Set Damage[Index] = Damage[Index] * DamageFactor
      • Set NextDamageType = DamageBanned
      • Unit - Cause Source[Index] to damage <The target>, dealing Damage[Index] damage of attack type Normal and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bounce[Index] Greater than 0
        • Then - Actions
          • -------- Repeat the process --------
          • Set TempLoc = (Position of <The target>)
          • Set TempGroup = (Units within <Your area> of TempLoc matching (((((Matching unit) belongs to an enemy of (Owner of Source[Index])) Equal to True) and (((Matching unit) is An structure) Equal to False))) and ((Matching unit) Not equal to <The target>))
          • Set TempUnit = (Random unit of TempGroup)
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Custom script: call DestroyGroup(udg_TempGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempUnit Not equal to No unit
            • Then - Actions
              • Set Bounce[Index] = Bounce[Index] - 1
              • Repeat again the missile creation, you don't need reasing the variables, just store again the Index
            • Else - Actions
              • -------- End the process and deallocate --------
              • Set Recycle[Index] = Recycle[0]
              • Set Recycle[0] = Index
        • Else - Actions
          • -------- End the process and deallocate --------
          • Set Recycle[Index] = Recycle[0]
          • Set Recycle[0] = Index
I could forgot something, but in GUI this should be the idea (obviously you have to name the variables in your own way, I just do it like that to make short the code).
 
Last edited:
Level 8
Joined
Aug 5, 2014
Messages
194
The relativistic missiles has also a pre-1.31 version, so you could use it as well, the problem is if you preffer GUI past it to your map would be hard, so better search other system, the most important thing is it should run a trigger when the missile reaches its target and also allows you store an integer, for the code you need store 3 things: the unit source, the damage and the number of bouncing, also make it MUI, the system would look like this:
(Asumming you are using the Damage Engine 3A.0.0.0 and 3.8.0.0)
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Spell = <Your spell>
      • Set CheckArea = <Your area>
      • Set MaxBounces = <The number you wanna>
      • Set DamageFactor = <Your damage factor>
      • Set DamageBanned = <Some integer except -1, 0, 1, 2, 3, 4>
      • Set Recycle[0] = 1
  • Bounce
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • DamageEventType Not equal to DamageBanned
      • ((Level of Spell for DamageEventSource) Greater than 0
    • Actions
      • Set TempLoc = (Position of DamageEventTarget)
      • -------- I think this is the how you wanna check the avaible units --------
      • Set TempGroup = (Units within CheckArea of TempLoc matching ((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is An structure) Equal to False)))
      • Set TempUnit = (Random unit of TempGroup)
      • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • -------- Create the next missile --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TempUnit Not equal to No unit
        • Then - Actions
          • -------- The Dynamic Indexing is not an option, you need allocation --------
          • -------- There are systems for that, but the main idea is: --------
          • Set Index = Recycle[0]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Recycle[Index] == 0
            • Then - Actions
              • Set Recycle[0] = Index + 1
            • Else - Actions
              • Set Recycle[0] = Recycle[Index]
          • Set Source[Index] = DamageEventSource
          • Set Damage[Index] = DamageEventAmount
          • Set Bounce[Index] = MaxBounces
          • -------- Depending on how works the missile system you picked, you should do something like this --------
          • Do the stuff
          • The target is the TempUnit
          • Store the Index integer
          • Store the next trigger as the callback when the missile reaches the target
          • Create and lauch the missile
        • Else - Actions
  • OnHit
    • Events
    • Conditions
    • Actions
      • Set Index = <The stored integer>
      • Set Damage[Index] = Damage[Index] * DamageFactor
      • Set NextDamageType = DamageBanned
      • Unit - Cause Source[Index] to damage <The target>, dealing Damage[Index] damage of attack type Normal and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Bounce[Index] Greater than 0
        • Then - Actions
          • -------- Repeat the process --------
          • Set TempLoc = (Position of <The target>)
          • Set TempGroup = (Units within <Your area> of TempLoc matching (((((Matching unit) belongs to an enemy of (Owner of Source[Index])) Equal to True) and (((Matching unit) is An structure) Equal to False))) and ((Matching unit) Not equal to <The target>))
          • Set TempUnit = (Random unit of TempGroup)
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Custom script: call DestroyGroup(udg_TempGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempUnit Not equal to No unit
            • Then - Actions
              • Set Bounce[Index] = Bounce[Index] - 1
              • Repeat again the missile creation, you don't need reasing the variables, just store again the Index
            • Else - Actions
              • -------- End the process and deallocate --------
              • Set Recycle[Index] = Recycle[0]
              • Set Recycle[0] = Index
        • Else - Actions
          • -------- End the process and deallocate --------
          • Set Recycle[Index] = Recycle[0]
          • Set Recycle[0] = Index
I could forgot something, but in GUI this should be the idea (obviously you have to name the variables in your own way, I just do it like that to make short the code).
Thank you, i will try out your solution. Is it fits for autoattack with many instances from one unit, and a lot of units spamming it?
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Thank you, i will try out your solution. Is it fits for autoattack with many instances from one unit, and a lot of units spamming it?
It is MUI it means multi-instanceable, so you can literally spam it without an issue even from a lot of units (the unique limit would be your PC capacity and try to don't have more than 8191 instances at the time).

PD: I forgot add the condition in the Bounce trigger:
  • IsDamageSpell Equal to False
PD2: I'm not sure how exactly works the bounce in the normal W3, but I don't think it is searching a random unit in a range, I think it searches for the nearest unit, so it requires more work, because you have to check every unit and what has the lowest distance between it and the target, I didn't find a system for that in GUI but here is for sort Merge Sort [GUI Friendly] v1.01
So acording with that system it should be like this:
  • Set TempLoc = (Position of DamageEventTarget)
  • Set TempGroup = (Units within CheckArea of TempLoc matching ((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is An structure) Equal to False)))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (TempGroup is empty) Equal to False
    • Then - Actions
      • Set MSort_Ascending = True
      • Set TempIndex = 0
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • -------- Increment the Index --------
          • Set TempIndex = (TempIndex + 1)
          • -------- Store the Unit to an array --------
          • Set TempUnitArray[TempIndex] = (Picked unit)
          • -------- Store the value to be compared in MSort_Values --------
          • Set TempLoc2 = (Position of (Picked unit))
          • Set MSort_Values[TempIndex] = (Distance between TempLoc and TempLoc2)
          • Custom script: call RemoveLocation(udg_TempLoc2)
          • -------- IMPORTANT: Initialize the Indices --------
          • Set MSort_IndexInitial[TempIndex] = TempIndex
      • -------- Run the Trigger to Sort the Values --------
      • Set MSort_StartIndex = 1
      • Set MSort_EndIndex = TempIndex
      • Trigger - Run Merge Sort <gen> (checking conditions)
      • -------- You only need the first unit in the list --------
      • Set TempUnit = TempUnitArray[MSort_Indices[1]]
      • -------- Do the rest of the system --------
    • Else - Actions
  • Custom script: call RemoveLocation(udg_TempLoc)
  • Custom script: call DestroyGroup(udg_TempGroup)
 
Last edited:
Level 8
Joined
Aug 5, 2014
Messages
194
It is MUI it means multi-instanceable, so you can literally spam it without an issue even from a lot of units (the unique limit would be your PC capacity and try to don't have more than 8191 instances at the time).

PD: I forgot add the condition in the Bounce trigger:
  • IsDamageSpell Equal to False
PD2: I'm not sure how exactly works the bounce in the normal W3, but I don't think it is searching a random unit in a range, I think it searches for the nearest unit, so it requires more work, because you have to check every unit and what has the lowest distance between it and the target, I didn't find a system for that in GUI but here is for sort Merge Sort [GUI Friendly] v1.01
So acording with that system it should be like this:
  • Set TempLoc = (Position of DamageEventTarget)
  • Set TempGroup = (Units within CheckArea of TempLoc matching ((((Matching unit) belongs to an enemy of (Owner of DamageEventSource)) Equal to True) and (((Matching unit) is An structure) Equal to False)))
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (TempGroup is empty) Equal to False
    • Then - Actions
      • Set MSort_Ascending = True
      • Set TempIndex = 0
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • -------- Increment the Index --------
          • Set TempIndex = (TempIndex + 1)
          • -------- Store the Unit to an array --------
          • Set TempUnitArray[TempIndex] = (Picked unit)
          • -------- Store the value to be compared in MSort_Values --------
          • Set TempLoc2 = (Position of (Picked unit))
          • Set MSort_Values[TempIndex] = (Distance between TempLoc and TempLoc2)
          • Custom script: call RemoveLocation(udg_TempLoc2)
          • -------- IMPORTANT: Initialize the Indices --------
          • Set MSort_IndexInitial[TempIndex] = TempIndex
      • -------- Run the Trigger to Sort the Values --------
      • Set MSort_StartIndex = 1
      • Set MSort_EndIndex = TempIndex
      • Trigger - Run Merge Sort <gen> (checking conditions)
      • -------- You only need the first unit in the list --------
      • Set TempUnit = TempUnitArray[MSort_Indices[1]]
      • -------- Do the rest of the system --------
    • Else - Actions
  • Custom script: call RemoveLocation(udg_TempLoc)
  • Custom script: call DestroyGroup(udg_TempGroup)
Thank you. Will see how it works.
 
Status
Not open for further replies.
Top