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

Decreasing and increasing ability level

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
192
I have trouble making an ability work. The ability is in two parts, an active and a passive.
The passive is called Bloodhaze, and basically you just get 10% attack speed for 7 seconds, stacking up to 5 times. (It levels a passive attack speed ability)

The stacks are supposed to decay like this: You attack, then starts a 7 second timer, when it expires, you lose a stack of the attack speed. And if you do not attack again within these 7 seconds, a trigger will start, which will remove an additional stack every 7 seconds.

The active simply sets the stack level to 5, and turns on the timer.

Problem is, the stacks are never removed. The stacking up works just fine. The trigger is in four parts:
  • Bloodhaze Active
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Bloodhaze
    • Actions
      • Unit - Set level of Bloodhaze Passive for (Triggering unit) to 6
      • Countdown Timer - Start Bloodhaze_Timer as a One-shot timer that will expire in 7.00 seconds
  • Bloodhaze Passive
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Coldfiend (Stalker)
    • Actions
      • Trigger - Turn off Bloodhaze Tick Down <gen>
      • Unit - Increase level of Bloodhaze Passive for (Attacking unit)
      • Countdown Timer - Start Bloodhaze_Timer as a One-shot timer that will expire in 7.00 seconds
  • Bloodhaze Tick Start
    • Events
      • Time - Bloodhaze_Timer expires
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Debug
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Picked unit)) Equal to Coldfiend (Stalker))) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Bloodhaze Passive for (Picked unit) to ((Level of Bloodhaze Passive for (Picked unit)) - 1)
      • Trigger - Turn on Bloodhaze Tick Down <gen>
  • Bloodhaze Tick Down
    • Events
      • Time - Every 7.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Picked unit)) Equal to Coldfiend (Stalker))) and do (Actions)
        • Loop - Actions
          • Unit - Set level of Bloodhaze Passive for (Picked unit) to ((Level of Bloodhaze Passive for (Picked unit)) - 1)
          • Game - Display to (All players) the text: Debug Tick
The last trigger is initially off.

Help much appreciated.
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,993
  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Picked unit)) Equal to Coldfiend (Stalker))) and do (Actions)
This is be the problem, when matching something, use Matching unit and not Picked unit, like the GUI action says: Unit Group - Pick every unit in (Units in (Playable map area) matching ...
So what you have to do is change: ((Unit-type of (Picked unit)) to ((Unit-type of (Matching unit))
 
Level 7
Joined
May 15, 2009
Messages
192
You're leaking a unit group at the "Bloodhaze Tick Down" trigger.

I know about that one, I actually had it covered with a "set bj_wantDestroyGroup = true" but I removed that, just to make sure that wasn't the problem.
I will be adding it back now.

  • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Picked unit)) Equal to Coldfiend (Stalker))) and do (Actions)
This is be the problem, when matching something, use Matching unit and not Picked unit, like the GUI action says: Unit Group - Pick every unit in (Units in (Playable map area) matching ...
So what you have to do is change: ((Unit-type of (Picked unit)) to ((Unit-type of (Matching unit))

I feel rather dump now, thx for pointing it out for me guys.
+rep as always.
 
bj_wantDestroyGroup are set to false after using the ForGroupBj.
JASS:
function ForGroupBJ takes group whichGroup, code callback returns nothing

    // If the user wants the group destroyed, remember that fact and clear

    // the flag, in case it is used again in the callback.

    local boolean wantDestroy = bj_wantDestroyGroup

    set bj_wantDestroyGroup = false



    call ForGroup(whichGroup, callback)



    // If the user wants the group destroyed, do so now.

    if (wantDestroy) then

        call DestroyGroup(whichGroup)

    endif

endfunction

In short,you are leaking unit group every 7 seconds
 
Status
Not open for further replies.
Top