• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Help with an item

Level 2
Joined
Nov 1, 2023
Messages
14
I made an item with an ability that when I attack an enemy to deal the same damage to 3 enemies when I have that item in the inventory.

I tried with 'Barrage', but I think I have a bug because when I set it to damage 3 enemies, it damages all the enemies around me, not just 3.

I specify that I want to make the item for melee and that all the melee heroes on my map have 300 range attack.

I tried to make a trigger and it didn't work. I searched the website and I can't find anything to help me with my problem, that's why I turned to you.

Thank you and I appreciate your help.
 
Level 21
Joined
Dec 4, 2007
Messages
1,481
Using a damage engine would be convenient and powerful for customization, or use the latest patch:

  • ItemDamage
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Item-type of (Item carried by (Damage source) of type Claws of Attack +15)) Equal to Claws of Attack +15
      • (Damage From Normal Attack) Equal to True
      • ((Damage Target) is A structure) Equal to False
    • Actions
      • Event Response - Set Damage of Unit Damaged Event to ((Damage taken) x 3.00)
 
Level 21
Joined
Dec 4, 2007
Messages
1,481
Oh i read that wrong, i thought he wanted x3 times the damage, but its actually about aoe damage - just precisely to 3 units, proliferating.

Barrage only works with missiles.
Cleave/Splash will hit all units in the designated area, thus we have to trigger the wanted effect:

  • Proliferate Melee damage
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
      • ((Damage source) is A melee attacker) Equal to True
      • (Item-type of (Item carried by (Damage source) of type Claws of Attack +15)) Equal to Claws of Attack +15
    • Actions
      • Set VariableSet temp_real = (Damage taken)
      • Set VariableSet temp_unit = (Damage source)
      • Set VariableSet temp_unit2 = (Damage Target)
      • Set VariableSet temp_point = (Position of temp_unit)
      • Set VariableSet temp_point2 = (temp_point offset by (Unit: temp_unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of temp_unit) degrees.)
      • Set VariableSet temp_unitgroup = (Units within 300.00 of temp_point.)
      • Set VariableSet temp_unitgroup2 = (Random 0 units from temp_unitgroup)
      • Unit Group - Remove temp_unit2 from temp_unitgroup.
      • Unit Group - Pick every unit in temp_unitgroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A flying unit) Equal to False
              • ((Picked unit) belongs to an enemy of (Owner of temp_unit).) Equal to True
            • Then - Actions
              • Unit Group - Add (Picked unit) to temp_unitgroup2
            • Else - Actions
      • Unit Group - Pick every unit in (Random 3 units from temp_unitgroup2) and do (Actions)
        • Loop - Actions
          • Unit - Cause temp_unit to damage (Picked unit), dealing temp_real damage of attack type Normal and damage type Normal
          • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_temp_point)
      • Custom script: call RemoveLocation(udg_temp_point2)
      • Custom script: call DestroyGroup(udg_temp_unitgroup)
      • Custom script: call DestroyGroup(udg_temp_unitgroup2)
Can make it more readable if need be.
 
Last edited:
Level 2
Joined
Nov 1, 2023
Messages
14
I made it like this and it doesn't work...


  • Ultimate Beast Claws Ability
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
      • ((Damage source) is A melee attacker) Equal to True
      • (Item-type of (Item carried by (Damage source) of type Ultimate Beast Claws)) Equal to Ultimate Beast Claws
    • Actions
      • Set VariableSet Ultimate_Beast_Claws_Real = (Damage taken)
      • Set VariableSet Ultimate_Beast_Claws_Unit = (Damage source)
      • Set VariableSet Ultimate_Beast_Claws_Unit2 = (Damage Target)
      • Set VariableSet Ultimate_Beast_Claws_Point = (Position of Ultimate_Beast_Claws_Unit)
      • Set VariableSet Ultimate_Beast_Claws_Point2 = (Ultimate_Beast_Claws_Point offset by (Unit: Ultimate_Beast_Claws_Unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of Ultimate_Beast_Claws_Unit) degrees.)
      • Set VariableSet Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point.)
      • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 0 units from Ultimate_Beast_Claws_UnitGroup)
      • Unit Group - Remove Ultimate_Beast_Claws_Unit from Ultimate_Beast_Claws_UnitGroup.
      • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A structure) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A flying unit) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to True
            • Then - Actions
              • Unit Group - Add (Picked unit) to Ultimate_Beast_Claws_UnitGroup_Copy
            • Else - Actions
      • Unit Group - Pick every unit in (Random 3 units from Ultimate_Beast_Claws_UnitGroup_Copy) and do (Actions)
        • Loop - Actions
          • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
          • Special Effect - Create a special effect at (Center of (Playable map area)) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point)
      • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point2)
      • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup)
      • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup_Copy)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
This Condition is wrong - or at least an odd way of going about:
  • (Item-type of (Item carried by (Damage source) of type Ultimate Beast Claws)) Equal to Ultimate Beast Claws
There's a Boolean to check to see if a unit has an item by type:
  • ((Damage source) has an Item of type Ultimate Beast Claws) Equal to True

This line is unnecessary and should be deleted:
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 0 units from Ultimate_Beast_Claws_UnitGroup)
You don't need to initialize the Unit Group.


This line is unnecessary and should be deleted:
  • Unit Group - Remove Ultimate_Beast_Claws_Unit from Ultimate_Beast_Claws_UnitGroup.
It doesn't really change anything.


This should be reference Ultimate_Beast_Claws_Point2:
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point.)
Currently, you're getting units within a circle radius of 300.00 around the damage source.


All of your Conditions are set to True despite the example having Structure and Flying set to False. This is how the Conditions should look:
  • If - Conditions
    • ((Picked unit) is alive) Equal to True
    • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to True
    • ((Picked unit) is A structure) Equal to False
    • ((Picked unit) is A flying unit) Equal to False
Remember, the Unit Group contains ALL nearby units by default. So what you're doing in these Conditions is trying to filter out unwanted types of units. So you want to set Structure/Flying to False to prevent those types of units from being damaged.


After you're done looping over Ultimate_Beast_Claws_UnitGroup you should add this Action:
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
Then in the second Pick Every Unit action you should change it to say this:
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)

Lastly, your Special Effect (which is optional) is not setup correctly:
  • Special Effect - Create a special effect at (Center of (Playable map area)) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
  • Special Effect - Destroy (Last created special effect)
You're creating a Thunderclap at the center of the map. It seems like you either want to delete these Actions or adjust them.
 
Last edited:
Level 21
Joined
Dec 4, 2007
Messages
1,481
Check your loop conditions, you set "is a structure to true" hence you will only see it trigger if there is a structure (flying is also set to true).
Uncle beat me to it.

I think i added

set.gif
Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 0 units from Ultimate_Beast_Claws_UnitGroup)

because otherwise you aren't able to add units to the group (so it had to be initialized, which surprised me to be honest).

Other than that +1
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Check your loop conditions, you set "is a structure to true" hence you will only see it trigger if there is a structure (flying is also set to true).
Uncle beat me to it.

I think i added

set.gif
Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 0 units from Ultimate_Beast_Claws_UnitGroup)

because otherwise you aren't able to add units to the group (so it had to be initialized, which surprised me to be honest).

Other than that +1
You should definitely be able to add units to it, maybe you made a mistake elsewhere?

In GUI you should really only need to initialize Unit Groups if you're messing with Arrays and don't feel like adjusting the Initial Size. For example:
  • Custom script: set udg_MyGroup[100] = CreateGroup()
 
Level 2
Joined
Nov 1, 2023
Messages
14
I made it like this, and something doesn't work...

  • Ultimate Beast Claws Ability
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
      • ((Damage source) is A melee attacker) Equal to True
      • ((Damage source) has an item of type Ultimate Beast Claws) Equal to True
    • Actions
      • Set VariableSet Ultimate_Beast_Claws_Real = (Damage taken)
      • Set VariableSet Ultimate_Beast_Claws_Unit = (Damage source)
      • Set VariableSet Ultimate_Beast_Claws_Unit2 = (Damage Target)
      • Set VariableSet Ultimate_Beast_Claws_Point = (Position of Ultimate_Beast_Claws_Unit)
      • Set VariableSet Ultimate_Beast_Claws_Point2 = (Ultimate_Beast_Claws_Point offset by (Unit: Ultimate_Beast_Claws_Unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of Ultimate_Beast_Claws_Unit) degrees.)
      • Set VariableSet Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point2.)
      • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is A flying unit) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to Ultimate_Beast_Claws_UnitGroup_Copy
            • Else - Actions
      • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)
        • Loop - Actions
          • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
          • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
          • Special Effect - Create a special effect attached to the chest of (Damage source) using Abilities\Spells\Other\Cleave\CleaveDamageTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point)
      • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point2)
      • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup)
      • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup_Copy)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
You need to Set the Unit Group BEFORE picking the units inside of it:
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
So it should look like this:
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)
    • Loop - Actions
      • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Cleave\CleaveDamageTarget.mdl
      • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point)
  • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point2)
  • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup)
  • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup_Copy)
You also want to create the special effect on the chest of the (Picked unit), since that's the enemy unit that is getting damaged by the cleave.


To help you understand what's happening here:

A Unit Group is a container of Units, so it's like an empty box that you can fill with different kinds of Units.

The Pick Every Unit action takes an existing Unit Group (Ultimate_Beast_Claws_UnitGroup for example) and allows you to run Actions for each of the Units contained inside.

These Actions happen in the Loop - Actions section:
  • Loop - Actions
    • // anything you put here will happen once PER unit inside of the unit group
If you want to reference a Unit directly inside of the Loop - Actions section, you use the (Picked unit) Event Response.


So in your trigger you're basically doing the following:

1) Putting all of the units within 300.00 range of the damaged unit into a Unit Group.

2) Looping over the units inside of the Unit Group in order to figure out which ones are actually enemies that we can "cleave".

3) Putting up to THREE of those "cleavable" units into a second Unit Group. This new Unit Group only contains units that meet these conditions: Enemy, Living, Ground, Non-Structure.

4) Looping over the units inside of the second Unit Group and dealing damage to each of them.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Also, I made a slight mistake in my earlier post when I told you to get rid of this line:
  • Unit Group - Remove Ultimate_Beast_Claws_Unit from Ultimate_Beast_Claws_UnitGroup.
This line is necessary but you want to make sure that it references Ultimate_Beast_Claws_Unit2 since that's the enemy that we damaged. This will prevent the damage target from getting cleaved as well.

Alternatively, you can add another If - Condition to filter this unit out:
  • If - Conditions
    • (Picked unit) Not Equal to Ultimate_Beast_Claws_Unit2
    • ...
 
Level 2
Joined
Nov 1, 2023
Messages
14
When i attack, it doesn't happen anything...

  • Ultimate Beast Claws Ability
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Damage From Normal Attack) Equal to True
      • ((Damage source) is A melee attacker) Equal to True
      • ((Damage source) has an item of type Ultimate Beast Claws) Equal to True
    • Actions
      • Set VariableSet Ultimate_Beast_Claws_Real = (Damage taken)
      • Set VariableSet Ultimate_Beast_Claws_Unit = (Damage source)
      • Set VariableSet Ultimate_Beast_Claws_Unit2 = (Damage Target)
      • Set VariableSet Ultimate_Beast_Claws_Point = (Position of Ultimate_Beast_Claws_Unit)
      • Set VariableSet Ultimate_Beast_Claws_Point2 = (Ultimate_Beast_Claws_Point offset by (Unit: Ultimate_Beast_Claws_Unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of Ultimate_Beast_Claws_Unit) degrees.)
      • Set VariableSet Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point2.)
      • Unit Group - Remove Ultimate_Beast_Claws_Unit from Ultimate_Beast_Claws_UnitGroup.
      • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is A flying unit) Equal to False
            • Then - Actions
              • Unit Group - Add (Picked unit) to Ultimate_Beast_Claws_UnitGroup_Copy
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Picked unit) Not equal to Ultimate_Beast_Claws_Unit2
                • Then - Actions
                • Else - Actions
      • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
      • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)
        • Loop - Actions
          • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
          • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Cleave\CleaveDamageTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point)
      • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point2)
      • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup)
      • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup_Copy)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Oh, I'm being dumb... I'm used to doing these types of triggers differently and I made a huge oversight. My apologies.

Here's how you can get it working without issues:
  • Events
    • Unit - A unit Takes damage
  • Conditions
    • (Damage From Normal Attack) Equal to True
    • ((Damage source) is A melee attacker) Equal to True
    • ((Damage source) has an item of type Ultimate Beast Claws) Equal to True
  • Actions
    • Set VariableSet Ultimate_Beast_Claws_Real = (Damage taken)
    • Set VariableSet Ultimate_Beast_Claws_Unit = (Damage source)
    • Set VariableSet Ultimate_Beast_Claws_Unit2 = (Damage Target)
    • Set VariableSet Ultimate_Beast_Claws_Point = (Position of Ultimate_Beast_Claws_Unit)
    • Set VariableSet Ultimate_Beast_Claws_Point2 = (Ultimate_Beast_Claws_Point offset by (Unit: Ultimate_Beast_Claws_Unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of Ultimate_Beast_Claws_Unit) degrees.)
    • Set VariableSet Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point2.)
    • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ((Picked unit) is alive) Equal to True
            • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to True
            • ((Picked unit) is A structure) Equal to False
            • ((Picked unit) is A flying unit) Equal to False
            • (Picked unit) Not equal to Ultimate_Beast_Claws_Unit2
          • Then - Actions
          • Else - Actions
            • Unit Group - Removed (Picked unit) from Ultimate_Beast_Claws_UnitGroup
    • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
    • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)
      • Loop - Actions
        • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
        • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Cleave\CleaveDamageTarget.mdl
        • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point)
    • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point2)
    • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup)
    • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup_Copy)


Once you get it working you may run into an issue with this line:
  • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
If this causes the trigger to run again (because damage is being taken) then you may create an infinite loop which will crash the game. In other words, this Action can cause the trigger to run again, which will cause this Action to run again, and then this repeats again and again.

The solution for that is to Turn off the trigger before picking units in Ultimate_Beast_Claws_UnitGroup_Copy and then Turn it back on afterwards:
  • Trigger - Turn off (this trigger)
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)
    • Loop - Actions
      • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Cleave\CleaveDamageTarget.mdl
      • Special Effect - Destroy (Last created special effect)
  • Trigger - Turn on (this trigger)
This prevents the Damage from causing the Trigger to run again.
 
Last edited:
Level 2
Joined
Nov 1, 2023
Messages
14
it doesn't work... i don't know what i'm doing wrong, so it doesn't work anyhow

  • Ultimate Beast Claws Ability
  • Events
  • Unit - A unit Takes damage
  • Conditions
  • (Damage From Normal Attack) Equal to True
  • ((Damage source) is A melee attacker) Equal to True
  • ((Damage source) has an item of type Ultimate Beast Claws) Equal to True
  • Actions
  • Set VariableSet Ultimate_Beast_Claws_Real = (Damage taken)
  • Set VariableSet Ultimate_Beast_Claws_Unit = (Damage source)
  • Set VariableSet Ultimate_Beast_Claws_Unit2 = (Damage Target)
  • Set VariableSet Ultimate_Beast_Claws_Point = (Position of Ultimate_Beast_Claws_Unit)
  • Set VariableSet Ultimate_Beast_Claws_Point2 = (Ultimate_Beast_Claws_Point offset by (Unit: Ultimate_Beast_Claws_Unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of Ultimate_Beast_Claws_Unit) degrees.)
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point2.)
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • ((Picked unit) is alive) Equal to True
  • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to True
  • ((Picked unit) is A structure) Equal to False
  • ((Picked unit) is A flying unit) Equal to False
  • (Picked unit) Not equal to Ultimate_Beast_Claws_Unit2
  • Then - Actions
  • Else - Actions
  • Unit Group - Remove (Picked unit) from Ultimate_Beast_Claws_UnitGroup.
  • Trigger - Turn off (This trigger)
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)
  • Loop - Actions
  • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Cleave\CleaveDamageTarget.mdl
  • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point)
  • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point2)
  • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup)
  • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup_Copy)
  • Trigger - Turn on (This trigger)
 
Level 39
Joined
Feb 27, 2007
Messages
5,032
IMO there's no real reason to do all this fuckery that A]mun introduced in their first reply. All it does is make the cleave search for units around a point at max melee attack range from the source unit (where the target probably is), rather than just looking around the target unit directly:
  • Set Ultimate_Beast_Claws_Point2 = (Ultimate_Beast_Claws_Point offset by (Unit: Ultimate_Beast_Claws_Unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of Ultimate_Beast_Claws_Unit) degrees.)
  • -------- change to: --------
  • Set Ultimate_Beast_Claws_Point2 = (Position of Ultimate_Beast_Claws_Unit2)
As for what's not working it's quite easy to debug for yourself by putting some "Game - Display text (timed)" actions in to see what does and doesn't run. "it doesn't work" gives 0 information to go on, but you could easily gain some information yourself. My best guess is that the filtering if-block is to blame, as I recall wc3 has some aversion to empty then-blocks when you try to only put actions in the else-block. Simply invert all of the conditions and put them inside an "Or - Multiple conditions" to achieve the same functionality. Also you can remove the target unit immediately:
  • Set Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point2.)
  • Unit Group - Remove Ultimate_Beast_Claws_Unit2 from Ultimate_Beast_Claws_UnitGroup
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup and do (Actions)
    • Loop - Actions
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • Or - Any conditions are true
            • ((Picked unit) is alive) Equal to False
            • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to False
            • ((Picked unit) is A structure) Equal to True
            • ((Picked unit) is A flying unit) Equal to True
        • Then - Actions
          • Unit Group - Remove (Picked Unit) from Ultimate_Beast_Claws_UnitGroup
        • Else - Actions
I believe the way you are using Unit Damage Target to re-deal the damage dealt will cause damage to be reduced by both the primary target's armor and the secondary target's armor. To avoid that you would either need to know the pre-mitigation damage dealt to the primary target (uses both units' armor independently) or use a damage type that isn't reduced by armor (would use the primary unit's armor to mitigate damage vs all targets).
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
it doesn't work... i don't know what i'm doing wrong, so it doesn't work anyhow

  • Ultimate Beast Claws Ability
  • Events
  • Unit - A unit Takes damage
  • Conditions
  • (Damage From Normal Attack) Equal to True
  • ((Damage source) is A melee attacker) Equal to True
  • ((Damage source) has an item of type Ultimate Beast Claws) Equal to True
  • Actions
  • Set VariableSet Ultimate_Beast_Claws_Real = (Damage taken)
  • Set VariableSet Ultimate_Beast_Claws_Unit = (Damage source)
  • Set VariableSet Ultimate_Beast_Claws_Unit2 = (Damage Target)
  • Set VariableSet Ultimate_Beast_Claws_Point = (Position of Ultimate_Beast_Claws_Unit)
  • Set VariableSet Ultimate_Beast_Claws_Point2 = (Ultimate_Beast_Claws_Point offset by (Unit: Ultimate_Beast_Claws_Unit's Weapon Real Field: Attack Range ('ua1m') at Index:0) towards (Facing of Ultimate_Beast_Claws_Unit) degrees.)
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup = (Units within 300.00 of Ultimate_Beast_Claws_Point2.)
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup and do (Actions)
  • Loop - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • ((Picked unit) is alive) Equal to True
  • ((Picked unit) belongs to an enemy of (Owner of Ultimate_Beast_Claws_Unit).) Equal to True
  • ((Picked unit) is A structure) Equal to False
  • ((Picked unit) is A flying unit) Equal to False
  • (Picked unit) Not equal to Ultimate_Beast_Claws_Unit2
  • Then - Actions
  • Else - Actions
  • Unit Group - Remove (Picked unit) from Ultimate_Beast_Claws_UnitGroup.
  • Trigger - Turn off (This trigger)
  • Set VariableSet Ultimate_Beast_Claws_UnitGroup_Copy = (Random 3 units from Ultimate_Beast_Claws_UnitGroup)
  • Unit Group - Pick every unit in Ultimate_Beast_Claws_UnitGroup_Copy and do (Actions)
  • Loop - Actions
  • Unit - Cause Ultimate_Beast_Claws_Unit to damage (Picked unit), dealing Ultimate_Beast_Claws_Real damage of attack type Normal and damage type Normal
  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Other\Cleave\CleaveDamageTarget.mdl
  • Special Effect - Destroy (Last created special effect)
  • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point)
  • Custom script: call RemoveLocation(udg_Ultimate_Beast_Claws_Point2)
  • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup)
  • Custom script: call DestroyGroup(udg_Ultimate_Beast_Claws_UnitGroup_Copy)
  • Trigger - Turn on (This trigger)
It works fine for me, see attached map below.

I'm going to assume that your Hero is NOT melee and therefore you aren't even making it past the second Condition:
  • ((Damage source) is A melee attacker) Equal to True
I'm pretty sure a Melee check is simply "If attack range is <= 128.00", and I believe you said your Hero has 300 attack range.

Like Pyro said, you can confirm which parts of a trigger are working or not working by running specific Actions that you're CERTAIN will execute. You can conclude that the issue lies in the Conditions if none of the Actions fire. Or it could potentially be the Event, although unlikely in most cases.
  • Actions
    • Game - Display to (All players) for 100.00 seconds the text: IF I SEE THIS TEXT, IT WORKS!
^ Placing text messages at key moments throughout the trigger will give you a visual aid of what is happening and when it's happening. It also helps you better understand how triggers work since you can see the order of things and get an idea of what your Loops are really doing.
 

Attachments

  • UBC Damage Cleave.w3m
    20.3 KB · Views: 3
Last edited:
Top