• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Spell] 2 active abilities on an item

Level 15
Joined
Sep 11, 2013
Messages
557
Greetings!

I wish to create an item that has 2 active abilities and I don't know how can I do that..

Both abilities must have instant cast when I press the item.
First ability is Berserk and second ability is Invulnerability.
Duration for both must be 5.75 seconds.

Second problem..
It is possible for Berserk and Invulnerability to have different durations?
The help will be appreciated! :peasant-bowing:
 
You can't have two actives unfortunately so you'll have to trigger the second effect when the unit uses the item, that'll also allow you to have a different duration for both effects

If it's just an attack speed bonus, berserk is probably easier to recreate than divine shield, unless you make the unit invulnerable/vulnerable via trigger directly
 
  • Events
    • Unit - A Unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Berserk (Item)
  • Actions
    • Unit - Add Invulnerable (Item) to (Triggering unit)
    • Wait 3.00 game-time seconds
    • Unit - Remove Invulnerable (Item) from (Triggering unit)
Note that this breaks if you can activate the Item again while the unit already has the Invulnerable (Item) ability. To fix that, use Unit Indexing and track the activation count. +1 on use, -1 on end, only Remove ability if this counter is equal to 0.
 
  • Events
    • Unit - A Unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Berserk (Item)
  • Actions
    • Unit - Add Invulnerable (Item) to (Triggering unit)
    • Wait 3.00 game-time seconds
    • Unit - Remove Invulnerable (Item) from (Triggering unit)
Note that this breaks if you can activate the Item again while the unit already has the Invulnerable (Item) ability. To fix that, use Unit Indexing and track the activation count. +1 on use, -1 on end, only Remove ability if this counter is equal to 0.
I don't know how to use that unit indexing without help, but I think the first solution is good. :peasant-smile:
 
You copy and paste the "Unit Indexer" folder from this map into your own map. Assuming you haven't already:

Then you can modify the trigger to work like so:
  • Events
    • Unit - A Unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Berserk (Item)
  • Actions
    • Unit - Add Invulnerable (Item) to (Triggering unit)
    • Set Variable CV = (Custom value of (Triggering unit))
    • Set Variable Counter[CV] = (Counter[CV] + 1)
    • Wait 3.00 game-time seconds
    • Set Variable CV = (Custom value of (Triggering unit))
    • Set Variable Counter[CV] = (Counter[CV] - 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Counter[CV] Equal to 0
      • Then - Actions
        • Unit - Remove Invulnerable (Item) from (Triggering unit)
      • Else - Actions
It's almost the same trigger, but now you're keeping track of the number of times your unit has used the Item recently with the Counter Integer variable.
CV is another Integer variable, but it's optional and only exists to make the trigger easier to work with.

Here's a breakdown of how it works...

Let's pretend that the Item has a 0 second cooldown and the caster uses the Item three times in a row:

1st: The Counter variable increases from 0 to 1. The caster is given the Invulnerable ability. A 3.00 second Wait begins.
2nd: Counter increases from 1 to 2. The caster is given the Invulnerable ability but it fails since it already has it. Another 3.00 second Wait begins.
3rd: Counter increases from 2 to 3. The caster is given the Invulnerable ability but it fails since it already has it. Another 3.00 second Wait begins.

Now let's pretend that 3.00 seconds of time has passed and all of those Waits have finished. This leads us to the bottom part of our trigger:
  • Set Variable Counter[CV] = (Counter[CV] - 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Counter[CV] Equal to 0
    • Then - Actions
      • Unit - Remove Invulnerable (Item) from (Triggering unit)
    • Else - Actions
1st: The first Wait finishes and the Counter variable is reduced from 3 to 2. The If Then Else checks to see if it's equal to 0, it's not.
2nd: Counter reduces from 2 to 1. The If Then Else checks to see if it's equal to 0, it's not.
3rd: Counter reduces from 1 to 0. The If Then Else checks to see if it's equal to 0, and it is zero! That means the (Then - Actions) can finally run, Removing the Invulnerable ability.


Hopefully this clears up why we need the Counter variable and the issues that we're trying to avoid here. It'd be more clear if you were to use the Item three times spaced out over a short period of time rather than immediately. For example, you use the item, wait 0.50 seconds, use the item again, wait 0.50 seconds, and use the item again. In that situation, without Counter, your 1st use of the item would Remove the Invulnerable ability early before your 2nd and 3rd uses even had a chance to finish. In other words, all three triggers would be fighting with one another over what to do next.
 
Last edited:
You copy and paste the "Unit Indexer" folder from this map into your own map. Assuming you haven't already:

Then you can modify the trigger to work like so:
  • Events
    • Unit - A Unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Berserk (Item)
  • Actions
    • Unit - Add Invulnerable (Item) to (Triggering unit)
    • Set Variable CV = (Custom value of (Triggering unit))
    • Set Variable Counter[CV] = (Counter[CV] + 1)
    • Wait 3.00 game-time seconds
    • Set Variable CV = (Custom value of (Triggering unit))
    • Set Variable Counter[CV] = (Counter[CV] - 1)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Counter[CV] Equal to 0
      • Then - Actions
        • Unit - Remove Invulnerable (Item) from (Triggering unit)
      • Else - Actions
It's effectively the same trigger, but now you're keeping track of the number of times your unit has used the Item recently with this new Counter Integer variable. CV is another Integer variable, but it's optional and only exists to make the trigger easier to work with.

Here's a breakdown of how it works...

Let's pretend that the Item has a 0 second cooldown and the caster uses the Item three times in a row:

1st: The Counter variable increased from 0 to 1. The caster is given the Invulnerable ability. A 3.00 second Wait begins.
2nd: Counter increases from 1 to 2. The caster is given the Invulnerable ability but it fails since it already has it. Another 3.00 second Wait begins.
3rd: Counter increases from 2 to 3. The caster is given the Invulnerable ability but it fails since it already has it. Another 3.00 second Wait begins.

Now let's pretend that 3.00 seconds of time has passed and all of those Waits have finished. This leads us to the bottom part of our trigger:
  • Set Variable Counter[CV] = (Counter[CV] - 1)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Counter[CV] Equal to 0
    • Then - Actions
      • Unit - Remove Invulnerable (Item) from (Triggering unit)
    • Else - Actions
1st: The first Wait finishes and the Counter variable is reduced from 3 to 2. The If Then Else checks to see if it's equal to 0, it's not.
2nd: Counter reduces from 2 to 1. The If Then Else checks to see if it's equal to 0, it's not.
3rd: Counter reduces from 1 to 0. The If Then Else checks to see if it's equal to 0, and it is zero! That means the (Then - Actions) can finally run, Removing the Invulnerable ability.


Hopefully this clears up why we need the Counter variable and the issues that we're trying to avoid here. It'd be more clear if you were to use the Item three times spaced out over a short period of time rather than immediately. For example, you use the item, wait 0.50 seconds, use the item again, wait 0.50 seconds, and use the item again. In that situation, without Counter, your 1st use of the item would Remove the Invulnerable ability early before your 2nd and 3rd uses even had a chance to finish. In other words, all three triggers would be fighting with one another over what to do next.
Thanks for the explanations. I understood. Your example is very good! :peasant-ok-hand:
 
Thanks for the explanations. I understood. Your example is very good! :peasant-ok-hand:
Great to hear, and one last clarification because I forgot, Invulnerable (Item) is meant to be a custom ability that you create in the Object Editor. Simply copy and paste the existing Invulnerable (Neutral) ability and rename it to something that makes sense. It's important to do this so that your Item's invulnerability will play nicely with other effects that apply/remove Invulnerable.

Speaking of renaming things, I would rename both the Ability and the Variables to have the same name as the Item, or something similar. This new Ability is NOT meant to be used anywhere else.
 
I believe standard invulnerable removes all buffs, friendly buffs included. So you might not be getting the attack speed and movement speed
bonus from berserk. You can check the invulnerable box for berserk in the object editor and mouse over your unit's attack speed in game to see if it stays green while being invulnerable. IIRC all buffs cannot even be bypassed by the default object editor data for invulnerable units.
 
I believe standard invulnerable removes all buffs, friendly buffs included. So you might not be getting the attack speed and movement speed
bonus from berserk. You can check the invulnerable box for berserk in the object editor and mouse over your unit's attack speed in game to see if it stays green while being invulnerable. IIRC all buffs cannot even be bypassed by the default object editor data for invulnerable units.
Berserk cannot be removed, it's one of them undispellable doohickeys. Similar to a buff supplied by an Aura.
 
I believe standard invulnerable removes all buffs, friendly buffs included. So you might not be getting the attack speed and movement speed
bonus from berserk. You can check the invulnerable box for berserk in the object editor and mouse over your unit's attack speed in game to see if it stays green while being invulnerable. IIRC all buffs cannot even be bypassed by the default object editor data for invulnerable units.
Invulnerability and Berserk work together with both buffs:)
 
Back
Top