• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

After death effect ability

Status
Not open for further replies.
Level 6
Joined
Jul 10, 2016
Messages
167
I am trying to make an ability wherein if the targeted unit dies while having the ability buff, a death effect happens.

To make things easier to understand this is what I want to happen:
  1. Hero uses Shadow Strike warden ability on enemy unit
  2. Enemy unit takes damage and later on dies
  3. When the enemy unit dies, I want a dummy unit to cast fan of knives on the body of the dying unit.
However, I cant get past the condition.

DISCLAIMER: I dont know much about triggers, and im basically using what basics i learn through trial and error and whatever i read in hiveworkshop. Also, I don't know how to implement a damage detector engine, so that's probably out of the question.


  • Toxic Spikes Effect
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) has buff Toxic Spikes ) Equal to True
    • Actions
      • Set LocationToxicSpikes = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Owner of (Killing unit)) at LocationToxicSpikes facing Default building facing degrees
      • Unit - Add Dummy Toxic Spikes to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation( udg_LocationToxicSpikes)
 
Level 6
Joined
Jul 10, 2016
Messages
167
A dying unit does not have any buff. You can work around this by utilizing a unit group and detect if unit is in unit group (have a periodic check to remove unit without buff from the group).
Oh yeah! I just have to make systems to add and remove them from the unit group. Thanks!
 
Level 6
Joined
Jul 10, 2016
Messages
167
A dying unit does not have any buff. You can work around this by utilizing a unit group and detect if unit is in unit group (have a periodic check to remove unit without buff from the group).
I tried the following triggers, and it seems to work, but sometimes the removal system overlaps and stops from working...

Is there anyway for me to make it better?

EDIT: The overlap happens when the projectile of the ability is still travelling and the removal system triggers.

  • Toxic Spikes Setup
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Toxic Spikes
    • Actions
      • Unit Group - Add (Target unit of ability being cast) to GroupToxicSpikesUnit
  • Toxic Spikes Effect
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in GroupToxicSpikesUnit) Equal to True
    • Actions
      • Set LocationToxicSpikes = (Position of (Dying unit))
      • Unit - Create 1 Dummy for (Owner of (Killing unit)) at LocationToxicSpikes facing Default building facing degrees
      • Unit - Add Dummy Toxic Spikes to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Warden - Fan Of Knives
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Custom script: call RemoveLocation( udg_LocationToxicSpikes)
      • Unit Group - Remove (Dying unit) from GroupToxicSpikesUnit
  • Toxic Spikes Removal
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in GroupToxicSpikesUnit and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Toxic Spikes ) Equal to True
            • Then - Actions
              • Do nothing
            • Else - Actions
              • Unit Group - Remove (Picked unit) from GroupToxicSpikesUnit
 
Level 6
Joined
Jul 10, 2016
Messages
167
Overlaps how, if I may ask?

The third trigger can be reversed to check if it's false and then remove the unit from the group.

This seems to be a pickle that can benefit a lot from a generic system to work on, I'll take note of this.
Late edit on my previous reply: the overlap seems to happen when the projectile of the ability is still travelling, and the removal trigger happens.

Since the unit is already in the unit group, but still doesnt have a buff since the projectile still hasnt hit. So, if i cant find a better way to work this trigger, then my only choice is to make it instant.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Use a Damage Engine to detect the Shadow Strike damage and add the target to the Unit Group in response. You can't predict how long it'll take for the Shadow Strike missile to reach it's target so you can't really rely on a delay.

An alternative would be to use a missile system and recreate Shadow Strike yourself using triggers. This would be the better solution if you don't want the overhead that comes with using a Damage Engine.
 
Last edited:

Wrda

Spell Reviewer
Level 26
Joined
Nov 18, 2012
Messages
1,895
Or just have the dummy unit be the one to cast the real Shadow Strike ability, while the hero just casts a dummy spell. There you know if the unit dies and the killing unit was the dummy unit, then it was from Shadow Strike.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Or just have the dummy unit be the one to cast the real Shadow Strike ability, while the hero just casts a dummy spell. There you know if the unit dies and the killing unit was the dummy unit, then it was from Shadow Strike.
That's not exactly what he wants though. It needs to work if the unit dies from ANY source while under the effects of Shadow Strike.
 
Level 6
Joined
Jul 10, 2016
Messages
167
Use a Damage Engine to detect the Shadow Strike damage and add the target to the Unit Group in response. You can't predict how long it'll take for the Shadow Strike missile to reach it's target so you can't really rely on a delay.

An alternative would be to use a missile system and recreate Shadow Strike yourself using triggers. This would be the better solution if you don't want the overhead that comes with using a Damage Engine.
Its foolish I know, but I kinda knew I need to implement a Damage Engine, but I wanted to hold it off since I dont really understand how it works. However, I saw this comment of yours in a separate forum which gave me a tad bit of an idea on how it works. I'll read on it too.

I tried opening the attached file on the said comment, but unfortunately, I am unable to do so.

So I think what I'm going to do now is try to implement this old version of damage engine of Bribe.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
It looks intimidating at first because there's A LOT of variables, but in reality only a few of those will actually be used in your triggers. So try to focus on those few variables and you should be good (I mention them in that thread you linked). The Events that the system uses can be a bit confusing at first but there's plenty of information out there that explains which one you should be using. I haven't used the older versions but I think this is the Event you want:
  • Game - DamageModifierEvent becomes equal to 1.00

The only issue you may run into is determining that it was Shadow Strike that dealt the damage. I know in newer ones you can use Conditons to determine Damage Types. There's also Booleans to determine if the damage was Spell Damage, Triggered Damage, Ranged Attack Damage, or Melee Attack Damage. The issue here is that your Hero or whatever unit is casting Shadow Strike might have multiple spells that share these same conditions. For example, when your Hero casts Fan of Knives it may set off the Damage Event trigger. This is because it may not be possible to decipher between Fan of Knives and Shadow Strike damage with the basic Conditions provided.

One solution to this is to use 2 abilities and a dummy unit. The first ability is a "fake" Shadow Strike that your Hero casts and the second ability is the real Shadow Strike. You then use a brand new Dummy unit, one that is used exclusively for this trigger, to cast the real Shadow Strike ability in response to your Hero casting the "fake" Shadow Strike. So fake Shadow Strike wouldn't have any effects and would serve only as a tooltip/cd/mana cost, while the Dummy would cast the real Shadow Strike which would contain the damage/slow/buff.

This allows you to easily check in your Damage Event trigger if the DamageEventSource (who dealt the damage) was equal to your Dummy unit, and if this is True, then you know for a fact that it came from Shadow Strike since that's the ONLY damage this Dummy unit will EVER deal.
 
Last edited:
Level 6
Joined
Jul 10, 2016
Messages
167
It looks intimidating at first because there's A LOT of variables, but in reality only a few of those will actually be used in your triggers. So try to focus on those few variables and you should be good (I mention them in that thread you linked). The Events that the system uses can be a bit confusing at first but there's plenty of information out there that explains which one you should be using. I haven't used the older versions but I think this is the Event you want:
  • Game - DamageModifierEvent becomes equal to 1.00

The only issue you may run into is determining that it was Shadow Strike that dealt the damage. I know in newer ones you can use Conditons to determine Damage Types. There's also Booleans to determine if the damage was Spell Damage, Triggered Damage, Ranged Attack Damage, or Melee Attack Damage. The issue here is that your Hero or whatever unit is casting Shadow Strike might have multiple spells that share these same conditions. For example, when your Hero casts Fan of Knives it may set off the Damage Event trigger. This is because it may not be possible to decipher between Fan of Knives and Shadow Strike damage with the basic Conditions provided.

One solution to this is to use 2 abilities and a dummy unit. The first ability is a "fake" Shadow Strike that your Hero casts and the second ability is the real Shadow Strike. You then use a brand new Dummy unit, one that is used exclusively for this trigger, to cast the real Shadow Strike ability in response to your Hero casting the "fake" Shadow Strike. So fake Shadow Strike wouldn't have any effects and would serve only as a tooltip/cd/mana cost, while the Dummy would cast the real Shadow Strike which would contain the damage/slow/buff.

This allows you to easily check in your Damage Event trigger if the DamageEventSource (who dealt the damage) was equal to your Dummy unit, and if this is True, then you know for a fact that it came from Shadow Strike since that's the ONLY damage this Dummy unit will EVER deal.
TBH, this seems like a lot of work, and since I'm trying to make multiple new races I'm definitely gonna have to rework old trigger-based abilities to make function a lot better. This is incredibly troublesome xD.

Anyway, it is what it is. At least I have a basic working knowledge of damage detection. Follow up question, can I use the Illidan channeling ability as the dummy ability for heroes? I've seen some people use it for dummy abilities, and curious if it is the most reliable dummy casting ability.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
I'm going to assume you mean Channel. It's a template ability that offers a lot of customization and is designed to be used with triggers.

I normally recommend that ability, but it has a downside. Any ability based on Channel will automatically animation cancel once the spell goes off. I believe this is because Channeling abilities function this way, but it's stupid because most of the time Channel is used to make non-Channeling abilities. It was an oversight from the devs to not update it's mechanics when using it as a non-channeling ability, but it wouldn't be Warcraft 3 without an annoying issue that will never be fixed.

So if I were you I'd use a modified Forked Lightning for the fake Shadow Strike ability. Remove all of it's Art and adjust the Damage/Targets Allowed so that it has no visible effect and you should be good to go.


It's actually fairly easy to do this and only requires basic Object Editor knowledge and very basic triggering:
  • Copy and paste Forked Lightning and modify it like I described above, it's appearance/costs should mimic Shadow Strike. This is what the Hero will use.
  • Adjust your real Shadow Strike ability so that it doesn't cost mana and has 999999 cast range. This is what the Dummy will use.
  • Create a new Dummy unit, let's name it Shadow Strike Dummy. Give it the real Shadow Strike ability. Dummy units should be based on Locust and have their Movement Type set to None, Speed Base set to 0, and Attacks Enabled set to None.
  • Create a new trigger which will handle the Shadow Strike Dummy stuff:
  • Events:
  • Unit - A unit starts the effect of an ability
  • Conditions:
  • Ability being cast Equal to Shadow Strike (Hero)
  • Actions:
  • Set Variable TempPoint = Position of Triggering unit
  • Unit - Create 1 Shadow Strike Dummy at TempPoint facing default degrees
  • Custom script: call RemoveLocation (udg_TempPoint)
  • Unit - Add 0.50 second Expiration Timer to Last created unit
  • Unit - Order last created unit to Warden - Shadow Strike Target unit of ability being cast

Finally, create a new trigger which will handle the Damage Event for Shadow Strike:
  • Events:
  • Game - DamageModifierEvent becomes equal to 1.00
  • Conditions:
  • Unit-type of DamageEventSource Equal to Shadow Strike Dummy
  • Actions:
  • Unit Group - Add DamageEventTarget to GroupToxicSpikesUnit

That should be it. Now when the enemy takes damage from Shadow Strike it will be added to the Toxic Spikes Unit Group.

That being said, there are some minor adjustments I would do to your Removal trigger to improve it's efficiency.
  • Don't use "Do Nothing", this is a useless Action.
  • Adjust your If Then Else to check if the unit has the Buff Equal to FALSE, this way you don't need the ELSE part of the If Then Else statement.
  • Your Removal trigger only needs to be turned on when there's units in the Toxic Spikes Unit Group. It doesn't need to be on otherwise.
So turn the Removal trigger off by default (Initially On = Unchecked), then add some Actions to Turn it On/Off.

To do this, simply turn the Removal trigger ON when you add a unit to the unit group. So in this case it'd be done in our Damage Event trigger:
  • Unit Group - Add DamageEventTarget to GroupToxicSpikesUnit
  • Trigger - Turn on Toxic Spikes Removal

Then in your Removal trigger, at the very bottom, add a new If Then Else statement that will turn the Removal trigger OFF once the Unit Group is empty:
  • If number of units in GroupToxicSpikesUnit Equal to 0 then Turn off this trigger

This will act like a light switch so the Removal trigger will be on when a unit is affected by Shadow Strike and off when no units are affected by Shadow Strike.
 
Last edited:
Level 6
Joined
Jul 10, 2016
Messages
167
I'm going to assume you mean Channel. It's a template ability that offers a lot of customization and is designed to be used with triggers.

I normally recommend that ability, but it has a downside. Any ability based on Channel will automatically animation cancel once the spell goes off. I believe this is because Channeling abilities function this way, but it's stupid because most of the time Channel is used to make non-Channeling abilities. It was an oversight from the devs to not update it's mechanics when using it as a non-channeling ability, but it wouldn't be Warcraft 3 without an annoying issue that will never be fixed.

So if I were you I'd use a modified Forked Lightning for the fake Shadow Strike ability. Remove all of it's Art and adjust the Damage/Targets Allowed so that it has no visible effect and you should be good to go.


It's actually fairly easy to do this and only requires basic Object Editor knowledge and very basic triggering:
  • Copy and paste Forked Lightning and modify it like I described above, it's appearance/costs should mimic Shadow Strike. This is what the Hero will use.
  • Adjust your real Shadow Strike ability so that it doesn't cost mana and has 999999 cast range. This is what the Dummy will use.
  • Create a new Dummy unit, let's name it Shadow Strike Dummy. Give it the real Shadow Strike ability. Dummy units should be based on Locust and have their Movement Type set to None, Speed Base set to 0, and Attacks Enabled set to None.
  • Create a new trigger which will handle the Shadow Strike Dummy stuff:
  • Events:
  • Unit - A unit starts the effect of an ability
  • Conditions:
  • Ability being cast Equal to Shadow Strike (Hero)
  • Actions:
  • Set Variable TempPoint = Position of Triggering unit
  • Unit - Create 1 Shadow Strike Dummy at TempPoint facing default degrees
  • Custom script: call RemoveLocation (udg_TempPoint)
  • Unit - Add 0.50 second Expiration Timer to Last created unit
  • Unit - Order last created unit to Warden - Shadow Strike Target unit of ability being cast

Finally, create a new trigger which will handle the Damage Event for Shadow Strike:
  • Events:
  • Game - DamageModifierEvent becomes equal to 1.00
  • Conditions:
  • Unit-type of DamageEventSource Equal to Shadow Strike Dummy
  • Actions:
  • Unit Group - Add DamageEventTarget to GroupToxicSpikesUnit

That should be it. Now when the enemy takes damage from Shadow Strike it will be added to the Toxic Spikes Unit Group.

That being said, there are some minor adjustments I would do to your Removal trigger to improve it's efficiency.
  • Don't use "Do Nothing", this is a useless Action.
  • Adjust your If Then Else to check if the unit has the Buff Equal to FALSE, this way you don't need the ELSE part of the If Then Else statement.
  • Your Removal trigger only needs to be turned on when there's units in the Toxic Spikes Unit Group. It doesn't need to be on otherwise.
So turn the Removal trigger off by default (Initially On = Unchecked), then add some Actions to Turn it On/Off.

To do this, simply turn the Removal trigger ON when you add a unit to the unit group. So in this case it'd be done in our Damage Event trigger:
  • Unit Group - Add DamageEventTarget to GroupToxicSpikesUnit
  • Trigger - Turn on Toxic Spikes Removal

Then in your Removal trigger, at the very bottom, add a new If Then Else statement that will turn the Removal trigger OFF once the Unit Group is empty:
  • If number of units in GroupToxicSpikesUnit Equal to 0 then Turn off this trigger

This will act like a light switch so the Removal trigger will be on when a unit is affected by Shadow Strike and off when no units are affected by Shadow Strike.
Thank you very much!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,583
Oh, and I forgot an important step. Actually importing the Damage Engine into your map :p
You'll obviously want to do this first.

In the older version of Bribe's Damage Engine there are a couple of custom abilities that you need to copy & paste from the demo map into your map. Something like "Cheat Death" and "Spell Damage Reduction".

After copying those over to your map you'll want to copy and paste the Damage Engine folder which contains the system. You don't need the extra triggers that are provided in the demo map since they're just for showcasing the system.

Hopefully you don't get any errors, it can be a bit of a pain sometimes. After importing the system, go into it's Configuration trigger and you should see some variables for the Cheat Death/Spell Damage Reduction abilities that you'll need to update. Everything else in that trigger should probably remain the same.
 
Level 6
Joined
Jul 10, 2016
Messages
167
Oh, and I forgot an important step. Actually importing the Damage Engine into your map :p
You'll obviously want to do this first.

In the older version of Bribe's Damage Engine there are a couple of custom abilities that you need to copy & paste from the demo map into your map. Something like "Cheat Death" and "Spell Damage Reduction".

After copying those over to your map you'll want to copy and paste the Damage Engine folder which contains the system. You don't need the extra triggers that are provided in the demo map since they're just for showcasing the system.

Hopefully you don't get any errors, it can be a bit of a pain sometimes. After importing the system, go into it's Configuration trigger and you should see some variables for the Cheat Death/Spell Damage Reduction abilities that you'll need to update. Everything else in that trigger should probably remain the same.
Bribe included the abilities in the tutorial, so no worries there. What I was wondering was Anti-Magic Shell, it seems buggy but I dont seem to understand it.

He left this comment on one of the Anti-Magic Shell triggers:

Requires you to copy the ability "Anti-Magic Shell (Fixed)" from Object Editor into your map. AMS cannot be configured to work with a damage detection system as it will always have ambiguous results and the shield will be popped or reduce damage to 0.00 before the damage event runs, so the ability is based off of Frost Armor with its only utility being triggered.

And this is the script in the same trigger

Code:
constant function GetAMSBuffId takes nothing returns integer
    return 'Bams'
endfunction

constant function GetAMSAbilId takes nothing returns integer
    return 'A002'
endfunction

constant function GetAMSShieldVal takes nothing returns real
    return 300.00
endfunction

function Trig_Anti_Magic_Shield_Fix_Actions takes nothing returns nothing
    local integer id = GetUnitUserData(udg_DamageEventTarget)
    local real shield = udg_AMSAmount[id]- udg_DamageEventAmount
    if shield <= 0.00 then
        set udg_DamageEventAmount = -shield
        set shield = 0.00
        call UnitRemoveAbility(udg_DamageEventTarget, GetAMSBuffId())
    else
        set udg_DamageEventAmount = 0.00
        if udg_DamageEventType == 0 then
            set udg_DamageEventType = udg_DamageTypeBlocked
        endif
    endif
    set udg_AMSAmount[id] = shield
endfunction

function Trig_Anti_Magic_Shield_Fix_Conditions takes nothing returns boolean
    if udg_IsDamageSpell then
        if GetUnitAbilityLevel(udg_DamageEventTarget, GetAMSBuffId()) > 0 then
            call Trig_Anti_Magic_Shield_Fix_Actions()
        else
            set udg_AMSAmount[GetUnitUserData(udg_DamageEventTarget)] = 0.00
        endif
    endif
    return false
endfunction

function AMS_Refresh_Conditions takes nothing returns boolean
    if GetSpellAbilityId() == GetAMSAbilId() then
        set udg_AMSAmount[GetUnitUserData(GetSpellTargetUnit())] = GetAMSShieldVal()
    endif
    return false
endfunction

function InitTrig_Anti_Magic_Shield_Fix takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterVariableEvent(t, "udg_DamageModifierEvent", EQUAL, 4.00)
    call TriggerAddCondition(t, Condition(function Trig_Anti_Magic_Shield_Fix_Conditions))
    set t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(t, Filter(function AMS_Refresh_Conditions))
endfunction

Anyway, I have a similar spell in my custom race and would like to you the other Anti-Magic Shield with the shield hitpoints rather than spell immunity. How do I implement it?

From my understanding, simply, replace the "Bams" buff and "A002" ability. Am I correct? or lacking in anyway?

EDIT: there is also a separate AMS trigger which was not activated for some reason. I dont really know what its for, but I'll just let you know I guess?

  • Anti Magic Shiled Var
    • Events
    • Conditions
    • Actions
      • Set AMSAmount[0] = 0.00
 
Status
Not open for further replies.
Top