• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Need Help Making a bouncing spell (With damage Engine 5.0.0)

Level 4
Joined
Apr 8, 2021
Messages
31
Hi i'm trying to make a firebolt that bounce on a new close target when it touch/damage a target but it doesn't work, what did i do wrong ?

(Just in case i tried with OnDamageEvent, but it didn't change anything)
 

Attachments

  • image_2025-01-16_182623177.png
    image_2025-01-16_182623177.png
    29.1 KB · Views: 11

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
Does Firebolt actually deal "FIRE" damage? When debugging something you need to confirm which parts of your trigger work. Rule out any "bad" conditions:
  • Custom script: if BlzGetEventDamageType == DAMAGE_TYPE_FIRE then
  • Game - Display to (All players) for 30.00 seconds the text: IT WORKS
  • Custom script: endif
Also, your Unit Group is going to be filled with Dead units and other unwanted targets. You need to Filter it properly. Plus I think the Event is supposed to be "Equal to" not "Greater than or equal to". Lastly, here's how you can post your triggers on Hive (it helps everyone):

Then here's a quick example I threw together of a working bounce effect:
  • Firebolt Bounce
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Sorceress
    • Actions
      • Set VariableSet Firebolt_Source = (Damage source)
      • Set VariableSet Firebolt_Target = (Damage Target)
      • Set VariableSet Firebolt_Point = (Position of Firebolt_Target)
      • Set VariableSet Firebolt_Group = (Units within 412.00 of Firebolt_Point.)
      • Set VariableSet Firebolt_Target_Count = 0
      • -------- --------
      • Unit Group - Pick every unit in Firebolt_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet Firebolt_Random_Target = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Firebolt_Random_Target is alive) Equal to True
              • (Firebolt_Random_Target belongs to an enemy of (Owner of Firebolt_Source).) Equal to True
              • Firebolt_Random_Target Not equal to Firebolt_Target
              • (Firebolt_Random_Target is A structure) Equal to False
              • (Firebolt_Random_Target is Magic Immune) Equal to False
              • (Firebolt_Random_Target is invulnerable) Equal to False
            • Then - Actions
              • Set VariableSet Firebolt_Target_Count = (Firebolt_Target_Count + 1)
            • Else - Actions
              • Unit Group - Remove Firebolt_Random_Target from Firebolt_Group.
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Firebolt_Target_Count Greater than 0
        • Then - Actions
          • Set VariableSet Firebolt_Random_Target = (Random unit from Firebolt_Group)
          • Unit - Create 1 Dummy (Caster) for (Owner of Firebolt_Source) at Firebolt_Point facing Default building facing degrees
          • Set VariableSet Firebolt_Dummy = (Last created unit)
          • Unit - Add a 2.00 second Generic expiration timer to Firebolt_Dummy
          • Unit - Add Firebolt (Dummy) to Firebolt_Dummy
          • Unit - Order Firebolt_Dummy to Neutral - Firebolt Firebolt_Random_Target
        • Else - Actions
      • -------- --------
      • Custom script: call RemoveLocation( udg_Firebolt_Point )
      • Custom script: call DestroyGroup( udg_Firebolt_Group )
Notes:
  • I filter out units that cannot be targeted by Firebolt.
  • I only create a Dummy unit IF there's an actual target found.
  • I use more variables to avoid potential issues and to keep things efficient.
  • You rarely need to create a brand new Dummy unit in the Object Editor. The one in my map is setup to cast any number of spells without issues and can be reused throughout most if not all of your Dummy related triggers.
Edit: Minor optimization to how the (Damage Target) gets removed from the group. Updated trigger + map.
 

Attachments

  • Firebolt Bounce 2.w3m
    19.3 KB · Views: 1
Last edited:
Level 4
Joined
Apr 8, 2021
Messages
31
Thank you Mr.Uncle ! i will next time post trigger for sure !! I learnt a lot thank to what you explain, i will be able to reduce problems in a lot of different triggers i did, i didn't thought about dead units took in account for picked units for example ! Thanks again, i rly love this commuinity, there is always people to help others, ty :D
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Does Firebolt actually deal "FIRE" damage?
Yeah, it should. But I generally agree with you that using the damage type as a pass/fail filter is a terrible idea. Also match the level of the dummy cast to the level of the original cast!

Angedayle, what Uncle didn't mention here is that while knowing when a unit takes damage is made trivial by natives/systems it's actually pretty difficult to determine what action caused that damage.

For example: if a Mountain King attacks me, casts a Thunderclap that hits me and some others, and also is ordered by a trigger to damage me as a part of some spell... all of those will fire the damage event with the damage source as the MK with no way to differentiate between which ability/attack was used. You can't use the damage amounts because those are affected by armor value, armor type, and the damage/weapon type itself. Some systems can determine if damage was done by an attack (as the Damage from Normal Attack native can now do), but there's no way to tell different spells apart. Code damage can be determined if you plan ahead to keep track of it.

In order to resolve this, the easiest solution is just to not let the MK damage me with its spell directly. Instead of the MK casting Thunderclap or Storm Bolt, a 'fake' dummy ability that does nothing is given to the hero, and upon that cast a trigger creates a dummy caster, gives it the correct 'real' ability before ordering the dummy to cast. Now when the damage event fires you can check to see if the damage was done by a dummy caster, and if that dummy caster also has the Thunderclap ability then the damage was dealt by TC. If the dummy has the Storm Bolt ability then the damage was dealt by SB.

Crucially this requires the dummy caster not to be reused for different spells, and the dummy caster must stay alive until the spell it actually cast can no longer deal any damage. You can reuse the same unit-type dummy for multiple spells, but not reuse the same exact dummy caster unit. (A dummy can of course be reused if all spells it was given are removed from it and it has no active spell effects at the time of reuse.) If the dummy's expiration timer runs out before damage is finished being dealt, it may be impossible to check the damage source since it would return null rather than the correct caster.
 
Top