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

[Spell] Bribes Damage Engine

Level 11
Joined
Aug 11, 2009
Messages
594
I'm sorry if this has been answered before but I have tried to find info and couldn't find it.

I need help to understand how Bribes Damage Engine works. More exactly how to make a spell effect trigger on auto attacks.

Basically what i need is a X% chance on auto attacks to trigger AoE damage around the attacker. Could someone show me how it should look in GUI triggers? This effect should only trigger from normal auto attacks and nothing else. I just hope its not too complicated to make.

Thanks in advance!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I'll show you the easy way and the correct way of doing it.

The easy method is straight to the point. It uses the DamageEvent variable provided by the Damage Engine (bribe explains how ALL of these work in the Damage Engine thread) to detect when damage is dealt. It then checks if said damage was attack damage and if that's true it proceeds to the dice roll (random number) in order to determine the chance of success. If the chance is successful then it proceeds to the Actions part of the trigger. There it is getting ALL of the units around the DamageEventSource (the unit that dealt the damage) and dealing 500 spell damage to them:
  • Easy Method
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • IsDamageAttack Equal to True
      • (Random integer number between 1 and 100) Less than or equal to 25
    • Actions
      • Unit Group - Pick every unit in (Units within 512.00 of (Position of DamageEventSource).) and do (Actions)
        • Loop - Actions
          • Unit - Cause DamageEventSource to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
So we have a 25% chance to deal 500.00 spell damage to all units within 512.00 range of our damage source.

The correct method incorporates user created Variables to make the trigger more efficient by reducing Event Response repetition (it's faster to reference a variable than an Event Response), cleaning up memory leaks which can bog down your map over time, and potentially avoiding bugs. It also adds an If Then Else action so that we can continue to ask questions outside of the initial Conditions block. In this case we're using the If Then Else to fix the problem that our easy method had where it was dealing damage to ALL nearby units regardless of their circumstances. With these fixes the trigger is now only dealing damage to nearby enemy units that are still alive:
  • Correct Method
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • IsDamageAttack Equal to True
      • (Random integer number between 1 and 100) Less than or equal to 25
    • Actions
      • Set VariableSet Temp_Point = (Position of DamageEventSource)
      • Set VariableSet Temp_Group = (Units within 512.00 of Temp_Point.)
      • Custom script: call RemoveLocation( udg_Temp_Point )
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet Temp_Target = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Temp_Target is alive) Equal to True
              • (Temp_Target belongs to an enemy of (Owner of DamageEventSource).) Equal to True
            • Then - Actions
              • Unit - Cause DamageEventSource to damage Temp_Target, dealing 500.00 damage of attack type Spells and damage type Normal
            • Else - Actions
      • Custom script: call DestroyGroup( udg_Temp_Group )
Temp_Target is a Unit variable. Temp_Point is a Point variable. Temp_Group is a Unit Group variable.

Of course we can add additional conditions to make sure that this trigger only runs when we want it to.

For example, we can check the type of unit that dealt the damage or whether or not that unit has a certain ability:
  • Conditions
    • (Unit-type of DamageEventSource) Equal to Paladin
  • Conditions
    • (Level of Pulverize for DamageEventSource) Greater than 0
You can also Turn off the Damage Engine prior to dealing damage if you don't want it to be processed by the system:
  • Actions
    • Trigger - Turn off Damage Engine <gen>
    • Unit Group - Pick every unit in (Units within 512.00 of (Position of DamageEventSource).) and do (Actions)
      • Loop - Actions
        • Unit - Cause DamageEventSource to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal
    • Trigger - Turn on Damage Engine <gen>
Just remember to turn it back on immediately afterwards.

Also, if your X% chance is a fractional number then you'll want to use the Real Comparison for a Random real number instead of the Integer Comparison for a Random integer number:
  • Conditions
    • (Random real number between 1.00 and 100.00) Less than or equal to 25.00
Refer to the Damage Engine thread to learn more, Bribe breaks it all down there.
 

Attachments

  • Damage Engine Demo 1.w3m
    46.8 KB · Views: 2
Last edited:
Top