1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  6. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  7. The 13th Music Contest Poll has begun! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger Viewer

StunSystem.w3x
Variables
Initialization
Implement example
Initialization
Stun system
HOW TO IMPLEMENT?
Stun System by KhaosMachine
REQUIRES
Unit indexer by Bribe

		
Name Type Is Array Initial Value
ID integer No
SS_Ability_Stun abilcode No
SS_Boolean_Preload boolean No
SS_Boolean_Stack boolean No
SS_Boolean_Text boolean No
SS_Buff_Stun buffcode No
SS_Player_NeutralPassive player No
SS_Player_Temp player No
SS_Point_Temp location No
SS_Point_Temp2 location No
SS_Real_Distance real No
SS_Real_Duration real No
SS_Real_Interval real No
SS_Real_Time real Yes
SS_Region_Map rect No
SS_String_Order string No
SS_String_SpecialEffectTarget string No
SS_String_Temp string No
SS_TextTag_Temp texttag No
SS_Timer_Running timer No
SS_Unit_Target unit No
SS_Unit_Temp unit No
SS_Unit_Temp2 unit No
SS_UnitGroup_Group group No
SS_UnitType_Dummy unitcode No
UDex integer No
UDexGen integer No
UDexNext integer Yes
UDexPrev integer Yes
UDexRecycle integer No
UDexUnits unit Yes
UDexWasted integer No
UnitIndexerEnabled boolean No
UnitIndexEvent real No
Implement example
  Events
    Player - Player 1 (Red) skips a cinematic sequence
  Conditions
  Actions
    -------- ************************************** --------
    -------- YOU HAVE TO PUT THIS VARIABLES WITH YOUR WANTED VALUES ON YOUR TRIGGER --------
    -------- ************************************** --------
    -------- SET THE TARGET OF THE STUN --------
    Set VariableSet SS_Unit_Target = (Random unit from (Units in (Playable map area) owned by Player 1 (Red)))
    -------- SET THE DURATION OF THE STUN --------
    Set VariableSet SS_Real_Duration = 1.50
    -------- SET TRUE/FALSE TO STACK THE STUN --------
    Set VariableSet SS_Boolean_Stack = True
    -------- SET TRUE/FALSE TO SEE THE TEXT --------
    Set VariableSet SS_Boolean_Text = True
    -------- A RANDOM DISTANCE (CLOSED) FOR STAY FREE FROM BUGS --------
    Set VariableSet SS_Real_Distance = (Random real number between 1.00 and 300.00)
    -------- RUN THE SYSTEM (ONLY COPY AND PASTE THIS, DON'T CONFIGURE) --------
    Custom script: call ExecuteFunc("StunSystem_Run")
    -------- ************************************** --------
    -------- YOU HAVE TO PUT THIS VARIABLES WITH YOUR WANTED VALUES ON YOUR TRIGGER --------
    -------- NOTE: YOU HAVE TO SET ALL!!! THIS VARIABLES ----> IF NOT, THE SYSTEM DOESN'T WORKS FINE --------
    -------- ************************************** --------
Initialization
  Events
    Map initialization
  Conditions
  Actions
    Game - Display to (All players) the text: Press 'ESC' to stun a random unit...
If you want to implement this system you have to copy the next things.

============================================================//

TRIGGERS:

•Stun system
•Unit indexer (thanks to Bribe for this!)

OBJECT EDITOR:

Units:

•Dummy

You can copy this from this map

Abilities:

•Stun (from the 'War stomp' ability) < This have to have the next values:

Damage = 0
Mana cost = 0
Duration - Heroe = 10000000000 (to set this value you have to press Shift+Double click on the data editor)
Duration - Unit = 10000000000 (to set this value you have to press Shift+Double click on the data editor)
Hero ability = False
Area of effect = 0.01

You can copy this from this map

============================================================//

And put the correct values of the variables on the "Stun system" trigger (there are the instructions)

Look at the 'ESC' trigger to see the example!!! It's very easy!!!
Stun System by KhaosMachine
  Events
    Map initialization
  Conditions
  Actions
    -------- |||||||||||||||||||||||||||||||||||||||||||||||||XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||||||||||||||||||||||||||||||||||||||||||||||||| --------
    -------- |||||||||||||||||||||||||||||||||||||||||||||||||CONFIGURATION||||||||||||||||||||||||||||||||||||||||||||||||| --------
    -------- |||||||||||||||||||||||||||||||||||||||||||||||||XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||||||||||||||||||||||||||||||||||||||||||||||||| --------
    -------- The unit-type that cast the stun ability --------
    Set VariableSet SS_UnitType_Dummy = Dummy
    -------- The ability that stuns the target --------
    Set VariableSet SS_Ability_Stun = Stun
    -------- The string order of the stun ability --------
    Set VariableSet SS_String_Order = stomp
    -------- The buff of the stun ability --------
    Set VariableSet SS_Buff_Stun = Stunned (Pause)
    -------- The interval of the timer that check the stun --------
    Set VariableSet SS_Real_Interval = 0.05
    -------- |||||||||||||||||||||||||||||||||||||||||||||||||XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||||||||||||||||||||||||||||||||||||||||||||||||| --------
    -------- |||||||||||||||||||||||||||||||||||||||||||||||||END OF CONFIGURATION||||||||||||||||||||||||||||||||||||||||||||||||| --------
    -------- |||||||||||||||||||||||||||||||||||||||||||||||||XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX||||||||||||||||||||||||||||||||||||||||||||||||| --------
    Set VariableSet SS_Region_Map = (Playable map area)
    Set VariableSet SS_Player_NeutralPassive = Neutral Passive
    Set VariableSet SS_Player_Temp = Player 1 (Red)
    Set VariableSet SS_Point_Temp = (Center of (Playable map area))
    Unit - Create 1.SS_UnitType_Dummy for SS_Player_Temp at SS_Point_Temp facing 0.00 degrees
    Set VariableSet SS_Unit_Temp = (Last created unit)
    Unit - Add SS_Ability_Stun to SS_Unit_Temp
    Unit - Remove SS_Unit_Temp from the game
    Custom script: call RemoveLocation(udg_SS_Point_Temp)
    Custom script: endfunction
    Custom script: function StunSystem_Running takes nothing returns nothing
    Unit Group - Pick every unit in SS_UnitGroup_Group and do (Actions)
      Loop - Actions
        Set VariableSet SS_Unit_Temp = (Picked unit)
        Set VariableSet ID = (Custom value of SS_Unit_Temp)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            SS_Real_Time[ID] Greater than or equal to 0.00
          Then - Actions
            Set VariableSet SS_Real_Time[ID] = (SS_Real_Time[ID] - 0.05)
          Else - Actions
            Unit - Remove SS_Buff_Stun buff from SS_Unit_Temp
            Unit Group - Remove SS_Unit_Temp from SS_UnitGroup_Group.
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (SS_UnitGroup_Group is empty) Equal to True
              Then - Actions
                Countdown Timer - Pause SS_Timer_Running
              Else - Actions
    Custom script: endfunction
    Custom script: function StunSystem_Run takes nothing returns nothing
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        SS_Unit_Target Not equal to No unit
        (SS_Unit_Target is alive) Equal to True
      Then - Actions
        Set VariableSet SS_Point_Temp2 = (Position of SS_Unit_Target)
        Set VariableSet ID = (Custom value of SS_Unit_Target)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            SS_Boolean_Stack Equal to True
          Then - Actions
            Set VariableSet SS_Real_Time[ID] = (SS_Real_Time[ID] + SS_Real_Duration)
          Else - Actions
            Set VariableSet SS_Real_Time[ID] = SS_Real_Duration
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            SS_Boolean_Text Equal to True
          Then - Actions
            Set VariableSet SS_String_Temp = (String(SS_Real_Time[ID]))
            Floating Text - Create floating text that reads (Substring((String(SS_Real_Time[ID])), 1, ((Length of SS_String_Temp) - 1))) at SS_Point_Temp2 with Z offset 80.00, using font size 10, color (70.00%, 70.00%, 100.00%), and 0% transparency
            Set VariableSet SS_TextTag_Temp = (Last created floating text)
            Floating Text - Change SS_TextTag_Temp: Disable permanence
            Floating Text - Set the velocity of SS_TextTag_Temp to 64 towards 90 degrees
            Floating Text - Change the fading age of SS_TextTag_Temp to 1.20 seconds
            Floating Text - Change the lifespan of SS_TextTag_Temp to 1.75 seconds
          Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (SS_Unit_Target has buff SS_Buff_Stun) Equal to False
          Then - Actions
            Set VariableSet SS_Point_Temp = (SS_Point_Temp2 offset by SS_Real_Distance towards (Random angle) degrees.)
            Unit - Move SS_Unit_Target instantly to SS_Point_Temp
            Unit - Create 1.SS_UnitType_Dummy for Neutral Passive at SS_Point_Temp facing 0.00 degrees
            Set VariableSet SS_Unit_Temp = (Last created unit)
            Unit - Add SS_Ability_Stun to SS_Unit_Temp
            Unit - Order SS_Unit_Temp to Orc Tauren Chieftain - War Stomp.
            Custom script: call IssueImmediateOrder(udg_SS_Unit_Temp, udg_SS_String_Order)
            Unit - Add a 0.40 second Generic expiration timer to SS_Unit_Temp
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (SS_UnitGroup_Group is empty) Equal to True
              Then - Actions
                Custom script: call TimerStart(udg_SS_Timer_Running, udg_SS_Real_Interval, true, function StunSystem_Running)
              Else - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (SS_Unit_Target is in SS_UnitGroup_Group.) Equal to True
              Then - Actions
              Else - Actions
                Unit Group - Add SS_Unit_Target to SS_UnitGroup_Group
            Unit - Move SS_Unit_Target instantly to SS_Point_Temp2
            Custom script: call RemoveLocation(udg_SS_Point_Temp)
          Else - Actions
        Custom script: call RemoveLocation(udg_SS_Point_Temp2)
      Else - Actions
        Game - Display to (All players) the text: You entered an invalid target!
Unit indexer by Bribe
  Events
    Map initialization
  Conditions
  Actions
    Custom script: call ExecuteFunc("InitializeUnitIndexer")
    Custom script: endfunction
    Custom script: function IndexUnit takes nothing returns boolean
    Custom script: local integer pdex = udg_UDex
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        UnitIndexerEnabled Equal to True
      Then - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            UDexRecycle Equal to 0
          Then - Actions
            Set VariableSet UDex = (UDexGen + 1)
            Set VariableSet UDexGen = UDex
          Else - Actions
            Set VariableSet UDex = UDexRecycle
            Set VariableSet UDexRecycle = UDexNext[UDex]
        Set VariableSet UDexUnits[UDex] = (Matching unit)
        Unit - Set the custom value of UDexUnits[UDex] to UDex
        Set VariableSet UDexPrev[UDexNext[0]] = UDex
        Set VariableSet UDexNext[UDex] = UDexNext[0]
        Set VariableSet UDexNext[0] = UDex
        Set VariableSet UnitIndexEvent = 0.00
        Set VariableSet UnitIndexEvent = 1.00
        Set VariableSet UnitIndexEvent = 0.00
        Custom script: set udg_UDex = pdex
      Else - Actions
    Custom script: return false
    Custom script: endfunction
    Custom script: function IndexNewUnit takes nothing returns boolean
    Custom script: local integer pdex = udg_UDex
    Custom script: local integer ndex
    Set VariableSet UDexWasted = (UDexWasted + 1)
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        UDexWasted Equal to 15
      Then - Actions
        Set VariableSet UDexWasted = 0
        Set VariableSet UDex = UDexNext[0]
        Custom script: loop
        Custom script: exitwhen udg_UDex == 0
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (Custom value of UDexUnits[UDex]) Equal to 0
          Then - Actions
            Custom script: set ndex = udg_UDexNext[udg_UDex]
            Custom script: set udg_UDexNext[udg_UDexPrev[udg_UDex]] = ndex
            Custom script: set udg_UDexPrev[ndex] = udg_UDexPrev[udg_UDex]
            Set VariableSet UDexPrev[UDex] = 0
            Set VariableSet UnitIndexEvent = 2.00
            Set VariableSet UnitIndexEvent = 0.00
            Set VariableSet UDexUnits[UDex] = No unit
            Set VariableSet UDexNext[UDex] = UDexRecycle
            Set VariableSet UDexRecycle = UDex
            Custom script: set udg_UDex = ndex
          Else - Actions
            Set VariableSet UDex = UDexNext[UDex]
        Custom script: endloop
        Custom script: set udg_UDex = pdex
      Else - Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Custom value of (Matching unit)) Equal to 0
      Then - Actions
        Custom script: call IndexUnit()
      Else - Actions
    Custom script: return false
    Custom script: endfunction
    Custom script: function InitializeUnitIndexer takes nothing returns nothing
    Custom script: local integer i = 0
    Custom script: local region re = CreateRegion()
    Custom script: local rect r = GetWorldBounds()
    Set VariableSet UnitIndexerEnabled = True
    Custom script: call RegionAddRect(re, r)
    Custom script: call TriggerRegisterEnterRegion(CreateTrigger(), re, Filter(function IndexNewUnit))
    Custom script: call RemoveRect(r)
    Custom script: set re = null
    Custom script: set r = null
    Custom script: loop
    Custom script: call GroupEnumUnitsOfPlayer(bj_lastCreatedGroup, Player(i), Filter(function IndexUnit))
    Custom script: set i = i + 1
    Custom script: exitwhen i == 16
    Custom script: endloop
    Set VariableSet UnitIndexEvent = 3.00
    Set VariableSet UnitIndexEvent = 0.00