[GUI] AlternativeStunSystem v1.1

Here is my first system done for the public. You're free to use it to do your own spells and to modify it, but don't forget to give credits (+rep would also be apprecied).

System Description :

A simple system using Pause/Unpause to stun units.
No need to use dummies and such, all the job is done by triggers here.

You can choice the stun's target, the stun duration and also if you want to the stun special effect and it's attachment point.
The basic special effect is the warcraft's stun special effect, but if you want to change it you need to change what's value it is set to in the initialization trigger and at the end of the StunStart trigger.
Same for it's attachment point (actual default : overhead).

Note that after every stun, the two special effects variables (the special effect and it's attachment) are reset to the default ones.

To use it, you just need to copy the actions from the StunRun trigger. Note that the two actions for the special effects should be used only if you don't want the default special effects for this stun.
Change the No unit for TempUnit to the unit that should be stunned and the 0.00 for TempReal to the stun duration.

Just some clarifications about the Pause/Unpause :
Pause don't do exactly the same effects than the normal warcraft's stun.
It has some differences, for example, you can pre-click active skills while being stunned but with pause, the active spells are hidden.

It gives you another way of stunning, different than the normal wc3's stun.

The Triggers :


  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Add this in your actual initialization trigger. --------
      • Hashtable - Create a hashtable
      • Set ASS_Hash = (Last created hashtable)
      • Set ASS_Eff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Set ASS_EffAtt = overhead
  • RunStun
    • Events
    • Conditions
    • Actions
      • -------- Set those 2variables with wanted values (stun duration and stunned unit). --------
      • Set TempReal = 0.00
      • Set TempUnit = No unit
      • -------- Set this one to the desired special stun effect (if you want the normal stun effect, don't add it in your trigger) + its attachement point. --------
      • Set ASS_Eff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Set ASS_EffAtt = overhead
      • -------- You can change this action for the checking/ignoring conditions if you want. --------
      • Trigger - Run StunStart <gen> (checking conditions)
  • StunStart
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_TempInt = GetHandleId(udg_TempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit is in ASS_Group) Equal to False
        • Then - Actions
          • Unit - Pause TempUnit
          • Unit Group - Add TempUnit to ASS_Group
          • Hashtable - Save TempReal as 0 of TempInt in ASS_Hash
          • Special Effect - Create a special effect attached to the ASS_EffAtt of TempUnit using ASS_Eff
          • Hashtable - Save Handle Of(Last created special effect) as 1 of TempInt in ASS_Hash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (StunEnd <gen> is on) Equal to False
            • Then - Actions
              • Trigger - Turn on StunEnd <gen>
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempReal Greater than (Load 0 of TempInt from ASS_Hash)
            • Then - Actions
              • Hashtable - Save TempReal as 0 of TempInt in ASS_Hash
              • Special Effect - Destroy (Load 1 of TempInt in ASS_Hash)
              • Special Effect - Create a special effect attached to the ASS_EffAtt of TempUnit using ASS_Eff
              • Hashtable - Save Handle Of(Last created special effect) as 1 of TempInt in ASS_Hash
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ASS_Eff Not equal to Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
        • Then - Actions
          • Set ASS_Eff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ASS_EffAtt Not equal to overhead
        • Then - Actions
          • Set ASS_EffAtt = overhead
        • Else - Actions
  • StunEnd
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ASS_Group and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Custom script: set udg_TempInt = GetHandleId(udg_TempUnit)
          • Hashtable - Save ((Load 0 of TempInt from ASS_Hash) - 0.05) as 0 of TempInt in ASS_Hash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Load 0 of TempInt from ASS_Hash) Less than or equal to 0.00
                  • (TempUnit is dead) Equal to True
            • Then - Actions
              • Unit - Unpause TempUnit
              • Special Effect - Destroy (Load 1 of TempInt in ASS_Hash)
              • Unit Group - Remove TempUnit from ASS_Group
              • Hashtable - Clear all child hashtables of child TempInt in ASS_Hash
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (ASS_Group is empyy) Equal to True
                • Then - Actions
                  • Trigger - Turn off StunEnd <gen>
                • Else - Actions
            • Else - Actions

Changelog :

1.00 (04/07/12) : Official Release
1.01 (14/08/12) : Name change. Sry for the new short name. Also, some variables name changes, etc...

Credits :

Thanks to F1ashB0nd for giving the english triggers.

Keywords:
Vladadamm, Stun, Pause, System, Gui, Alternative.
Contents

StunSystem v1.0 (Map)

Reviews
14:15, 16th Jul 2012 Magtheridon96: Bah, okay. Pausing units really sucks, but since you acknowledge that and are calling this an "Alternative" stun system, I'll approve it hoping that random users acknowledge that as well.

Moderator

M

Moderator

14:15, 16th Jul 2012
Magtheridon96: Bah, okay.
Pausing units really sucks, but since you acknowledge that and are calling this an "Alternative" stun system, I'll approve it hoping that random users acknowledge that as well.
 
Level 5
Joined
Sep 28, 2010
Messages
75
English:
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Add this in your actual initialization trigger. --------
      • Hashtable - Create a hashtable
      • Set StunHash = (Last created hashtable)
      • Set StunEff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Set StunEffAtt = overhead
  • RunStun
    • Events
    • Conditions
    • Actions
      • -------- Set those 2variables with wanted values (stun duration and stunned unit). --------
      • Set TempReal = 0.00
      • Set TempUnit = No unit
      • -------- Set this one to the desired special stun effect (if you want the normal stun effect, don't add it in your trigger) + its attachement point. --------
      • Set StunEff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Set StunEffAtt = overhead
      • -------- You can change this action for the checking/ignoring conditions if you want. --------
      • Trigger - Run StunStart <gen> (checking conditions)
  • StunStart
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_TempInt = GetHandleId(udg_TempUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit is in StunGroup) Equal to False
        • Then - Actions
          • Unit - Pause TempUnit
          • Unit Group - Add TempUnit to StunGroup
          • Hashtable - Save TempReal as 0 of TempInt in StunHash
          • Special Effect - Create a special effect attached to the StunEffAtt of TempUnit using StunEff
          • Hashtable - Save Handle Of(Last created special effect) as 1 of TempInt in StunHash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (StunEnd <gen> is on) Equal to False
            • Then - Actions
              • Trigger - Turn on StunEnd <gen>
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • TempReal Greater than (Load 0 of TempInt from StunHash)
            • Then - Actions
              • Hashtable - Save TempReal as 0 of TempInt in StunHash
              • Special Effect - Destroy (Load 1 of TempInt in StunHash)
              • Special Effect - Create a special effect attached to the StunEffAtt of TempUnit using StunEff
              • Hashtable - Save Handle Of(Last created special effect) as 1 of TempInt in StunHash
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StunEff Not equal to Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
        • Then - Actions
          • Set StunEff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • StunEffAtt Not equal to overhead
        • Then - Actions
          • Set StunEffAtt = overhead
        • Else - Actions
  • StunEnd
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in StunGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Custom script: set udg_TempInt = GetHandleId(udg_TempUnit)
          • Hashtable - Save ((Load 0 of TempInt from StunHash) - 0.05) as 0 of TempInt in StunHash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Load 0 of TempInt from StunHash) Less than or equal to 0.00
                  • (TempUnit is dead) Equal to True
            • Then - Actions
              • Unit - Unpause TempUnit
              • Special Effect - Destroy (Load 1 of TempInt in StunHash)
              • Unit Group - Remove TempUnit from StunGroup
              • Hashtable - Clear all child hashtables of child TempInt in StunHash
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (StunGroup is empty) Equal to True
                • Then - Actions
                  • Trigger - Turn off StunEnd <gen>
                • Else - Actions
            • Else - Actions
 
Okay, I'm going to give you a decent review:

    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • StunEff Not equal to Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Then - Actions
        • Set StunEff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • StunEffAtt Not equal to overhead
      • Then - Actions
        • Set StunEffAtt = overhead
      • Else - Actions
    What's the purpose of this >=o
    It's hardcoded this way and makes no sense D:
  • You should rename the TempVariables to understandable names to make the system more Beginner-friendly. (After all, beginners are often GUIers)
  • You're stunning units incorrectly. You should never pause units like that, it's pretty buggy. You should use a stun ability that lasts forever and remove the stun buff after the duration ends.
  • In StunStart, if a unit is already in the group, you shouldn't destroy the effect, create another effect and save it in the hashtable, just remove all that effect code because if the effect is still there and it's saved in the correct location in the hashtable, then it's redundant to destroy it and recreate it, then save it :p

    • Special Effect - Destroy (Load 1 of TempInt in StunHash)
    • Special Effect - Create a special effect attached to the StunEffAtt of TempUnit using StunEff
    • Hashtable - Save Handle Of(Last created special effect) as 1 of TempInt in StunHash
    That's gotta go my friend ^.^
 
Okay, I'm going to give you a decent review:

    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • StunEff Not equal to Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Then - Actions
        • Set StunEff = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • StunEffAtt Not equal to overhead
      • Then - Actions
        • Set StunEffAtt = overhead
      • Else - Actions
    What's the purpose of this >=o
    It's hardcoded this way and makes no sense D:
  • You should rename the TempVariables to understandable names to make the system more Beginner-friendly. (After all, beginners are often GUIers)
  • You're stunning units incorrectly. You should never pause units like that, it's pretty buggy. You should use a stun ability that lasts forever and remove the stun buff after the duration ends.
  • In StunStart, if a unit is already in the group, you shouldn't destroy the effect, create another effect and save it in the hashtable, just remove all that effect code because if the effect is still there and it's saved in the correct location in the hashtable, then it's redundant to destroy it and recreate it, then save it :p

    • Special Effect - Destroy (Load 1 of TempInt in StunHash)
    • Special Effect - Create a special effect attached to the StunEffAtt of TempUnit using StunEff
    • Hashtable - Save Handle Of(Last created special effect) as 1 of TempInt in StunHash
    That's gotta go my friend ^.^
  • That's to reset the stun special effect to default.
  • I forgot to say it in the description, but those TempVariables are replacable by the user's TempVariables he used in his map. The others variables aren't temp, it's why they're named Stun.
  • It's not really a stun, but a sort of stun recreation. When you need to stun 20 units at same time, creating 1 dummy to stun each unit is not the best. The purpose of this system was to offer something else than dummies to stun units. Aren't some vjass/jass systems using pause too for this ? Only problem, imo, is the lack of buff.
  • In StunStart, i did some rule for the effects. For example, if you stun twice an unit, you won't have 2 special effects. It's why only the special effect of the stun that ends the further in time is shown. So, in the case the new stun will end after the first one, i replace the stun special effect by the new one (destroying the old one and creating the new one)
 
That's to reset the stun special effect to default.

Oh I see, my bad. I was wrong.
In that case, you need to make a constant variable that's configurable called DefaultEffect :p (same for the attachment point)

It's not really a stun, but a sort of stun recreation. When you need to stun 20 units at same time, creating 1 dummy to stun each unit is not the best. The purpose of this system was to offer something else than dummies to stun units. Aren't some vjass/jass systems using pause too for this ? Only problem, imo, is the lack of buff.

Yes, some systems are using PauseUnit(), and that's why they're not approved :p
Pausing a unit creates bugs in all of the currently used UnitIndexers in very rare cases and it can create a lot of anomalies. If a unit is ordered while paused, some unwanted consequences will occur. (But, this needs tests, because I only remember unwanted consequences occuring while I was developing my map back in '10)

In StunStart, i did some rule for the effects. For example, if you stun twice an unit, you won't have 2 special effects. It's why only the special effect of the stun that ends the further in time is shown. So, in the case the new stun will end after the first one, i replace the stun special effect by the new one (destroying the old one and creating the new one)

Forget what I said. I just realized you can change the stun effect :p
 
instead of checking a unit group is empty and (StunEnd <gen> is on) Equal to False, which is slow, you could create an integer indexer to it

  • If index equals 0 then
  • Trigger - Turn on StunEnd <gen>
  • endif
  • set index = index + 1
  • Hashtable - Clear all child hashtables of child TempInt in StunHash
  • set index = index - 1
  • If index equals 0 then
  • Trigger - Turn off StunEnd <gen>
  • endif
 
Ordering a dummy unit to use a stunning ability on a 20+ targets will work, if the ability has a cooldown of 0. I use that method all the time for area of effect stuff. Plus a lot of spells use dummies for the visuals so manuevering dummies isn't really a gigantic problem.

Tbh this resource isn't worthwhile if the stuns aren't stackable. That's perhaps the most important thing a resource like this could do.
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Here is my first system done for the public.

I was refering to this ^^

And other than you using pause which is wrong (mag explained why) and giving the option to attach custom effect i see nothing more, am i missing something?

You should point out the differences in a better way like:
"This system in addition to stunning the unit offers you also to: Attach a desired stun effect"

Making it easier for users to understand why to use this over the other one, else users will likely pass on to the more popular/downloaded version, as always.
Not that i mind reading that huge description, it could just use some better organisation and the blue color doesn't really do justice to letter on that background color.
 
JASS:
function PauseUnitEx takes unit u, boolean b returns nothing
    local integer id = GetUnitUserData(u)
    if (b) then
        set paused[id] = paused[id] + 1
        if paused[id] == 1 then
            call PauseUnit(u, true)
        endif
    else
        set paused[id] = paused[id] - 1
        if paused[id] == 0 then
            call PauseUnit(u, false)
        endif
    endif
endfunction

There we go.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
JASS:
function PauseUnitEx takes unit u, boolean b returns nothing
    local integer id = GetUnitUserData(u)
    if (b) then
        set paused[id] = paused[id] + 1
        if paused[id] == 1 then
            call PauseUnit(u, true)
        endif
    else
        set paused[id] = paused[id] - 1
        if paused[id] == 0 then
            call PauseUnit(u, false)
        endif
    endif
endfunction

There we go.

Now it just looks like some sort of StackUtils that J4L made a long time ago ^^ and then it should have a namechange AFAIK or tell some warnings about this

Because pausing sucks - if you try issuing orders to a paused unit, it doesn't register at all. If you try issuing orders to a stunned unit, it actually changes the order the unit will return to after stun. So if you're playing a game where you have one second delay, and you're running into a battle and get stunned and realise you need to get the hell out, you're screwed if the author was lazy and used Pause.
 
Top