• 🏆 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 explosion on death not working

Status
Not open for further replies.
Level 8
Joined
Aug 15, 2010
Messages
216
Sorry to bother you again my friends, but i seem to have another problem:
When a unit has this specific buff, when it dies it needs to damage its friendlies for 50% of its hp...
BUT
it doesn't work :(
  • Touch explode
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) has buff |CFF6633FFTouch Of Fischerdol|r ) Equal to True
    • Actions
      • Set Region = (Region centered at (Position of (Triggering unit)) with size (500.00, 500.00))
      • Special Effect - Create a special effect at (Center of Region) using war3mapImported\Dark Execution.mdx
      • Unit Group - Pick every unit in (Units in Region owned by (Owner of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • Unit - Cause (Dying unit) to damage (Picked unit), dealing ((Max life of (Triggering unit)) / 2.00) damage of attack type Spells and damage type Normal
So whats the problem here?
 
Level 25
Joined
May 11, 2007
Messages
4,651
The dying unit cannot damage any units as it's dead.
Also use set tempPoint1 = position of triggering unit
and
set tempGroup1 = units in range of tempPoint1 owned by owner of triggering unit.

(Your spell leaks)
 
Level 8
Joined
Aug 15, 2010
Messages
216
(Your spell leaks)

(Of course it does XD)

So i made a dummy and made it do the dirty work but... still not working

(I'll fix the leaks later ;) )
  • Touch explode
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) has buff |CFF6633FFTouch Of Fischerdol|r ) Equal to True
    • Actions
      • Unit - Create 1 MEAH DUMMY for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
      • Set Dummy[1] = (Last created unit)
      • Set Region = (Region centered at (Position of Dummy[1]) with size (500.00, 500.00))
      • Special Effect - Create a special effect at (Center of Region) using war3mapImported\Dark Execution.mdx
      • Unit Group - Pick every unit in (Units in Region owned by (Owner of Dummy[1])) and do (Actions)
        • Loop - Actions
          • Unit - Cause Dummy[1] to damage (Picked unit), dealing ((Max life of (Triggering unit)) / 2.00) damage of attack type Spells and damage type Normal
      • Unit - Remove Dummy[1] from the game
 
Level 25
Joined
May 11, 2007
Messages
4,651
  • I r awesome
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) has buff Berserk) Equal to True
    • Actions
      • Game - Display to (All players) the text: Does this show up?
      • Set tempPoint1 = (Position of (Triggering unit))
      • Special Effect - Create a special effect at tempPoint1 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set tempGroup1 = (Units within 500.00 of tempPoint1 matching (((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))) and (((Matching unit) is alive) Equal to True)))
      • Unit - Create 1 Dummy Spellcaster for (Owner of (Triggering unit)) at tempPoint1 facing Default building facing degrees
      • Unit - Add a 1.00 second Water Elemental expiration timer to (Last created unit)
      • Unit Group - Pick every unit in tempGroup1 and do (Actions)
        • Loop - Actions
          • Set tempReal = ((Max life of (Picked unit)) / 2.00)
          • Unit - Cause (Last created unit) to damage (Picked unit), dealing tempReal damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_tempPoint1)
      • Custom script: call DestroyGroup(udg_tempGroup1)
Haven't tested it but it should work.
 
Level 8
Joined
Aug 15, 2010
Messages
216
Ok so i tried exactly as you said
  • Touch explode
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) has buff |CFF6633FFTouch Of Fischerdol|r ) Equal to True
    • Actions
      • Game - Display to (All players) the text: IT WORKS!
      • Set tempPoint1 = (Position of (Triggering unit))
      • Special Effect - Create a special effect at (Center of Region) using war3mapImported\Dark Execution.mdx
      • Special Effect - Destroy (Last created special effect)
      • Set tempGroup1 = (Units within 500.00 of tempPoint1 matching (((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))) and (((Matching unit) is alive) Equal to True)))
      • Unit - Create 1 MEAH DUMMY for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Triggering unit)
      • Unit Group - Pick every unit in tempGroup1 and do (Actions)
        • Loop - Actions
          • Set tempReal = ((Max life of (Picked unit)) / 2.00)
          • Unit - Cause (Last created unit) to damage (Picked unit), dealing tempReal damage of attack type Spells and damage type Normal
      • Custom script: call RemoveLocation(udg_tempPoint1)
      • Custom script: call DestroyGroup(udg_tempGroup1)
The text doesn't show up and i'm 100% sure that the buff placed on the unit is right. i based it off the Cripple spell, and so i did with the cripple buff, creating custom spells out of both of them.
 
Level 25
Joined
May 11, 2007
Messages
4,651
Unit - Create 1 MEAH DUMMY for (Owner of (Triggering unit)) at (Center of (Playable map area)) facing Default building facing degrees

you're not creating it at tempPoint1, creating a leak.
 
Level 4
Joined
Nov 27, 2012
Messages
85
I believe the problem with your spell is you were having your dying unit damage only your own units, unless this is the intended effect. Your "Picked units" in the trigger below are Units owned by the owner of the dying unit, same as the triggerd LordDZ supplied.

  • Unit Group - Pick every unit in (Units in Region owned by (Owner of (Triggering unit))) and do (Actions)
  • Loop - Actions
  • Unit - Cause (Dying unit) to damage (Picked unit), dealing ((Max life of (Triggering unit)) / 2.00) damage of attack type Spells and damage type Normal
A workaround is to create a new unit variable, and when your spell is cast on a target, set that target to the new variable. When a unit dies, if unit is equal to the variable, etc.
Set the variable to null when the unit dies or the spell effect wears off.



Using a dummy to the deal damage is NOT necessary, the dying unit CAN damage units. Here is an example from my map of the same effect.

JASS:
    local group g=CreateGroup()
    local unit u=GetTriggerUnit()
    local unit p=null
    
    call DestroyEffect(AddSpecialEffect("war3mapImported\\NewMassiveEX.mdx",GetUnitX(u),GetUnitY(u)))
    call GroupEnumUnitsInRange(g,GetUnitX(u),GetUnitY(u),300.00,null)
    loop
        set p=FirstOfGroup(g)
        exitwhen p==null
        if IsUnitAlly(p,GetOwningPlayer(u))==false and IsUnitType(p,UNIT_TYPE_STRUCTURE)==false and IsUnitType(p,UNIT_TYPE_MAGIC_IMMUNE)==false and IsUnitType(p,UNIT_TYPE_MECHANICAL)==false then
            call UnitDamageTarget(u,p,350.00,true,true,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_UNIVERSAL,null)
        endif
        
        call GroupRemoveUnit(g,p)
    endloop
    
    call DestroyGroup(g)
    set g=null
 
Status
Not open for further replies.
Top