• 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.

[Trigger] Please tell me how to remove the attached special effects

Level 3
Joined
Feb 8, 2025
Messages
26
제목 없음.jpg


When multiple units cast the berserk skill, two effects do not disappear simultaneously after 12 seconds. What should I do? Please explain with examples.

P.S. 광폭화 = Same as Troll Berserker's skill berserk
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
Here's a basic system for destroying effects after a delay (see my 1st post):

Here's an advanced system that will be more precise:


Here's how you can post your triggers on Hiveworkshop so you don't need to take a picture:
 
Level 3
Joined
Feb 8, 2025
Messages
26
Here's a basic system for destroying effects after a delay (see my 1st post):

Here's an advanced system that will be more precise:


Here's how you can post your triggers on Hiveworkshop so you don't need to take a picture:
This trigger is not compatible with TwistedMeadows_S2_v1.1
Please let me know if there is a way to make the map compatible or a way to create a trigger without a custom script.
 
Last edited:
Level 3
Joined
Feb 8, 2025
Messages
26
Assuming you mean mine, it should be compatible with any map.

Make sure you have JassHelper enabled and your Variable has the same name.
The original TwistedMeadows_S2_v1.1 map doesn't seem to support JassHelper, so you'll probably have to write a trigger without a custom script.
 

Attachments

  • 제목 없음2.jpg
    제목 없음2.jpg
    86.2 KB · Views: 3
  • 제목 없음.jpg
    제목 없음.jpg
    153.1 KB · Views: 3
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
The original TwistedMeadows_S2_v1.1 map doesn't seem to support JassHelper, so you'll probably have to write a trigger without a custom script.
That means your map is on the newer Lua scripting mode, which means you can do something even better:
  • Delayed Destroy Effect
    • Events
    • Conditions
    • Actions
      • Custom script: local sfx = GetLastCreatedEffectBJ()
      • Custom script: local t = CreateTimer()
      • Custom script: TimerStart(t, udg_DDE_Delay, false, function()
      • Custom script: DestroyEffect(sfx)
      • Custom script: DestroyTimer(t)
      • Custom script: end)
Lua uses different syntax than Jass, but it's basically the same thing as you can see.
 
Level 3
Joined
Feb 8, 2025
Messages
26
That means your map is on the newer Lua scripting mode, which means you can do something even better:
  • Delayed Destroy Effect
    • Events
    • Conditions
    • Actions
      • Custom script: local sfx = GetLastCreatedEffectBJ()
      • Custom script: local t = CreateTimer()
      • Custom script: TimerStart(t, udg_DDE_Delay, false, function()
      • Custom script: DestroyEffect(sfx)
      • Custom script: DestroyTimer(t)
      • Custom script: end)
Lua uses different syntax than Jass, but it's basically the same thing as you can see.
Where is Wait DDE_Delay seconds?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
The Wait is no longer needed and DDE_Delay is being used as the duration of a Timer:
  • Custom script: TimerStart(t, udg_DDE_Delay, false, function()
All you need to do is edit that Delayed Destroy Effect trigger to look like the one I posted above.

Everything else remains the same:
  • Example DDE
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the chest of (Triggering unit) using Abilities\Spells\Human\DivineShield\DivineShieldTarget.mdl
      • Set VariableSet DDE_Delay = 1.00
      • Trigger - Run Delayed Destroy Effect <gen> (ignoring conditions)
 
Last edited:
Level 3
Joined
Feb 8, 2025
Messages
26
The Wait is no longer needed and DDE_Delay is being used as the duration of a Timer:
  • Custom script: TimerStart(t, udg_DDE_Delay, false, function()
All you need to do is edit that Delayed Destroy Effect trigger to look like the one I posted above.

Everything else remains the same:
  • Example DDE
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the chest of (Triggering unit) using Abilities\Spells\Human\DivineShield\DivineShieldTarget.mdl
      • Set VariableSet DDE_Delay = 1.00
      • Trigger - Run Delayed Destroy Effect <gen> (ignoring conditions)
I have one more question. Please tell me a trigger that will keep the effect for the duration (12 seconds) even if it is released from polymorph or hex (if it is released from resistance skin or dispel).
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
I have one more question. Please tell me a trigger that will keep the effect for the duration (12 seconds) even if it is released from polymorph or hex (if it is released from resistance skin or dispel).
I'm not sure I understand. The Special Effects created with triggers will last until you Destroy them.

Are you saying that Polymorph/Hex causes the Special Effect to disappear? If that's the case, you may want to rely on a hidden Ability to display the Art instead.

Something like this could work:
  • Delayed Remove Ability
    • Events
    • Conditions
    • Actions
      • Custom script: local unit = udg_DDE_Unit
      • Custom script: local abil = udg_DDE_Ability
      • Custom script: local t = CreateTimer()
      • Custom script: UnitAddAbility(unit, abil)
      • Custom script: TimerStart(t, udg_DDE_Delay, false, function()
      • Custom script: UnitRemoveAbility(unit, abil)
      • Custom script: DestroyTimer(t)
      • Custom script: end)
  • EXAMPLE
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Set Variable DDE_Unit = (Triggering unit)
      • Set Variable DDE_Ability = Hidden Art Ability
      • Set Variable DDE_Delay = 12.00
      • Trigger - Run Delayed Remove Ability (ignoring conditions)
This will Add the ability to your Unit, then after DDE_Delay seconds it will Remove the ability from the Unit.
 
Level 3
Joined
Feb 8, 2025
Messages
26
I'm not sure I understand. The Special Effects created with triggers will last until you Destroy them.

Are you saying that Polymorph/Hex causes the Special Effect to disappear? If that's the case, you may want to rely on a hidden Ability to display the Art instead.

Something like this could work:
  • Delayed Remove Ability
    • Events
    • Conditions
    • Actions
      • Custom script: local unit = udg_DDE_Unit
      • Custom script: local abil = udg_DDE_Ability
      • Custom script: local t = CreateTimer()
      • Custom script: UnitAddAbility(unit, abil)
      • Custom script: TimerStart(t, udg_DDE_Delay, false, function()
      • Custom script: UnitRemoveAbility(unit, abil)
      • Custom script: DestroyTimer(t)
      • Custom script: end)
  • EXAMPLE
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Set Variable DDE_Unit = (Triggering unit)
      • Set Variable DDE_Ability = Hidden Art Ability
      • Set Variable DDE_Delay = 12.00
      • Trigger - Run Delayed Remove Ability (ignoring conditions)
This will Add the ability to your Unit, then after DDE_Delay seconds it will Remove the ability from the Unit.
If you are released from Polymorph or Hex (within 12 seconds), the buff will remain, but the effect will disappear. What I want is for the effect to remain for the duration (12 seconds) even if it is released. If I understand what you mean, is it okay to use that trigger?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
If you are released from Polymorph or Hex (within 12 seconds), the buff will remain, but the effect will disappear. What I want is for the effect to remain for the duration (12 seconds) even if it is released. If I understand what you mean, is it okay to use that trigger?
You should be able to use that trigger, assuming that Abilities reapply their Art after Hex wears off.

Use the Item Armor Bonus (+1) ability. It doesn't have an Icon, you can disable it's effects, and you can use it's Art - Target field.

ex.png
 
Last edited:
Level 3
Joined
Feb 8, 2025
Messages
26
I'm not sure I understand. The Special Effects created with triggers will last until you Destroy them.

Are you saying that Polymorph/Hex causes the Special Effect to disappear? If that's the case, you may want to rely on a hidden Ability to display the Art instead.

Something like this could work:
  • Delayed Remove Ability
    • Events
    • Conditions
    • Actions
      • Custom script: local unit = udg_DDE_Unit
      • Custom script: local abil = udg_DDE_Ability
      • Custom script: local t = CreateTimer()
      • Custom script: UnitAddAbility(unit, abil)
      • Custom script: TimerStart(t, udg_DDE_Delay, false, function()
      • Custom script: UnitRemoveAbility(unit, abil)
      • Custom script: DestroyTimer(t)
      • Custom script: end)
  • EXAMPLE
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Set Variable DDE_Unit = (Triggering unit)
      • Set Variable DDE_Ability = Hidden Art Ability
      • Set Variable DDE_Delay = 12.00
      • Trigger - Run Delayed Remove Ability (ignoring conditions)
This will Add the ability to your Unit, then after DDE_Delay seconds it will Remove the ability from the Unit.
I'm getting this trigger error. It looks like I'll have to apply it to the newer Lua scripting mode.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Lua:
--in a blank Lua trigger or map's custom script header:
    function DelayedDestroyEffect(fx, duration)
        local t = CreateTimer()
        TimerStart(t, duration, false, function()
            DestroyEffect(fx)
            DestroyTimer(t)
        end)
    end

    function DelayedRemoveAbility(unit, abil, duration)
        local t = CreateTimer()
        if (abil ~= nil) then
            UnitAddAbility(unit, abil)
        end
        TimerStart(t, duration, false, function()
            UnitRemoveAbility(unit, abil)
            DestroyTimer(t)
        end)
    end
  • Delayed Destroy Effect
    • Events
    • Conditions
    • Actions
      • Custom script: DelayedDestroyEffect(GetLastCreatedEffectBJ(), udg_DDE_Delay)
  • Delayed Remove Ability
    • Events
    • Conditions
    • Actions
      • Custom script: DelayedRemoveAbility(udg_DDE_Unit, udg_DDE_Abil, udg_DDE_Delay)

  • Example Usage Ability
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Set VariableSet DDE_Unit = (Triggering unit)
      • Set VariableSet DDE_Abil = Art Ability
      • Set VariableSet DDE_Delay = 12.00
      • Trigger - Run Delayed Remove Ability <gen> (ignoring conditions)
  • Example Usage Effect
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set VariableSet DDE_Delay = 1.00
      • Trigger - Run Delayed Destroy Effect <gen> (ignoring conditions)
 
Level 3
Joined
Feb 8, 2025
Messages
26
Lua:
--in a blank Lua trigger or map's custom script header:
    function DelayedDestroyEffect(fx, duration)
        local t = CreateTimer()
        TimerStart(t, duration, false, function()
            DestroyEffect(fx)
            DestroyTimer(t)
        end)
    end

    function DelayedRemoveAbility(unit, abil, duration)
        local t = CreateTimer()
        if (abil ~= nil) then
            UnitAddAbility(unit, abil)
        end
        TimerStart(t, duration, false, function()
            UnitRemoveAbility(unit, abil)
            DestroyTimer(t)
        end)
    end
  • Delayed Destroy Effect
    • Events
    • Conditions
    • Actions
      • Custom script: DelayedDestroyEffect(GetLastCreatedEffectBJ(), udg_DDE_Delay)
  • Delayed Remove Ability
    • Events
    • Conditions
    • Actions
      • Custom script: DelayedRemoveAbility(udg_DDE_Unit, udg_DDE_Abil, udg_DDE_Delay)

  • Example Usage Ability
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Set VariableSet DDE_Unit = (Triggering unit)
      • Set VariableSet DDE_Abil = Art Ability
      • Set VariableSet DDE_Delay = 12.00
      • Trigger - Run Delayed Remove Ability <gen> (ignoring conditions)
  • Example Usage Effect
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set VariableSet DDE_Delay = 1.00
      • Trigger - Run Delayed Destroy Effect <gen> (ignoring conditions)
The effect should not be visible when polymorphed or hexed. When released, the effect should be visible again for the remaining duration.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
The effect should not be visible when polymorphed or hexed. When released, the effect should be visible again for the remaining duration.
We understand. Pyro just posted everything that was in the map I attached.
The latest version of the map is essential, so do you know how to create a trigger without a custom script?
I am always on the latest version and the map I attached works without issues. Custom Script works on every version of Warcraft 3.

You will need to show us the error you're getting if you can't get it to work.
 
Level 3
Joined
Feb 8, 2025
Messages
26
We understand. Pyro just posted everything that was in the map I attached.

I am always on the latest version and the map I attached works without issues. Custom Script works on every version of Warcraft 3.

You will need to show us the error you're getting if you can't get it to work.
It worked fine, but the problem is that the effect appears even when in polymorph or hex.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
It worked fine, but the problem is that the effect appears even when in polymorph or hex.
Oh, that's what you don't want to happen. Thought it was the other way around.

How about something like this:
Lua:
function DelayedDestroyEffectSpecial(u, model, attach, duration)

    local sfx = AddSpecialEffectTarget(model, u, attach)
    local isHidden = false
    if IsUnitType(u, UNIT_TYPE_POLYMORPHED) then
        DestroyEffect(sfx)
        isHidden = true
    end

    local t = CreateTimer()
    TimerStart(t, 0.03, true, function()

        duration = duration - 0.03
        if duration <= 0.01 or u == nil then
            if sfx then
                DestroyEffect(sfx)
            end
            DestroyTimer(t)
            return
        end

        if not isHidden then
            if IsUnitType(u, UNIT_TYPE_POLYMORPHED) then
                if sfx then
                    DestroyEffect(sfx)
                    sfx = nil
                end
                isHidden = true
            end
        else
            if not IsUnitType(u, UNIT_TYPE_POLYMORPHED) then
                sfx = AddSpecialEffectTarget(model, u, attach)
                isHidden = false
            end
        end
    end)
end
  • Example Usage Effect Special
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Siphon Mana
    • Actions
      • Set VariableSet DDE_Unit = (Target unit of ability being cast)
      • Set VariableSet DDE_Attach = overhead
      • Set VariableSet DDE_Model = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set VariableSet DDE_Delay = 10.00
      • Trigger - Run Delayed Destroy Effect Special <gen> (ignoring conditions)
 

Attachments

  • Delayed Effects 2.w3m
    18.5 KB · Views: 3
Last edited:
Level 3
Joined
Feb 8, 2025
Messages
26
Oh, that's what you don't want to happen. Thought it was the other way around.

How about something like this:
Lua:
function DelayedDestroyEffectSpecial(u, model, attach, duration)

    local sfx = AddSpecialEffectTarget(model, u, attach)
    local isHidden = false
    if IsUnitType(u, UNIT_TYPE_POLYMORPHED) then
        DestroyEffect(sfx)
        isHidden = true
    end

    local t = CreateTimer()
    TimerStart(t, 0.03, true, function()

        duration = duration - 0.03
        if duration <= 0.01 or u == nil then
            if sfx then
                DestroyEffect(sfx)
            end
            DestroyTimer(t)
            return
        end

        if not isHidden then
            if IsUnitType(u, UNIT_TYPE_POLYMORPHED) then
                if sfx then
                    DestroyEffect(sfx)
                    sfx = nil
                end
                isHidden = true
            end
        else
            if not IsUnitType(u, UNIT_TYPE_POLYMORPHED) then
                sfx = AddSpecialEffectTarget(model, u, attach)
                isHidden = false
            end
        end
    end)
end
  • Example Usage Effect Special
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Siphon Mana
    • Actions
      • Set VariableSet DDE_Unit = (Target unit of ability being cast)
      • Set VariableSet DDE_Attach = overhead
      • Set VariableSet DDE_Model = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set VariableSet DDE_Delay = 10.00
      • Trigger - Run Delayed Destroy Effect Special <gen> (ignoring conditions)
In previous versions, the effect should appear on both arms, but in the current version, it only appears on one arm. Also, in the previous version, the effect was compatible with the trigger that disappeared immediately upon death, but in the current version, it is not compatible with that trigger.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Example Usage Effect Special
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to 광폭화 (나가)
Actions
Set VariableSet DDE_Unit = (Casting unit)
Set VariableSet DDE_Attach = hand,right
Set VariableSet DDE_Model = Abilities\Spells\Orc\TrollBerserk\HeadhunterWEAPONSRight.mdl
Set VariableSet DDE_Delay = 12.00
Set VariableSet Effect[1] = (Last created special effect)
Trigger - Run Delayed Destroy Effect Special<gen> (ignoring conditions)
Set VariableSet DDE_Unit = (Casting unit)
Set VariableSet DDE_Attach = hand,left
Set VariableSet DDE_Model = Abilities\Spells\Orc\TrollBerserk\HeadhunterWEAPONSRight.mdl
Set VariableSet DDE_Delay = 12.00
Set VariableSet Effect[2] = (Last created special effect)
Trigger - Run Delayed Destroy Effect Special<gen> (ignoring conditions)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Example Usage Effect Die
Events
Unit - A unit Dies
Conditions
(Unit-type of (Dying unit)) Equal to 차원광전사
Actions
Special Effect - Destroy Effect[1]
Special Effect - Destroy Effect[2]
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
This new version should destroy the effects when the unit dies.

You can also rely on an Ability using a new trigger:
  • Delayed Remove Ability Special
    • Events
    • Conditions
    • Actions
      • Custom script: DelayedRemoveAbilitySpecial(udg_DDE_Unit, udg_DDE_Abil, udg_DDE_Delay)
The Ability can have multiple Art - Attachment Points so you don't need to create multiple Special Effects.

Edit: Reuploaded map, fixed bug.
 

Attachments

  • Delayed Effects 3.w3m
    18.7 KB · Views: 3
Last edited:
Level 3
Joined
Feb 8, 2025
Messages
26
This new version should destroy the effects when the unit dies.

You can also rely on an Ability using a new trigger:
  • Delayed Remove Ability Special
    • Events
    • Conditions
    • Actions
      • Custom script: DelayedRemoveAbilitySpecial(udg_DDE_Unit, udg_DDE_Abil, udg_DDE_Delay)
The Ability can have multiple Art - Attachment Points so you don't need to create multiple Special Effects.

Edit: Reuploaded map, fixed bug.
Thank you
 
Level 3
Joined
Feb 8, 2025
Messages
26
No problem, let me know if there's anything weird about the code.
This time, I need to add sound, but I can only play sound for one unit. However, many units contain custom scripts. As you know, my map doesn't work with general custom scripts, so please tell me how to play sound (attack(applies separately to air and ground), casting) for each unit individually.
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,876
This time, I need to add sound, but I can only play sound for one unit.
I don't understand what playing a Sound for one unit means. You'll have to explain in greater detail.
Edit: Also, I recommend making a new thread, this is getting very off-topic.

However, many units contain custom scripts. As you know, my map doesn't work with general custom scripts, so please tell me how to play sound (attack(applies separately to air and ground), casting) for each unit individually.
Your map works with general Custom Scripts. You're just using LUA mode instead of the default JASS mode.

JASSlua.png


These are two different scripting languages which have different syntax rules, meaning that they need to be structured differently. Luckily, the differences are small and easy to remember, here's an example:

This will Kill the last created unit in JASS (default language most people use):
  • Actions
    • Custom script: local unit u = GetLastCreatedUnit()
    • Custom script: call KillUnit(u)
This will Kill the last created unit in LUA (newer language added in patch 1.31):
  • Actions
    • Custom script: local u = GetLastCreatedUnit()
    • Custom script: KillUnit(u)
They do the same exact thing. It's just that JASS requires the use of the word "call" before running a function and your Variables need their "type" written before their name. In this case the variable "u" is a "unit" variable. There's more rules than that but it's not difficult to look these up or ask ChatGPT to convert between the two languages. At the end of the day you're using the same Warcraft 3 API, which means that you're working with the same Blizzard functions like GetLastCreatedUnit() and KillUnit().
 
Last edited:
Top