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

[Trigger] unit A get credit when unit B got killed by dummy spell

Status
Not open for further replies.
Level 3
Joined
Mar 15, 2015
Messages
53
i create the passive spell that heal unit A when it kill unit B
  • Heal
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) has buff Troll Regeneration ) Equal to True
    • Actions
      • Set H_Kill_unit = (Killing unit)
      • Set H_Dying_unit = (Dying unit)
      • Set HealLife[1] = ((Life of H_Kill_unit) + ((Max life of H_Dying_unit) x 0.10))
      • Set HealLife[2] = ((Life of H_Kill_unit) + ((Max life of H_Dying_unit) x 0.20))
      • Set HealLife[3] = ((Life of H_Kill_unit) + ((Max life of H_Dying_unit) x 0.25))
      • Set HealMana[1] = ((Mana of H_Kill_unit) + ((Max mana of H_Dying_unit) x 0.30))
      • Set HealMana[2] = ((Mana of H_Kill_unit) + ((Max mana of H_Dying_unit) x 0.35))
      • Set HealMana[3] = ((Mana of H_Kill_unit) + ((Max mana of H_Dying_unit) x 0.37))
      • Unit - Set life of H_Kill_unit to HealLife[(Level of Troll Regeneration for H_Kill_unit)]
      • Unit - Set mana of H_Kill_unit to HealMana[(Level of Troll Regeneration for H_Kill_unit)]
      • Special Effect - Create a special effect attached to the origin of H_Kill_unit using Abilities\Spells\Human\Heal\HealTarget.mdl
      • Special Effect - Destroy (Last created special effect)
but unit A doesn't get healed when unit B dies by "create-dummy" spells (i don't know what it called :p)
ex: create 1 dummy, order dummy to kill the enemy
so i wanna ask can unit A get healed when the dummy kill unit B?
EDIT: actually there's nothing wrong about the triggers, i just make a example that it won't heal unit A if dummy kills unit B, so i need help to make the triggers WILL do it
 
Last edited:
Level 6
Joined
May 20, 2014
Messages
228
It looks like it's an aura, so when you have these actions:

  • Unit - Set life of H_Kill_unit to HealLife[(Level of Troll Regeneration for H_Kill_unit)]
  • Unit - Set mana of H_Kill_unit to HealMana[(Level of Troll Regeneration for H_Kill_unit)]
It checks the current level of that ability on the killing unit. Since the killing unit wouldn't have that ability, this returns null, and is undefined in your case (since there's no indexing in 0th variable). There's also no level buff detection, either.

Try looping through the killing unit's allies near him using an unit group by picking in an area and do actions, checking which unit has the ability equal to true, then set that unit's ability equal to the current level. Of course, others may post better solutions, this is what I can think of.

Also, remove the wait, you don't need it; IIRC special effects will play normally even if destroyed by immediately after.

edit: reread your question again and again... now I'm not even sure what's the problem :S
 
Level 3
Joined
Mar 15, 2015
Messages
53
It looks like it's an aura, so when you have these actions:

  • Unit - Set life of H_Kill_unit to HealLife[(Level of Troll Regeneration for H_Kill_unit)]
  • Unit - Set mana of H_Kill_unit to HealMana[(Level of Troll Regeneration for H_Kill_unit)]
It checks the current level of that ability on the killing unit. Since the killing unit wouldn't have that ability, this returns null, and is undefined in your case (since there's no indexing in 0th variable). There's also no level buff detection, either.

Try looping through the killing unit's allies near him using an unit group by picking in an area and do actions, checking which unit has the ability equal to true, then set that unit's ability equal to the current level. Of course, others may post better solutions, this is what I can think of.

Also, remove the wait, you don't need it; IIRC special effects will play normally even if destroyed by immediately after.

edit: reread your question again and again... now I'm not even sure what's the problem :S
Thanks for the advise, i will try it
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
That is not true, GetUnitAbilityLevel returns 0 for nonexistant abilities, not null, since null is not even valid integer value, and GetUnitAbilityLevel returns integer.

It is also not undefined, because arrays are pre-initialized to default value of given type(0 for integer).

And yes, it is true, Special Effects will play their animation even if destroyed immediately after creation.

No idea about the actual problem, all seems fine to me, unless as mentioned, it tries to use 0th index, or 4+
 
Level 3
Joined
Mar 15, 2015
Messages
53
It looks like it's an aura, so when you have these actions:

  • Unit - Set life of H_Kill_unit to HealLife[(Level of Troll Regeneration for H_Kill_unit)]
  • Unit - Set mana of H_Kill_unit to HealMana[(Level of Troll Regeneration for H_Kill_unit)]
It checks the current level of that ability on the killing unit. Since the killing unit wouldn't have that ability, this returns null, and is undefined in your case (since there's no indexing in 0th variable). There's also no level buff detection, either.

Try looping through the killing unit's allies near him using an unit group by picking in an area and do actions, checking which unit has the ability equal to true, then set that unit's ability equal to the current level. Of course, others may post better solutions, this is what I can think of.

Also, remove the wait, you don't need it; IIRC special effects will play normally even if destroyed by immediately after.

edit: reread your question again and again... now I'm not even sure what's the problem :S

the problem is i want unit A also get healed when the dummy created by his spell kill the unit B and i need help to do that
 
Level 3
Joined
Mar 15, 2015
Messages
53
Your problem is that the killer is the dummy, so you dont even know who the real unit you want to heal is

yes i want to heal the unit A, maybe you guys thought i asked to fix the above triggers, nope i want to make it also heal my unit A even when dummy kills unit B
 
Level 6
Joined
May 20, 2014
Messages
228
> That is not true, GetUnitAbilityLevel returns 0 for nonexistant abilities, not null, since null is not even valid integer value, and GetUnitAbilityLevel returns integer.

I initially typed 0 but somehow changed to null because I thought they were same in this case. Guess both are totally different.

> It is also not undefined, because arrays are pre-initialized to default value of given type(0 for integer).

I was referring to that the value he set for an ability that is level 0 is undefined, since he didn't go as to exactly define (as in having HealLife[0] or something). I was suggesting this as to that if there's not something that promptly checks the actual level of the ability in question, which seems to be the problem. I think that the OP is trying to make it so that any kills made by any units under the caster's aura supposedly restores the caster's health/mana restored based on these dying units. In this case, you would need to set the caster in a variable and then change the life/mana restorations to that caster, not the killing unit. Same for HealLife and HealMana.

Or a better question would be, can you give an actual explanation of your ability?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Ability Explaination:
Heal this unit when he kills a unit.

Other ability (which is more interesting):
Make a dummy that deals damage.

I would like to see that ssecond spell to find a way to not let your dummy deal the damage.
This gets complicated if the dummy is a summoned unit that would have to give credits to it's master when it kills a unit etc.

I will be making a system for that sooner or later but in this case we would just want to change your other spell.
 
Level 13
Joined
Dec 21, 2010
Messages
540
just store the Unit A inside a variable
  • Learns Troll Regeneration
  • Events
    • Unit - Learns a skill
  • Conditions
    • Learned skill is equal to Troll Regeneration
    • Level of Troll Regeneration Equal to 1
  • Actions
    • Set - Unit_A = Learning Unit
    • Set - HealLife[1] = 0.10
    • Set - HealLife[2] = 0.20
    • Set - HealLife[1] = 0.25
    • Set - HealMana[1] = 0.30
    • Set - HealMana[2] = 0.35
    • Set - HealMana[3] = 0.37
Create another trigger,, then add a condition
which is a Player comparison >> Any unit that belongs to that player


  • Gains Troll Regeneration
  • Events
    • Unit - Dies
  • Conditions
    • ((Owner of killing unit) equal to (owner of (Unit_A))
  • Actions
    • Set Unit_B = (Dying unit)
    • Unit - Set life of (Unit_A) to ((Life of (Unit_A) + ((Max life of Unit_B) x HealLife[(Level of Troll Regeneration for Unit_A)]))
    • Unit - Set mana of (Unit_A) to ((Mana of (Unit_A) + ((Max Mana of Unit_B) x HealMana[(Level of Troll Regeneration for Unit_A)]))
    • Special Effect - Create a special effect attached to the origin of Unit_A using Abilities\Spells\Human\Heal\HealTarget.mdl
    • Special Effect - Destroy (Last created special effect)
In this case... all credits will be given to your hero even if the enemy is killed by dummies.. :)
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
But you cannot "set killing unit = <unit>".
That is what DSG meant.

But as I said, I am interested in what OP dummy is allowed to deal damage.
That spell is not explained but has been part of the discussion the whole time.

If you do want to give credits to different units, you require a Damage System.
I think that most DDS can do this.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
nope.
You still do NOT give credits of the kill.
You just change the ability from:
If a unit with the ability <regen> kills a unit, heal the killing unit.
to:
If a unit is killed by a unit from a player that has a unit with the ability <regen>, heal the unit with the ability <regen>.

So units that are not dummies will also heal that unit.
There are 2 things that should/could be done.

1. Do not let any dummy deal damage (which is a basic rule of dummies).
2. Use a DDS and if a summoned unit (including dummies that are not properly used) deals damage, change the damage source to the summoning unit.
 
Level 13
Joined
Dec 21, 2010
Messages
540
^ then just add a condition of
  • Conditions
    • ((Owner of triggering unit) belongs to (enemy of (Killing unit)) equal to true
    • ((Owner of killing unit) equal to (owner of (Unit_A))
    • Or - Any Conditions are true
      • Conditions
        • (unit type of killing unit == dummy)
        • (killing unit == hero)
..in this case units that are not dummies will NOT heal that unit.
 
Level 13
Joined
Dec 21, 2010
Messages
540
Your solution is also not MUI.

  • Troll Init
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set - HealLife[1] = 0.10
    • Set - HealLife[2] = 0.20
    • Set - HealLife[3] = 0.25
    • Set - HealMana[1] = 0.30
    • Set - HealMana[2] = 0.35
    • Set - HealMana[3] = 0.37
  • Learns Troll Regeneration
  • Events
    • Unit - Learns a skill
  • Conditions
    • Learned skill is equal to Troll Regeneration
    • Level of Troll Regeneration for Learning Unit Equal to 1
  • Actions
    • Set - MUI = Player number of owner of Learning Unit
    • Set - Unit_A[MUI] = Learning Unit
  • Gains Troll Regeneration
  • Events
    • Unit - Dies
  • Conditions
    • ((triggering unit) belongs to Enemy of (Killing unit)) equal to true
    • ((Owner of killing unit) equal to (owner of (Unit_A[Player number of owner of killing unit]))
    • Or - Any Conditions are true
      • Conditions
        • (unit type of killing unit == dummy)
        • (killing unit == hero)
  • Actions
    • Set - MUI = Player number of owner of Killing Unit
    • Set Unit_B = (Dying unit)
    • Unit - Set life of (Unit_A[MUI]) to ((Life of (Unit_A[MUI]) + ((Max life of Unit_B) x HealLife[(Level of Troll Regeneration for Unit_A[MUI])]))
    • Unit - Set mana of (Unit_A[MUI]) to ((Mana of (Unit_A[MUI]) + ((Max Mana of Unit_B) x HealMana[(Level of Troll Regeneration for Unit_A[MUI])]))
    • Special Effect - Create a special effect attached to the origin of Unit_A[MUI] using Abilities\Spells\Human\Heal\HealTarget.mdl
    • Special Effect - Destroy (Last created special effect)
...he didn't ask to make the trigger in MUI in the first place...
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
Still not MUI, MPI now.
Also he didn't mention anything... so MUI if possible, if not then MPI. MPI that is not possible is bull shit. MUI that is not possible is Blizzards mistake like Disable Ability for <player> instead of for <unit>.
 
Level 13
Joined
Dec 21, 2010
Messages
540
:V ..fine then I'll just set MUI + 1

  • Learns Troll Regeneration
  • Events
    • Unit - Learns a skill
  • Conditions
    • Learned skill is equal to Troll Regeneration
    • Level of Troll Regeneration for Learning Unit Equal to 1
  • Actions
    • Set - MUI = MUI + 1
    • Set - Unit_A[MUI] = Learning Unit
  • Gains Troll Regeneration
  • Events
    • Unit - Dies
  • Conditions
    • ((triggering unit) belongs to Enemy of (Killing unit)) equal to true
    • Or - Any Conditions are true
      • Conditions
        • (unit type of killing unit == dummy)
        • (killing unit == hero)
  • Actions
    • Set Unit_B = (Dying unit)
    • For each MUI2 from 1 to MUI
      • Loop - Actions
        • If - Any Conditions are true then do Actions
          • If - Conditions
            • Unit_A[MUI2] is Alive equal to true
            • ((Owner of killing unit) equal to (owner of (Unit_A[MUI2]))
          • Then - Actions
            • Unit - Set life of (Unit_A[MUI2]) to ((Life of (Unit_A[MUI2]) + ((Max life of Unit_B) x HealLife[(Level of Troll Regeneration for Unit_A[MUI2])]))
            • Unit - Set mana of (Unit_A[MUI2]) to ((Mana of (Unit_A[MUI2]) + ((Max Mana of Unit_B) x HealMana[(Level of Troll Regeneration for Unit_A[MUI2])]))
            • Special Effect - Create a special effect attached to the origin of Unit_A[MUI2] using Abilities\Spells\Human\Heal\HealTarget.mdl
            • Special Effect - Destroy (Last created special effect)
          • Else - Actions
 
Status
Not open for further replies.
Top