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

Damage equel to number of units in unit group

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2010
Messages
344
Hi,
Real simple question.
I got a Storm Bolt I want to deal damage x number of units in my unit group.
  • Ancestors Breaking
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Totemer (Ancestors Breaking)
    • Actions
      • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing (50.00 x 1.00) damage of attack type Spells and damage type Normal
This is what I've done so far. The 50.00 x 1.00 is the 50 damage per the amount of units. I just haven't figured out how to use unit groups instead of a number.

Thank you for reading! :)
 
Level 18
Joined
May 11, 2012
Messages
2,103
  • Your Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Set TempTrigUnit = (Triggering unit)
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Set TempUnitGroup = (Units within (Radius that you want to affect units in) of TempPoint matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching unit) is dead) Not equal to True) and (((Matching unit) belongs to an enemy of (Trigge
      • Unit Group - Pick every unit in (TempUnitGroup) and do (Actions)
        • Loop - Actions
          • Unit - Cause TempTrigUnit to damage (Picked unit), dealing (50.00 x (Real((Number of units in TempUnitGroup)))) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
Note that this will actiave immediately upon throwing your bolt. If you want it to actiave when your bolt damages, then you'll need to trigger the entire spell, or use DDS and check if the unit has buf and then apply these actions.
 
Level 8
Joined
Jun 13, 2010
Messages
344
  • Your Trigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Set TempTrigUnit = (Triggering unit)
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Set TempUnitGroup = (Units within (Radius that you want to affect units in) of TempPoint matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is Magic Immune) Not equal to True) and ((((Matching unit) is dead) Not equal to True) and (((Matching unit) belongs to an enemy of (Trigge
      • Unit Group - Pick every unit in (TempUnitGroup) and do (Actions)
        • Loop - Actions
          • Unit - Cause TempTrigUnit to damage (Picked unit), dealing (50.00 x (Real((Number of units in TempUnitGroup)))) damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
Note that this will actiave immediately upon throwing your bolt. If you want it to actiave when your bolt damages, then you'll need to trigger the entire spell, or use DDS and check if the unit has buf and then apply these actions.

Do you have to use all these variables? Can't you just cut them off and make the unit deal damage equel to number of units in unit group x damage?
I am not that good at variables and so.. So I just want it to be as simple as possible. It is a very small and focused map, so there won't be many leaks you have to worry about.

And I made a Real variable. Can I make the Real Variable = Unit Group variable? So it will deal the damage equel to the Real which is equel to the Unit Group?
 
Level 8
Joined
Jun 13, 2010
Messages
344
Do you want to damage single unit or all the units in unit group?
And yes if you want to prevent leaks. Leaking map != good performance.

Im sorry I think I confused you.
I am making a Shaman who deals damage equel to the amount of Totems he possess x 50 damage output. So he will deal 50 damage for each Totem he has to 1 single unit through the Storm Bolt ability.
 
Level 8
Joined
Jun 13, 2010
Messages
344
And how can I detect how much totems does Shaman have?
Are these totems items or something?

Totems are units.
The idea is that when he uses an ability, he will summon a Totem. That is a unit put with no movement speed for an amount of time.
He then has another ability that deals damage equel to 50x(number of Totems placed).
 
Last edited:
Level 8
Joined
Jun 13, 2010
Messages
344
As Pinzu said; make a trigger that count everytime you place a totem. Set TotemInt = TotemInt + 1
And then use the 50 * TotemInt.

Made this add trigger:
  • Add Totems
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Totem
    • Actions
      • Set TotemsInt = (TotemsInt + 1)
      • Wait 10.00 seconds
      • Special Effect - Create a special effect at (Position of (Entering unit)) using Abilities\Spells\Other\Doom\DoomDeath.mdl
      • Set TotemsInt = (TotemsInt - 1)
      • Unit - Remove (Entering unit) from the game
But I can't seem to select the TotemsInt variable I just made when doing the
50 x TotemsInt
  • Ancestors Breaking
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Totemer (Ancestors Breaking)
    • Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (50.00 x 1.00) damage of attack type Spells and damage type Normal
How do I do I replace the 1.00 with the Integer?

Please help :)
 
Last edited:
Level 18
Joined
May 11, 2012
Messages
2,103
Change the entering unit to triggering unit, so it won't bug up.
You have to convert real to integer. Search the dropdown menu for something like: Convert Real to Integer, and then select your integer variable.
Btw, you're leaking location (Position of (Entering Unit))
 
Level 8
Joined
Jun 13, 2010
Messages
344
Change the entering unit to triggering unit, so it won't bug up.
You have to convert real to integer. Search the dropdown menu for something like: Convert Real to Integer, and then select your integer variable.
Btw, you're leaking location (Position of (Entering Unit))

What do you mean with location? (Position of (Entering Unit))?
Where?
Btw, it is single target damage, not area. If that makes a difference.
 
Level 18
Joined
May 11, 2012
Messages
2,103
Creating a special effect on (Position of (Entering Unit)) uses location.
Create new TempPoint variable of type Point. Then set that variable to (Position of (Triggering Unit)) and then use TempPoint in where you're creating special effect.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Wait 10 seconds is not accurate.
Use Wait 10 seconds of gametime instead.
It is still not 100% accurate but 100 times better than the other wait.

Also, your totem count only works if only one unit is the shaman.
You can make it an array and use the player number of the owning player as the index to make it possible to have 1 shaman for every player.
If you use an indexing system, you can even make it possible to have thousands of shamans for the same player and they would only count their own placed totems.
 
Status
Not open for further replies.
Top