• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

How to work with/make stacks via Triggers.

Level 3
Joined
May 7, 2020
Messages
13
Hi! I want to make a spell based on Demon Hunter's 2nd ability (which you can turn on and off whenever). When it is turned on it will work as an aura affecting enemies (they'll have a debuff). So the idea is, when unit has a debuff and gets an instance of damage (ideally either magical or physical) there is a stack being saved and showing as a small number beside the enemy (so that the player could see how many stacks he applied already), when the number of stacks reach certain amount (let's say 5) something happens (he gets stunned or something else - haven't come up with idea yet). Honestly I have no idea how to work with this kind of stuff. And it must not necesserarily be based on DH's spell, I just need the idea of toggling the spell on and off. Is there a way to do so in general and if so, without JASS. If I could please get the explanation on the details like which variables must be created (which type: real, integer etc) that would mean a world to me :)
 
Creating stacks is a pain in the ass usually, but doable since you only want to stack from immolation and run an effect so we don't need timers unless you want a stack of debuff only to last for a certaim time. You will have to use JASS, because GUI is basically jass code. Just made easier for casual mappers to use the JASS code. However the hardest part of this is how to detect the instance of the damage done by immolation. It's hard to do even with damage engine. You will need to have fake immolation and create a dummy unit for the caster which has permanent immolation and check if the damage source is the dummy unit only.

Depending on the structure of the map you might want to link the dummy unit to the caster with a hashtable so that the hero is actually doing the damage instead of the dummy unit. You will definetly need at least an unit indexer which makes things way easier for you. Because if we only use the Demon Hunter as the damage source check, it will count all instances of damage inculding autoattacks and other spells and effect from items etc.


The unit indexer automatically assings a custom value to all units so you don't need to run any code or have the knowledge of how to create jass codes. If you are on the latest patch you don't need damage engine since they added the native functions to the game itself. In my simple version I also just used the Demon Hunter as the damage source instead of linking it to a dummy unit.

Here is a simplified version where you only need 2 variables

Immolation_CV = Integer Variable
Immolation_Stacks = Integer Variable with the ARRAY enabled.


  • Immolation Stacks
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Demon Hunter
    • Actions
      • -------- Immolation CV is an Integer Variable --------
      • Set VariableSet Immolation_CV = (Custom value of (Damage Target))
      • -------- Immolation_Stacks is an integer variable with array enabled --------
      • Set VariableSet Immolation_Stacks[Immolation_CV] = (Immolation_Stacks[Immolation_CV] + 1)
      • -------- Floating text is just to show the stacks --------
      • Floating Text - Create floating text that reads ((String(Immolation_Stacks[Immolation_CV])) + ) above (Damage Target) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change the fading age of (Last created floating text) to 0.85 seconds
      • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
      • -------- Here we check the stacks --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Immolation_Stacks[Immolation_CV] Equal to 5
        • Then - Actions
          • Set VariableSet Immolation_Stacks[Immolation_CV] = 0
          • -------- Floating text is just to show the reset of stacks --------
          • Floating Text - Create floating text that reads ((String(Immolation_Stacks[Immolation_CV])) + ) above (Damage Target) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 30.00 degrees
          • Floating Text - Change the fading age of (Last created floating text) to 0.85 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 1.25 seconds
          • -------- In my test I just killed the unit --------
          • Unit - Kill (Damage Target)
        • Else - Actions

I added the test map with the simple version on how to do it. Again it all depends on how accurate you want to make the spell. The more accurate you want it to be the more complex it will also become. With the dummy unit you would need to constantly move it to the casters positions so you don't lose the immolation aura from your hero. My testmap has the unit indexer in it so you can copy it from there.
 

Attachments

Reforged functions allowed? What should happen if a unit has a certain amount of stacks but leaves the aura? Instantly lose all stacks?

This is not an easy task, ideally it requires working with timers and a hashtable.
If you are using only GUI and only Reforged Editor, I can't help, of course I have heard about all sorts of "Unit Indexer" but I prefer to do everything correctly.
I can only show this in Jass or GUI from YDWE PK.
Without the right tools, it's a big waste of time and nerves for a mediocre result. In addition, a large number of crutches make the process difficult to understand.
While I was writing this, one person (above) already spent his time creating a crutch method, I will not look at what is there, but I am 100% sure that using it, you will at best get a working skill, without understanding and without the ability to flexibly change it. I value my time and prefer to give people not fish, but the skill of fishing.
I can also simply explain the principle of each step, but you will not understand because most likely you have never used a hashtable and timers, and this will continue endlessly until you start trying the right methods.
 
Back
Top