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

Barry Dance v1.1

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
The screenshot above shows they are doing BLOODY DANCE! xD
  • Description
    Barry starts dancing. Nearby enemy units in 600 AoE will be hypnotized by his dance, making that units unable to move while copying Barry's style.
    Level 1 - Lasts 8 seconds.
    Level 2 - Lasts 9 seconds.
    Level 3 - Lasts 10 seconds.
  • Code
    • Barry Dance Init
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Set Ability = Barry Dance
        • Set Duration[1] = 8.00
        • Set Duration[2] = 9.00
        • Set Duration[3] = 10.00
        • Set DanceAoE[1] = 600.00
        • Set DanceAoE[2] = 600.00
        • Set DanceAoE[3] = 600.00
        • Set DanceAnimation[1] = death
        • Set DanceAnimation[2] = attack
        • Set DanceAnimationNumber = 2
        • Set DanceAnimationInterval = 0.80
        • Set FinishAnimation = stand
        • Set FollowBarryAnimation = True
        • Set DanceComment[1] = Yeah!!
        • Set DanceComment[2] = Wow!!
        • Set DanceComment[3] = It's Barry!!
        • Set DanceComment[4] = Barry's on the road!!
        • Set DanceCommentNumber = 4
        • -------- =========================================================================== --------
        • Set Interval = 0.03
        • Trigger - Add to Barry Dance Loop <gen> the event (Time - Every Interval seconds of game time)
    • Barry Dance Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to B_Ability
      • Actions
        • Set B_Barry[0] = (Triggering unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (B_Barry[0] is in B_DancingBarryGroup) Equal to True
          • Then - Actions
            • Skip remaining actions
          • Else - Actions
        • Set B_NewIndex = B_Recycle[0]
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • B_NewIndex Equal to 0
          • Then - Actions
            • Set B_InstanceCount = (B_InstanceCount + 1)
            • Set B_NewIndex = B_InstanceCount
          • Else - Actions
            • Set B_Recycle[0] = B_Recycle[B_NewIndex]
        • Set B_Next[B_NewIndex] = 0
        • Set B_Prev[B_NewIndex] = B_Prev[0]
        • Set B_Next[B_Prev[0]] = B_NewIndex
        • Set B_Prev[0] = B_NewIndex
        • Set B_Barry[B_NewIndex] = B_Barry[0]
        • Set B_Owner[B_NewIndex] = (Triggering player)
        • Set B_Level[B_NewIndex] = (Level of B_Ability for B_Barry[B_NewIndex])
        • Set B_CurDuration[B_NewIndex] = B_Duration[B_Level[B_NewIndex]]
        • Set B_RealTimer[B_NewIndex] = 0.00
        • Custom script: set udg_B_OriginalLoc[udg_B_NewIndex] = GetUnitLoc(udg_B_Barry[udg_B_NewIndex])
        • Custom script: call GroupAddUnit(udg_B_DancingBarryGroup, udg_B_Barry[udg_B_NewIndex])
        • Sound - Play Credits <gen>
        • Set B_ActiveInstance = (B_ActiveInstance + 1)
        • Trigger - Turn on Barry Dance Loop <gen>
    • Barry Dance Loop
      • Events
      • Conditions
      • Actions
        • Set B_Index = B_Next[0]
        • Custom script: loop
        • Custom script: exitwhen udg_B_Index == 0
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (B_Barry[B_Index] is dead) Equal to False
            • B_CurDuration[B_Index] Greater than 0.00
          • Then - Actions
            • Unit - Order B_Barry[B_Index] to Stop
            • Set B_RealTimer[B_Index] = (B_RealTimer[B_Index] + B_Interval)
            • Set B_RandomInt = (Random integer number between 1 and B_DanceAnimationNumber)
            • Set B_Commented = False
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units within B_DanceAoE[B_Level[B_Index]] of B_OriginalLoc[B_Index]) and do (Actions)
              • Loop - Actions
                • Set B_AnotherDancer = (Picked unit)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (B_AnotherDancer is Mechanical) Equal to False
                    • (B_AnotherDancer is Sleeping) Equal to False
                    • (B_AnotherDancer is A structure) Equal to False
                    • (B_AnotherDancer is dead) Equal to False
                    • (B_AnotherDancer belongs to an ally of B_Owner[B_Index]) Equal to False
                  • Then - Actions
                    • Unit - Order B_AnotherDancer to Stop
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • B_RealTimer[B_Index] Greater than or equal to B_DanceAnimationInterval
                      • Then - Actions
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • B_FollowBarryAnimation Equal to False
                          • Then - Actions
                            • Set B_RandomInt = (Random integer number between 1 and B_DanceAnimationNumber)
                          • Else - Actions
                        • Animation - Play B_AnotherDancer's B_DanceAnimation[B_RandomInt] animation
                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • B_Commented Equal to False
                          • Then - Actions
                            • Custom script: call ArcingTextTag.create(udg_B_DanceComment[GetRandomInt(1, udg_B_DanceCommentNumber)], udg_B_AnotherDancer)
                            • Set B_Commented = True
                          • Else - Actions
                      • Else - Actions
                  • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • B_RealTimer[B_Index] Greater than or equal to B_DanceAnimationInterval
              • Then - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • B_FollowBarryAnimation Equal to False
                  • Then - Actions
                    • Set B_RandomInt = (Random integer number between 1 and B_DanceAnimationNumber)
                  • Else - Actions
                • Animation - Play B_Barry[B_Index]'s B_DanceAnimation[B_RandomInt] animation
                • Set B_RealTimer[B_Index] = 0.00
              • Else - Actions
            • Set B_CurDuration[B_Index] = (B_CurDuration[B_Index] - B_Interval)
          • Else - Actions
            • Custom script: set bj_wantDestroyGroup = true
            • Unit Group - Pick every unit in (Units within B_DanceAoE[B_Level[B_Index]] of B_OriginalLoc[B_Index]) and do (Actions)
              • Loop - Actions
                • Set B_AnotherDancer = (Picked unit)
                • Unit - Order B_AnotherDancer to Stop
                • Animation - Play B_AnotherDancer's B_FinishAnimation animation
            • Custom script: call RemoveLocation(udg_B_OriginalLoc[udg_B_Index])
            • Animation - Play B_Barry[B_Index]'s B_FinishAnimation animation
            • Custom script: call GroupRemoveUnit(udg_B_DancingBarryGroup, udg_B_Barry[udg_B_Index])
            • Unit - Order B_Barry[B_Index] to Stop
            • Set B_Recycle[B_Index] = B_Recycle[0]
            • Set B_Recycle[0] = B_Index
            • Set B_Prev[B_Next[B_Index]] = B_Prev[B_Index]
            • Set B_Next[B_Prev[B_Index]] = B_Next[B_Index]
            • Set B_Barry[B_Index] = No unit
            • Custom script: set udg_B_Owner[udg_B_Index] = null
            • Set B_ActiveInstance = (B_ActiveInstance - 1)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • B_ActiveInstance Equal to 0
              • Then - Actions
                • Sound - Stop Credits <gen> Immediately
                • Trigger - Turn off (This trigger)
              • Else - Actions
        • Set B_Index = B_Next[B_Index]
        • Custom script: endloop
  • Requirement
    JASS:
    // Arcing Text Tag v1.0.0.3 by Maker
    
    library FloatingTextArc
        globals
            private constant    real    SIZE_MIN        = 0.018         // Minimum size of text
            private constant    real    SIZE_BONUS      = 0.012         // Text size increase
            private constant    real    TIME_LIFE       = 1.0           // How long the text lasts
            private constant    real    TIME_FADE       = 0.8           // When does the text start to fade
            private constant    real    Z_OFFSET        = 50            // Height above unit
            private constant    real    Z_OFFSET_BON    = 50            // How much extra height the text gains
            private constant    real    VELOCITY        = 2             // How fast the text move in x/y plane
            private constant    real    ANGLE           = bj_PI/2       // Movement angle of the text. Does not apply if
                                                                        // ANGLE_RND is true
            private constant    boolean ANGLE_RND       = true          // Is the angle random or fixed
            private             timer   TMR             = CreateTimer()
        endglobals
        
        struct ArcingTextTag extends array
            private texttag tt
            private real as         // angle, sin component
            private real ac         // angle, cos component
            private real ah         // arc height
            private real t          // time
            private real x          // origin x
            private real y          // origin y
            private string s        // text
            private static integer array next
            private static integer array prev
            private static integer array rn
            private static integer ic           = 0       // Instance count   
            
            private static method update takes nothing returns nothing
                local thistype this=next[0]
                local real p
                loop
                    set p = Sin(bj_PI*.t)
                    set .t = .t - 0.03125
                    set .x = .x + .ac
                    set .y = .y + .as
                    call SetTextTagPos(.tt, .x, .y, Z_OFFSET + Z_OFFSET_BON * p)
                    call SetTextTagText(.tt, .s, SIZE_MIN + SIZE_BONUS * p)
                    if .t <= 0 then
                        set .tt = null
                        set next[prev[this]] = next[this]
                        set prev[next[this]] = prev[this]
                        set rn[this] = rn[0]
                        set rn[0] = this
                        if next[0]==0 then
                            call PauseTimer(TMR)
                        endif
                    endif
                    set this = next[this]
                    exitwhen this == 0
                endloop
            endmethod
            
            public static method create takes string s, unit u returns thistype
                local thistype this = rn[0]
                static if ANGLE_RND then
                    local real a = GetRandomReal(0, 2*bj_PI)
                else
                    local real a = ANGLE
                endif
                if this == 0 then
                    set ic = ic + 1
                    set this = ic
                else
                    set rn[0] = rn[this]
                endif
                
                set next[this] = 0
                set prev[this] = prev[0]
                set next[prev[0]] = this
                set prev[0] = this
                
                set .s = s
                set .x = GetUnitX(u)
                set .y = GetUnitY(u)
                set .t = TIME_LIFE
                set .as = Sin(a)*VELOCITY
                set .ac = Cos(a)*VELOCITY
                set .ah = 0.
                
                if IsUnitVisible(u, GetLocalPlayer()) then
                    set .tt = CreateTextTag()
                    call SetTextTagPermanent(.tt, false)
                    call SetTextTagLifespan(.tt, TIME_LIFE)
                    call SetTextTagFadepoint(.tt, TIME_FADE)
                    call SetTextTagText(.tt, s, SIZE_MIN)
                    call SetTextTagPos(.tt, .x, .y, Z_OFFSET)
                endif
                
                if prev[this] == 0 then
                    call TimerStart(TMR, 0.03125, true, function thistype.update)
                endif
                
                return this
            endmethod
        endstruct
    endlibrary
  • Changelog
    - v1.0 - Initial version
    - v1.1 - Units no longer paused and variables names fixed :]
  • Credit
    - Maker

Barry Bustle! :]

Keywords:
Barry, Fun, Dance
Contents

Test Map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. Barry Dance v1.0 | Reviewed by Maker | 17th Aug 2013 NEEDS FIX Even though this spell is just for fun, avoid using Pause unit [tr] Your variable names are...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.


Barry Dance v1.0 | Reviewed by Maker | 17th Aug 2013
NEEDS FIX


126248-albums6177-picture66522.png


  • Even though this spell is just for fun, avoid using Pause unit
126248-albums6177-picture66523.png


  • Your variable names are too generic and might collide with other abilities.
    Add ability spesific prefixes for example
[tr]
 
Level 13
Joined
Mar 29, 2012
Messages
530
@DivineLight
  • Barry
    • Events
      • Spell - Barry Dance spell is commented
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to DivineLight
    • Actions
      • Unit - Kill Barry
      • Game - Display message to (All Barries) the message: "Wanted: DivineLight, Status: Killer"
 
Top