• 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] Heal a summoner's summons upon ability cast

Status
Not open for further replies.
Level 28
Joined
Dec 3, 2020
Messages
982
So...

I have a warlock unit-type that can summon some demons, using Water Elemental, Feral Spirit etc... as base spells.
The warlock has an ability called Soulbolt which is an edited Death Coil that can only target enemies.

So when Soulbolt is cast, I want to heal the casting warlock for 50 hp, which I do easily, but I also want to heal his specific summon for 50 hp as well... which isn't working.
Take in mind that the player can have up to like 30 warlocks at a time if he wanted to.

Any way to make this work?
 
Level 30
Joined
Feb 18, 2014
Messages
3,623
You need to store the summoned units inside a unit group and create a trigger that picks all units in the group and heal them when the Warlock cast the ability.

A unit summons a unit

Add (Summoned unit) to SummonedGroup[Index]

It will better to use indexing when there are many summoners.
 
Level 6
Joined
Dec 17, 2020
Messages
42
Maeby you can use -unit group pick every units in...(range and matching conditions-
Event: finish cast a spell
Condition:
-unit Caster is = a (warlock unit)
-The spell being cast is = Soulbolt
Actions:
Pick every unit in (512/1024/etc) range of (Caster Unit) Matching -> matching Unit is Alive, Player owner matching Unit (same as caster unit or ally if you choose), matching Unit type is = or (Warlock or Summon 1 or Summon 2 or etc)
Loop actions: set hp pick unit = hp pick unit +50

Sorry if I don't give an example from the editor, I'm out of the house until very late.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,886
Thanks but that's not what I need @Salva, since the player can easily have 20 warlocks with of type Summon 1 (Fel Beast for example).
I think I am onto something since someone else helped me out on Discord but I have yet to try it...
So, I am welcome for any more advices and solutions!
No Raypack, that's exactly what you need, lol.

A Unit Group contains ANY number of units, regardless of their type.
  • Events
    • Unit - A unit Spawns a summoned unit
  • Conditions
    • (Unit-type of (Summoning unit)) Equal to Warlock
  • Actions
    • Set Variable PN = (Player number of (Owner of (Summoning unit)))
    • Unit Group - Add (Summoned unit) to Warlock_Summons[PN]
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Warlock Heal
  • Actions
    • Set Variable PN = (Player number of (Owner of (Casting unit)))
    • Unit Group - Pick every unit in Warlock_Summons[PN]
      • Loop - Actions
        • Unit - Set life of (Picked unit) to (Life of (Picked unit)) + 100.00)
You can easily filter out unwanted summons in the Conditions of the first trigger.

Just remember to give your Unit Group an initial Size of 24, otherwise the Array index won't work above [1].
 
Level 28
Joined
Dec 3, 2020
Messages
982
No raypack, that's exactly what you need, lol.

A Unit Group contains ANY number of units, regardless of their type.
Perhaps I misunderstood, but I shall give an example of what I want:

Imagine player has 4 warlocks currently, and each has summoned a demon (either a fel beast, a succubus or a voidwalker).

  • Warlock 1 casts Soulbolt ability -> heal warlock 1 for 50 hp (which is working for me) and heal the demon that belongs to warlock 1 and nothing else.
  • Warlock 3 casts Soulbolt -> heal warlock 3 and warlock 3's summoned demon.

Etc...

PS: ok read your edit, I shall try it out now
That unit group size set to 24 is definitely something I did not know
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,886
Perhaps I misunderstood, but I shall give an example of what I want:

Imagine player has 4 warlocks currently, and each has summoned a demon (either a fel beast, a succubus or a voidwalker).

  • Warlock 1 casts Soulbolt ability -> heal warlock 1 for 50 hp (which is working for me) and heal the demon that belongs to warlock 1 and nothing else.
  • Warlock 3 casts Soulbolt -> heal warlock 3 and warlock 3's summoned demon.

Etc...
Right, so an Array of Unit Groups means that you can give each Warlock their own unique Unit Group. In my example I assumed that you wanted it to be MPI, which means that it works for one Warlock per Player. If you want it to be MUI, which means that it works for EACH Warlock regardless, then you need to change PN (player number) to be the Custom Value of your Warlock. This method is called Unit Indexing and requires a Unit Indexer system, which I think you may already have in your map.

Edit:
There's an important change you need to make with Unit Indexing. You need to manually create the Unit Groups yourself:
  • Events
    • Unit - A unit Enters playable map area
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Warlock
  • Actions
    • Set Variable CV = (Custom value of (Triggering unit))
    • Custom script: set udg_Warlock_Group[udg_CV] = CreateGroup()
Remember to destroy this Unit Group when the Warlock dies:
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Warlock
  • Actions
    • Set Variable CV = (Custom value of (Triggering unit))
    • Custom script: call DestroyGroup( udg_Warlock_Group[udg_CV] )
You can keep the Size set to 1 in this case because we're manually creating the Unit Groups ourselves -> CreateGroup().

The two triggers from my last post as well as these two new triggers should do exactly what you need.
 
Last edited:
Level 28
Joined
Dec 3, 2020
Messages
982
Okay!!!

IT WORKED! Thank you Uncle! It worked without the custom script to create the group and with the array unit group size set to 24, but I shall do it your way now; with the custom values!

Also yeah, I already have the Unit Indexer!

PS: stupid me forgot the have to set the custom value upon the ability being cast when I tried setting it up earlier...

Edit: I see why you set it to 24 now... because of 24 players! But no! So I'm doing these 2 new triggers now!
 
Level 28
Joined
Dec 3, 2020
Messages
982
Right, so an Array of Unit Groups means that you can give each Warlock their own unique Unit Group. In my example I assumed that you wanted it to be MPI, which means that it works for one Warlock per Player. If you want it to be MUI, which means that it works for EACH Warlock regardless, then you need to change PN (player number) to be the Custom Value of your Warlock. This method is called Unit Indexing and requires a Unit Indexer system, which I think you may already have in your map.

Edit:
There's an important change you need to make with Unit Indexing. You need to manually create the Unit Groups yourself:
  • Events
    • Unit - A unit Enters playable map area
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Warlock
  • Actions
    • Set Variable CV = (Custom value of (Triggering unit))
    • Custom script: set udg_Warlock_Group[udg_CV] = CreateGroup()
Remember to destroy this Unit Group when the Warlock dies:
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Warlock
  • Actions
    • Set Variable CV = (Custom value of (Triggering unit))
    • Custom script: call DestroyGroup( udg_Warlock_Group[udg_CV] )
You can keep the Size set to 1 in this case because we're manually creating the Unit Groups ourselves -> CreateGroup().

The two triggers from my last post as well as these two new triggers should do exactly what you need.
After adding these 2 new triggers and setting back the unit group array size to 1, it stopped working!

Unit Group's name is Warlock_Group and the integer's name is CV

EDIT: setting the unit group array size back to 24 seems to fix it.
I just wonder, does it cap at 24 warlocks?

Well I set the size to 10 000, shouldn't be a problem.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,886
After adding these 2 new triggers and setting back the unit group array size to 1, it stopped working!

Unit Group's name is Warlock_Group and the integer's name is CV

EDIT: setting the unit group array size back to 24 seems to fix it.
I just wonder, does it cap at 24 warlocks?

Well I set the size to 10 000, shouldn't be a problem.
It's Size can be set to 1. You're making another mistake if that doesn't work.
1708898647799.png

Make sure you change this value INSIDE of the Variable Editor, it's bugged and will reset otherwise.

Setting the size to 10,000 means that you're creating 10,000 Unit Groups from the start. That's not ideal. Setting it to 24 means that it won't work if a unit's custom value is greater than 24, in other words it'll break immediately if not very soon.
 
Last edited:
Level 28
Joined
Dec 3, 2020
Messages
982
It's Size can be set to 1. You're making another mistake if that doesn't work.
View attachment 463236
Make sure you change this value this INSIDE of the Variable Editor, it's bugged and will reset otherwise.

Setting the size to 10,000 means that you're creating 10,000 Unit Groups from the start. That's not ideal. Setting it to 24 means that it won't work if a unit's custom value is greater than 24, in other words it'll break immediately if not very soon.
Yeah that's what I did and it stopped working. Map does not lag at all and loads fast so I shall keep it for now...
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,886
Yeah that's what I did and it stopped working. Map does not lag at all and loads fast so I shall keep it for now...
Okay, but that sounds like your trigger isn't setup properly, I've done this many times before. You sure you don't want to post your trigger(s) just in case?

Edit: Attached a demo map with the concept working.
 

Attachments

  • Unit Group Array demo.w3m
    21.5 KB · Views: 3
Last edited:
Level 28
Joined
Dec 3, 2020
Messages
982
Okay, but that sounds like your trigger isn't setup properly, I've done this many times before. You sure you don't want to post your trigger(s) just in case?
Ok: 1 sec

  • Warlock Enters Map
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Orc Warlock
    • Actions
      • Set VariableSet CV = (Custom value of (Entering unit))
      • Custom script: set udg_Warlock_Group[udg_CV] = CreateGroup()
  • Warlock Spawns Demon
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to Orc Warlock
    • Actions
      • Set VariableSet CV = (Custom value of (Summoning unit))
      • Unit Group - Add (Summoned unit) to Warlock_Group[CV]
  • Warlock Casts Soulbolt
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Soulbolt (Orc Warlock - REAL)
    • Actions
      • Set VariableSet CV = (Custom value of (Casting unit))
      • -------- -------- --------
      • -------- Heal the Warlock and his summon for 50 hit points --- extra heal in another trigger if target dies --------
      • Unit - Set life of (Casting unit) to ((Life of (Casting unit)) + 50.00)
      • Unit Group - Pick every unit in Warlock_Group[CV] and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 50.00)
  • Warlock Soulbolt Cast Debuff
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Soulbolt (Orc Warlock - REAL)
    • Actions
      • Unit - Create 1 Sorceress (Dummy) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
      • Unit - Add Faerie Fire (Dummy Soulbolt Debuff) to (Last created unit)
      • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Talon - Faerie Fire (Target unit of ability being cast)
  • Soulbolted Target Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Orc Warlock
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Dying unit) has buff Soulbolt (Debuff)) Equal to True
        • Then - Actions
          • Set VariableSet CV = (Custom value of (Killing unit))
          • Unit - Set life of (Killing unit) to ((Life of (Killing unit)) + 100.00)
          • Unit Group - Pick every unit in Warlock_Group[CV] and do (Actions)
            • Loop - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 100.00)
        • Else - Actions
  • Warlock Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Orc Warlock
    • Actions
      • Set VariableSet CV = (Custom value of (Dying unit))
      • Custom script: call DestroyGroup( udg_Warlock_Group[udg_CV] )

And the dummy unit is set correctly! It casts its spells perfectly.

CV is an integer variable with initial value of 0 (default)
Warlock_Group is a unit group array variable ---> when I set the size to 1 it stops healing the summoned demons (heals the latest summon I think actually)

The Debuff for the trigger that does not work lasts 3 seconds, but I tried it with 5 and 300... to no avail!
 
Last edited:
Level 28
Joined
Dec 3, 2020
Messages
982
Okay, but that sounds like your trigger isn't setup properly, I've done this many times before. You sure you don't want to post your trigger(s) just in case?

Edit: Attached a demo map with the concept working.
Okay, thanks!
I just got off the computer and can't use it again until tomorrow, so may I ask:
does it also solve the issue I mention in the above comment?
Where if a unit dies carrying the debuff, it heals (again) the warlock and his summon?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,886
Some mistakes:

1) You're using the wrong Event for your ability casting. You want to use Starts the effect in almost all cases:
  • Events
    • Unit - A unit Starts the effect of an ability
This is very important! If you want to understand why, test your map like it is now and begin casting Soulbolt and then interrupt the cast with a Stop order. Watch as your trigger still runs despite the fact that the ability never casted. That's because it Began casting, it didn't actually Start the effect. Your player could repeat this over and over again, running the trigger 10 times per second for free infinite healing.

2) When a unit dies all of it's buffs are removed. Unfortunately, this happens before the Event "A unit Dies" occurs (damn you Blizzard!). The solution is to use something else to determine that the unit had the buff, like by adding it to a Unit Group and checking if it's contained inside. Or adding a hidden ability to it since those can still be checked. Just remember to manage these when the Buff expires naturally.

3) I'm not sure why your Unit Group array doesn't work like mine does. I think you may have to delete the variable and recreate it, this time NOT changing the Size at all. If you check out the example map that I linked in my previous post you can see it working just fine.
 
Last edited:
Level 28
Joined
Dec 3, 2020
Messages
982
Some mistakes:

1) You're using the wrong Event for your ability casting. You want to use STARTS:
  • Events
    • Unit - A unit Starts the effect of an ability
This is very important! If you need to understand why, test your map like it is now and begin casting Soulbolt and then interrupt the cast with a Stop order. Watch as your trigger still runs despite the fact that the ability never casted. That's because it BEGAN casting, it didn't actually Start the effect. Your player could repeat this over and over again, running the trigger 10 times per second for free infinite healing.

2) When a unit dies, all of it's buffs are removed. Unfortunately, this happens BEFORE the Event "A unit Dies" occurs (damn you Blizzard!). The solution is to use something else to determine that the unit had the buff, like by adding it to a Unit Group and checking if it's contained inside. Or adding a hidden ability to it since those can still be checked.

3) I'm not sure why your Unit Group array doesn't work like mine does. I think you may have to delete the variable and recreate it, this time NOT changing the Size at all.
1 - Okay! I will do that!
2 - Instead of a debuff I will just give it a hidden Storm Hammers ability and check if the dying unit has it; at least from what I understand.
3 - Okay! I think it's because I already set it to 24 and then changed it back to 1 and somehow it messed up? I am on the latest patch.

Thank you yet again Uncle, you truly are a life saver!
 
Status
Not open for further replies.
Top