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

[GUI]Simple Stun System v1.1 [Legend is back]

Back from the dead, the legend is back!

As a tribute to an old friend - Paladon - I coded a system in his honor which looks a lot like his old systems.

Sooooooooooooo what we have here? A simple stun system which is STANDALONE OMG - aka doesn't require any other systems for it to work (I'll probably make a UnitIndexer version as well :) )

And I'm sorry, new computer, haven't installed photoshop thus awesome paint picture :D

and I'm sorry, it doesn't use firebolt as dummy ability but stormbolt works just fine when you made it an ultimate ability (with standard game constants ^^)

In-Game Documentation

Simple Stun System v1.1 (Standalone version)
by baassee

Credits
Hanky for imba indexing template which I could copy variables ^^
baassee for being back from the dead
Paladon, nothing less than a shining knight - system is in paladon style to honor him in his absence

DOCUMENTION
So this is a pretty simple system, it stuns units (WOOOOOW) and it's standalone and fully in GUI. No I did not enhance this with a lot of JASS cause I know some people will just screw up and I'm to rusty to code ^^

By all means "Standalone" means that it works properly without any other custom systems, just copy the trigger folder into your map (with creating variables at paste in the preferences checked of course) and you follow the triggers what to fix (I have pointed it out) and you're good to go

includes 4 triggers which only 3 triggers are in actuall use, the "STUN README" is where you copy your actions (more explained in that trigger itself for better understanding) and you're set with a stun!

also uses only one dummy unit - all the time. Creates it at map ini and never removes it omg omg so much performance boost

oh right btw, stun stacks, so if you stun a unit with one spell cast another spell that stuns too - the durations will add up together ^^ (OMG PERMASTUN SO OP)
I also included a stop stun where you can stop a stun at any given time - that's "STUN README2" ^^

HOW TO COPY PASTE
1. Copy paste the ability, buff and dummy unit. Remember to fix buff on the ability when you imported it to the correct buff.
2. Copy StunSystemStandAlone folder into your map
3. Follow all triggers and read where I pointed out where to fix this or that
4. Credit me and be happy to use a fully working stun system.

Changelog.
v1.0 released
v1.1 fixed a boolean option so you can choose if you want stuns to stack or not, also fixed dead check

Good luck! And please credit me - baassee - if you use this system. Thank you!

Any questions just throw me a PM or VM or reply to the resource thread.

Sincerly,
baassee


  • STUNINITIALIZE
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ---------------------------------------------------------------------- --------
      • -------- DOCUMENTATION START --------
      • -------- ---------------------------------------------------------------------- --------
      • -------- I had to do this, people will just struggle with using unitIDs ^^ --------
      • -------- ---------------------------------------------------------------------- --------
      • Set TempLoc = (Center of (Playable map area))
      • -------- ---------------------------------------------------------------------- --------
      • -------- remember to fix the dummy type --------
      • -------- ---------------------------------------------------------------------- --------
      • Unit - Create 1 DUMMY for Neutral Hostile at TempLoc facing Default building facing degrees
      • -------- ---------------------------------------------------------------------- --------
      • Set STUN_DUMMY = (Last created unit)
      • -------- ---------------------------------------------------------------------- --------
      • -------- Adds our stun ability to our unit --------
      • -------- remember to fix this --------
      • -------- ---------------------------------------------------------------------- --------
      • Unit - Add SIMPLESTUNDUMMY to STUN_DUMMY
      • -------- ---------------------------------------------------------------------- --------
      • -------- some cleaning --------
      • -------- ---------------------------------------------------------------------- --------
      • Custom script: call RemoveLocation(udg_TempLoc)
      • -------- ---------------------------------------------------------------------- --------
      • -------- is this safe for initialize? ^^ --------
      • -------- ---------------------------------------------------------------------- --------
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
      • -------- ---------------------------------------------------------------------- --------
      • -------- MOVE ON TO STUNREADME TRIGGER --------
      • -------- ---------------------------------------------------------------------- --------


  • STUN README
    • Events
    • Conditions
    • Actions
      • -------- ---------------------------------------------------------------------- --------
      • -------- THIS IS WHAT YOU WILL COPY INTO YOUR TRIGGER --------
      • -------- ---------------------------------------------------------------------- --------
      • -------- ---------------------------------------------------------------------- --------
      • -------- The unit that is getting stunned, can be picked unit, triggering unit etc etc. --------
      • -------- ---------------------------------------------------------------------- --------
      • Set StunUnit = (Triggering unit)
      • -------- ---------------------------------------------------------------------- --------
      • -------- The duration the unit is being stunned. --------
      • -------- ---------------------------------------------------------------------- --------
      • Set StunDur = (Random real number between 0.01 and 1.00)
      • -------- ---------------------------------------------------------------------- --------
      • -------- THE GFX that will be above the stunned unit --------
      • -------- ---------------------------------------------------------------------- --------
      • Set StunGFX = Abilities\Spells\Human\Thunderclap\ThunderclapTarget.mdl
      • -------- ---------------------------------------------------------------------- --------
      • -------- and this boolean - if true - makes the stun stack with any previous stuns --------
      • -------- if false it will just be the duration of the last stun applied (this one) --------
      • -------- ---------------------------------------------------------------------- --------
      • Set StunStack = True
      • -------- ---------------------------------------------------------------------- --------
      • -------- and you're done! Can you believe it, how simple it can be? ^^ --------
      • -------- ---------------------------------------------------------------------- --------
      • -------- runs the indexing trigger --------
      • -------- check it out if you wanna learn something about triggering ^^ --------
      • -------- ---------------------------------------------------------------------- --------
      • Trigger - Run STUNRUN <gen> (checking conditions)
      • -------- ---------------------------------------------------------------------- --------


  • STUN README2
    • Events
    • Conditions
    • Actions
      • -------- ---------------------------------------------------------------------- --------
      • -------- alright this is used if you wanna cancel a stun on a unit at any given time --------
      • -------- I guess it can get handy --------
      • -------- ---------------------------------------------------------------------- --------
      • -------- the unit that you want to remove the stun from --------
      • -------- ---------------------------------------------------------------------- --------
      • Set StunUnit = (Triggering unit)
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (StunUnit is in STUNGROUP) Equal to True
        • Then - Actions
          • -------- ---------------------------------------------------------------------- --------
          • -------- loop around to find our unit --------
          • -------- ---------------------------------------------------------------------- --------
          • For each (Integer STUN_LOOP) from 1 to STUN_Index_Size, do (Actions)
            • Loop - Actions
              • Set TempInt = STUN_Index[STUN_LOOP]
              • -------- ---------------------------------------------------------------------- --------
              • -------- so if we find our unit that's in the system --------
              • -------- ---------------------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • StunUnit Equal to STUN_UNIT[TempInt]
                • Then - Actions
                  • -------- ---------------------------------------------------------------------- --------
                  • -------- we add the new duration as said --------
                  • -------- ---------------------------------------------------------------------- --------
                  • Set STUN_DUR[TempInt] = -1.00
                  • -------- ---------------------------------------------------------------------- --------
                  • -------- and cancels further actions --------
                  • -------- ---------------------------------------------------------------------- --------
                  • Skip remaining actions
                • Else - Actions
        • Else - Actions
          • -------- ---------------------------------------------------------------------- --------
          • -------- if it's not in the system, we do some debug --------
          • -------- ---------------------------------------------------------------------- --------
          • Game - Display to (All players) the text: Simple Stun System ...
          • -------- ---------------------------------------------------------------------- --------


  • STUNRUN
    • Events
    • Conditions
    • Actions
      • -------- ---------------------------------------------------------------------- --------
      • -------- the indexing part --------
      • -------- ---------------------------------------------------------------------- --------
      • -------- just some fail-safe proof to keep ya noobs out of my system ^^ --------
      • -------- whole if can be removed if you know what you are doing :) --------
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (StunDur Less than or equal to 0.00) or (((StunUnit is dead) Equal to True) or ((StunUnit is A structure) Equal to True))
        • Then - Actions
          • -------- ---------------------------------------------------------------------- --------
          • -------- warns ya in-game if you have failed --------
          • -------- ---------------------------------------------------------------------- --------
          • Game - Display to (All players) the text: Simple Stun System ...
          • -------- ---------------------------------------------------------------------- --------
          • -------- cancels all further actions --------
          • -------- ---------------------------------------------------------------------- --------
          • Skip remaining actions
          • -------- ---------------------------------------------------------------------- --------
        • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • -------- because it's a standalone version, I have to have some sort of stack possibility --------
      • -------- which is fixed by a simple unit group --------
      • -------- ---------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (StunUnit is in STUNGROUP) Equal to True
        • Then - Actions
          • -------- ---------------------------------------------------------------------- --------
          • -------- if the unit is in the group which means it's already in the system --------
          • -------- then we have to reloop to find our unit and thus add up our new duration with the old duration --------
          • -------- or give it a new duration --------
          • -------- ---------------------------------------------------------------------- --------
          • For each (Integer STUN_LOOP) from 1 to STUN_Index_Size, do (Actions)
            • Loop - Actions
              • -------- ---------------------------------------------------------------------- --------
              • -------- indexing thingie, read hanky indexing system and you will get it --------
              • -------- ---------------------------------------------------------------------- --------
              • Set TempInt = STUN_Index[STUN_LOOP]
              • -------- ---------------------------------------------------------------------- --------
              • -------- so if we find our unit that's in the system --------
              • -------- ---------------------------------------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • StunUnit Equal to STUN_UNIT[TempInt]
                • Then - Actions
                  • -------- ---------------------------------------------------------------------- --------
                  • -------- we add the new duration as said --------
                  • -------- or we set the duration to the last one if you dont want stacking stuns --------
                  • -------- ---------------------------------------------------------------------- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • StunStack Equal to True
                    • Then - Actions
                      • -------- ---------------------------------------------------------------------- --------
                      • -------- so what if we want our stuns to stack, then we add them up --------
                      • -------- ---------------------------------------------------------------------- --------
                      • Set STUN_DUR[TempInt] = (STUN_DUR[TempInt] + StunDur)
                      • -------- ---------------------------------------------------------------------- --------
                    • Else - Actions
                      • -------- ---------------------------------------------------------------------- --------
                      • -------- else we just set the current duration to our new duration --------
                      • -------- which can be both lower or higher ^^ --------
                      • -------- ---------------------------------------------------------------------- --------
                      • Set STUN_DUR[TempInt] = StunDur
                      • -------- ---------------------------------------------------------------------- --------
                  • -------- ---------------------------------------------------------------------- --------
                  • -------- and cancels further actions --------
                  • -------- ---------------------------------------------------------------------- --------
                  • Skip remaining actions
                • Else - Actions
        • Else - Actions
          • -------- ---------------------------------------------------------------------- --------
          • -------- else we index our unit into the system --------
          • -------- ---------------------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • STUN_Index_Size Equal to 0
            • Then - Actions
              • -------- ---------------------------------------------------------------------- --------
              • -------- REMEMBER TO TURN THIS ON --------
              • -------- ---------------------------------------------------------------------- --------
              • Trigger - Turn on STUNLOOP <gen>
              • -------- ---------------------------------------------------------------------- --------
            • Else - Actions
          • Set STUN_Index_Size = (STUN_Index_Size + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • STUN_Index_Size Greater than STUN_Index_maxSize
            • Then - Actions
              • Set STUN_Index[STUN_Index_Size] = STUN_Index_Size
              • Set STUN_Index_maxSize = STUN_Index_Size
            • Else - Actions
          • Set TempInt = STUN_Index[STUN_Index_Size]
          • -------- ---------------------------------------------------------------------- --------
          • -------- all the part above can be read at hanky's indexing system --------
          • -------- ---------------------------------------------------------------------- --------
          • -------- now we add our variables into arrayed variables - the system --------
          • -------- ---------------------------------------------------------------------- --------
          • -------- the unit stunned --------
          • -------- ---------------------------------------------------------------------- --------
          • Set STUN_UNIT[TempInt] = StunUnit
          • -------- ---------------------------------------------------------------------- --------
          • -------- add the duration --------
          • -------- ---------------------------------------------------------------------- --------
          • Set STUN_DUR[TempInt] = StunDur
          • -------- ---------------------------------------------------------------------- --------
          • -------- some custom script because I'm lazy ^^ and saves you a BJ omg --------
          • -------- so much performance boost --------
          • -------- ---------------------------------------------------------------------- --------
          • -------- also we move the dummy to the "target" --------
          • -------- to enhance our stun experience --------
          • -------- ---------------------------------------------------------------------- --------
          • Custom script: call SetUnitX(udg_STUN_DUMMY, GetUnitX(udg_StunUnit))
          • Custom script: call SetUnitY(udg_STUN_DUMMY, GetUnitY(udg_StunUnit))
          • Custom script: set udg_STUN_GFX[udg_TempInt] = AddSpecialEffectTarget(udg_StunGFX, udg_StunUnit, "overhead")
          • -------- ---------------------------------------------------------------------- --------
          • -------- stun the unit with our dummy ^^ --------
          • -------- ---------------------------------------------------------------------- --------
          • Unit - Order STUN_DUMMY to Human Mountain King - Storm Bolt StunUnit
          • -------- ---------------------------------------------------------------------- --------
          • -------- and at last we add our new unit into our fail-safe group --------
          • -------- ---------------------------------------------------------------------- --------
          • Unit Group - Add StunUnit to STUNGROUP
          • -------- ---------------------------------------------------------------------- --------
          • -------- go to the loop trigger if you wanna learn more ^^ --------
          • -------- ---------------------------------------------------------------------- --------


  • STUNLOOP
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- ---------------------------------------------------------------------- --------
      • -------- the loop trigger, yes you can change the event timer to whatever you want --------
      • -------- less number = more accurate although more fires/second thus more performance needed --------
      • -------- all about to you, I think 33 times a second is accurate enough --------
      • -------- ---------------------------------------------------------------------- --------
      • For each (Integer STUN_LOOP) from 1 to STUN_Index_Size, do (Actions)
        • Loop - Actions
          • -------- This let look everything cleaner. --------
          • Set TempInt = STUN_Index[STUN_LOOP]
          • -------- ---------------------------------------------------------------------- --------
          • -------- more indexing stuff above which you should read in hanky tutorial --------
          • -------- ---------------------------------------------------------------------- --------
          • -------- here we check if our duration is greater than 0 thus if it has ended or not --------
          • -------- also checks if the target is dead or not --------
          • -------- ---------------------------------------------------------------------- --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (STUN_DUR[TempInt] Greater than 0.00) and ((STUN_UNIT[TempInt] is dead) Equal to False)
            • Then - Actions
              • -------- ---------------------------------------------------------------------- --------
              • -------- if it hasnt ended, then we reduce our "variable" --------
              • -------- ---------------------------------------------------------------------- --------
              • Set STUN_DUR[TempInt] = (STUN_DUR[TempInt] - 0.03)
              • -------- ---------------------------------------------------------------------- --------
            • Else - Actions
              • -------- ---------------------------------------------------------------------- --------
              • -------- and if the duration is gone omg --------
              • -------- then we remove the debuff which will make the unit out of stun --------
              • -------- ---------------------------------------------------------------------- --------
              • Unit - Remove Stunned SIMPLE STUN SYSTEM buff from STUN_UNIT[TempInt]
              • -------- ---------------------------------------------------------------------- --------
              • -------- more custom script because im lazy --------
              • -------- basic destroying the effect --------
              • -------- ---------------------------------------------------------------------- --------
              • Custom script: call DestroyEffect(udg_STUN_GFX[udg_TempInt])
              • -------- ---------------------------------------------------------------------- --------
              • -------- remove the unit from our group --------
              • -------- ---------------------------------------------------------------------- --------
              • Unit Group - Remove STUN_UNIT[TempInt] from STUNGROUP
              • -------- ---------------------------------------------------------------------- --------
              • -------- down here are more hanky indexing stuff --------
              • -------- ---------------------------------------------------------------------- --------
              • -------- RecycleIndex --------
              • Set STUN_Index[STUN_LOOP] = STUN_Index[STUN_Index_Size]
              • Set STUN_Index[STUN_Index_Size] = TempInt
              • Set STUN_Index_Size = (STUN_Index_Size - 1)
              • Set STUN_LOOP = (STUN_LOOP - 1)
              • -------- Turn the trigger again off if the index_size is below 0... --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • STUN_Index_Size Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                  • Skip remaining actions
                • Else - Actions
      • -------- ---------------------------------------------------------------------- --------
      • -------- thats it ^^ so simple system right --------
      • -------- ---------------------------------------------------------------------- --------



So time for some pros vs. cons.
Pros
  • Can stun any given unit at any given time.
  • Can cancel stun at any given time.
  • Can stun magic immune units (If constants are not touched ^^)
  • Any duration.
  • Stun stacks with other stuns from the system (rarely a pro, can also be a con but as said, implemented a cancel feature as well). - NOW YOU CAN CHOOSE IF YOU WANT IT TO STACK WITH THE PREVIOUS STUN OR JUST CHOOSE THE LAST ONE.
  • Only uses one dummy unit.
Cons
  • A unit can basicly be perma-stunned as the stuns stack with each others. - This can only happen if the user now only uses stack with the boolean added ^^
  • If you checked the constant "ultimate goes through magic immune" or whatever the name is, it will not work on magic immune units (false by default which makes it workable).
  • Well I included a GFX string variable BUT I recommend to use the standard version. Cause if different abilities got different stun GFX and a unit gets stunned, the GFX will not stack but the stun will (no it doesn't leak).
  • GFX will be overhead - I will not change this.
  • Shouldn't be used it any other stun systems nor even stun abilities. But it should work with other stun abilities due to the fact of custom buff yet I have not tested it so I cannot recommend this.
  • Structures cannot be target.
  • Mag96 sux :)

Have fun with the system. Give credit if used please.

Sincerly,
~baassee

Keywords:
simple, stun, system, baassee, legend, is, back, standalone, mag96, sux,
Contents

[GUI]Simple Stun System v1.1 (Map)

Reviews
06:46, 16th Aug 2012 Magtheridon96: Okay, cool. This is pretty useful. Of course, you would greatly benefit if you used a hashtable or even better, a unit indexer, because that way, you wouldn't have to do a heavy iteration over every single...

Moderator

M

Moderator

06:46, 16th Aug 2012
Magtheridon96:

Okay, cool. This is pretty useful.

Of course, you would greatly benefit if you used a hashtable or even better, a unit indexer, because that way, you wouldn't have to do a heavy iteration over every single instance of the spell to see if you should create a new instance or manipulate an existing one.
 
Top