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

Local variable

Status
Not open for further replies.
Level 7
Joined
Jul 4, 2007
Messages
249
The effect is not getting destroyed and I can't think of why this wouldn't work?
  • Immolation
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Lord of the Seven 0141 <gen> is alive) Equal to True
    • Actions
      • Set unit = Lord of the Seven 0141 <gen>
      • Set int = ((Level of (Illidan) Immolation for unit) - 1)
      • Set tempLoc = (Position of unit)
      • Set calcedDmg = (Illi_immoDmg[int] + (((Max life of unit) - (Life of unit)) x Illi_immoPercentDmg[int]))
      • Set unitGrp = (Units within Illi_immoRadius[int] of tempLoc matching (((Matching unit) belongs to an enemy of (Owner of unit)) Equal to True))
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Unit Group - Pick every unit in unitGrp and do (Actions)
        • Loop - Actions
          • Custom script: local effect udg_tempEffect
          • Unit - Cause unit to damage (Picked unit), dealing calcedDmg damage of attack type Spells and damage type Enhanced
          • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\NightElf\Immolation\ImmolationDamage.mdl
          • Set tempEffect = (Last created special effect)
          • Wait 1.00 seconds
          • Special Effect - Destroy tempEffect
      • Custom script: call DestroyGroup(udg_unitGrp)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Pretty sure waits don't work when enumerating through units. Also, this trigger replaces the previous tempEffect every time you set it.

With how you have it setup now, if you picked through 10 units and created 10 special effects only the very last special effect would end up being set as tempEffect. So even if the Wait worked, it would only destroy the most recent special effect.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
4,994
Can't use waits in ForGroup() or ForForce() callbacks, which is what Unit Group - Pick and Player Group - Pick are internally. Effectively those threads crash at the Wait action and the destroy line is never called. Since this spell relies on preplaced units any way it doesn't matter if a solution is not MUI since the spell is only used by one unit anyway. Make a new effect array for this spell, save the effects in that array, and then delete them at the end:

  • Immolation
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Lord of the Seven 0141 <gen> is alive) Equal to True
    • Actions
      • Set unit = Lord of the Seven 0141 <gen>
      • Set int = ((Level of (Illidan) Immolation for unit) - 1)
      • Set tempLoc = (Position of unit)
      • Set calcedDmg = (Illi_immoDmg[int] + (((Max life of unit) - (Life of unit)) x Illi_immoPercentDmg[int]))
      • Set unitGrp = (Units within Illi_immoRadius[int] of tempLoc matching (((Matching unit) belongs to an enemy of (Owner of unit)) Equal to True))
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Set EFFECT_COUNT = 0
      • Unit Group - Pick every unit in unitGrp and do (Actions)
        • Loop - Actions
          • Custom script: local effect udg_tempEffect
          • Unit - Cause unit to damage (Picked unit), dealing calcedDmg damage of attack type Spells and damage type Enhanced
          • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\NightElf\Immolation\ImmolationDamage.mdl
          • Set EFFECT_COUNT = (EFFECT_COUNT + 1)
          • Set EFFECT_ARRAY[EFFECT_COUNT] = (Last created special effect)
      • Custom script: call DestroyGroup(udg_unitGrp)
      • Wait 1.00 seconds
      • For each (Integer A) from 1 to EFFECT_COUNT do (Actions)
        • Loop - Actions
          • Special Effect - Destroy EFFECT_ARRAY[(Integer A)]
Usually one simply destroys the effect immediately after it's created, playing its death animation and hopefully that's long enough. However, another possible solution now that we have new effect natives is to set the effect's animation speed (timescale) lower to control how long it takes to play the death animation. This may or may not work with the immolation damage model (I'm not sure) but it may be worth trying.
Pretty sure waits don't work when enumerating through units. Also, this trigger replaces the previous tempEffect every time you set it.

With how you have it setup now, if you picked 10 different units and created 10 different special effects only the very last special effect would end up being set as tempEffect. So even if the Wait worked, it would only destroy 1 out of 10 of the special effects.
Actually, no, the OP wrote something that would work fine if waits in ForGroup worked. They properly shadowed tempEffect to make it local within the ForGroup callback function.
 
Level 7
Joined
Jul 4, 2007
Messages
249
If I destroy it immediately it still lasts for like 5 seconds, repeating animation until it perish. I tried using timescale and time but I don't notice any difference
 
Status
Not open for further replies.
Top