• 🏆 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!

Help with stacking effect using hashtables trigger

Status
Not open for further replies.
Level 5
Joined
May 20, 2008
Messages
138
This trigger is not finished but this shows the most basic essential mechanics that I'm not getting to work

What the trigger is supposed to do is creating a MUI stacking damage mechanic called Devastate. Each time a unit casts devastate on a target 250+x*40 damage is dealt to it, x being the amount of times Devastate has been cast on the target by the owner of the casting unit before, up to a maximum of 5 times, the current cast being included in "how many times ...", that is to say the Devastate effect is applied each time Devastate is cast on the target, up to a maximum of 5 "stacks" of the effect, using the number of stacks to multiply 40 with as bonus damage dealt to the target.

The idea is that each player can potentially have a hero using this ability, up to a maximum of 10 players, each hero can cast devastate on any enemy target, and if two players cast devastate on the SAME target, the effect stacks separately for each player, ie if player 1 has cast it 3 times on the target he gets 3*40 damage bonus, and if player 2 has cast it 5 times on the same target he gets 5*40 damage bonus.

I figured hashtables were the best way to do this (provided I have even grasped how hashtables really work), but I don't get it to work properly, it seems like only the final "else" is being executed any time the trigger is run, even when casting multiple times on the same target. I use a damage detection system separately, and it displays a weird stack of numbers that doesn't correspond to how it should look according to this trigger either.

  • Warrior Devastate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (Warrior) Devastate
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Load (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) from HWARRIOR_devastatestacks_table) Greater than 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) from HWARRIOR_devastatestacks_table) Less than 5
            • Then - Actions
              • Set GEN_INTEGER = (Load (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) from HWARRIOR_devastatestacks_table)
              • Set GEN_INTEGER = (GEN_INTEGER + 1)
              • Game - Display to (All players) the text: (String(GEN_INTEGER))
              • Hashtable - Save GEN_INTEGER as (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) in HWARRIOR_devastatestacks_table
              • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (250.00 + ((Real(GEN_INTEGER)) x 40.00)) damage of attack type Spells and damage type Unknown
              • Game - Display to (All players) the text: increase
            • Else - Actions
              • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (250.00 + (5.00 x 40.00)) damage of attack type Spells and damage type Unknown
              • Game - Display to (All players) the text: else maxstacks
        • Else - Actions
          • Hashtable - Save 1 as (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) in HWARRIOR_devastatestacks_table
          • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (250.00 + (1.00 x 40.00)) damage of attack type Spells and damage type Unknown
          • Game - Display to (All players) the text: else
 
Level 5
Joined
May 20, 2008
Messages
138
did you create the hashtable?

/facepalm I did forget to do that! thanks!

However the problem with the stack of numbers displayed by my damage detection system (it creates floating combat text each time a player unit damages an enemy) still persist. I've isolated it to the fact that it seems like the "channel" ability that my Devastate spell is based on (Base order ID - acolyteharvest, Disable other abilities - false, follow through time -0.00, options - Visible & physical spell, Target type - unit target) seems to be registered by the damage detection as dealing 0 damage to the target. How do I prevent this? Is the channel spell always detected as dealing 0 damage when targetting a specific unit target?
 
Status
Not open for further replies.
Top