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

Demon's Swap v0.03b

  • Like
Reactions: doomhammer99
Demon's Swap [W]
Magically swap the position of the caster and the target.Not instantly but spinning around the mid-point and change the positions.

Level 1 - Cast Range 800.
Level 2 - Cast Range 1000.
Level 3 - Cast Range 1200.
Cooldown - 3 seconds.

**v0.03Triggers**

  • DeS Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- -------------------------CONFIGURATION START----------------------------------- --------
      • -------- ------------------------------------------------------------ --------
      • -------- Is the caster alive?? --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Condition_Config[0] = True
      • -------- ------------------------------------------------------------ --------
      • -------- Is the target alive?? --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Condition_Config[1] = True
      • -------- ------------------------------------------------------------ --------
      • -------- The distance dividing integer --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Middle_Distance_Divider = 2
      • -------- ------------------------------------------------------------ --------
      • -------- The speed of swapping places --------
      • -------- The speed number should be even --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Swap_Speed = 16.00
      • -------- ------------------------------------------------------------ --------
      • -------- The size of the effect in precentage 100% is normal --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Middle_Effect_Size = 500.00
      • -------- ------------------------------------------------------------ --------
      • -------- The time of the effect stay --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Middle_Effect_Timer = 2.00
      • -------- ------------------------------------------------------------ --------
      • -------- The attachment of the special effect on the caster --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Attachment_1 = chest
      • -------- ------------------------------------------------------------ --------
      • -------- The attachment of the special effect on the target --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Attachment_2 = chest
      • -------- ------------------------------------------------------------ --------
      • -------- The attachment of the special effect on the middle unit --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Attachment_3 = origin
      • -------- ------------------------------------------------------------ --------
      • -------- The model file of the special effect on caster --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Effect_Model_1 = Abilities\Weapons\SeaElementalMissile\SeaElementalMissile.mdl
      • -------- ------------------------------------------------------------ --------
      • -------- The model file of the special effect on target --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Effect_Model_2 = Abilities\Weapons\WaterElementalMissile\WaterElementalMissile.mdl
      • -------- ------------------------------------------------------------ --------
      • -------- The model file of the special effect on middle unit --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Effect_Model_3 = Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the Ability variable, which reduces time when copying this spell into ur map --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Spell = Demon's Swap
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the Unit-Type variable, which reduces time when copying this spell into ur map --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Dummy_Type = Dummy
      • -------- -------------------------CONFIGURATION END----------------------------------- --------


  • DeS Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to DeS_Spell
    • Actions
      • -------- ------------------------------------------------------------ --------
      • -------- IMPORTANT SYSTEM START --------
      • -------- ------------------------------------------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeS_Index_Listener Equal to 0
        • Then - Actions
          • Trigger - Turn on DeS Loop <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • DeS_Recycle_Size Greater than 0
        • Then - Actions
          • Set DeS_Recycle_Size = (DeS_Recycle_Size - 1)
          • Set DeS_Current_Index = DeS_Recycle_Container[DeS_Recycle_Size]
        • Else - Actions
          • Set DeS_Current_Index = DeS_Index_Size
          • Set DeS_Index_Size = (DeS_Index_Size + 1)
      • -------- ------------------------------------------------------------ --------
      • -------- IMPORTANT SYSTEM END --------
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the stage to be 0 which is reused in the Loop TRIGGER --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Stage[DeS_Current_Index] = 0
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the caster for its current index --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Caster[DeS_Current_Index] = (Triggering unit)
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the target for its current index --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Target[DeS_Current_Index] = (Target unit of ability being cast)
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the position/point of the caster --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Caster_Point = (Position of DeS_Caster[DeS_Current_Index])
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the position/point of the target --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Target_Point = (Position of DeS_Target[DeS_Current_Index])
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the position/point of the caster again as a start point --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Start_Point[DeS_Current_Index] = (Position of DeS_Caster[DeS_Current_Index])
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the position/point of the target again as an end point --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_End_Point[DeS_Current_Index] = (Position of DeS_Target[DeS_Current_Index])
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the middle distance between the two units (caster and target) --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Middle_Distance[DeS_Current_Index] = ((Distance between DeS_Caster_Point and DeS_Target_Point) / (Real(DeS_Middle_Distance_Divider)))
      • -------- ------------------------------------------------------------ --------
      • -------- Sets the middle point at the middle distance set before --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Middle_Point[DeS_Current_Index] = (DeS_Caster_Point offset by DeS_Middle_Distance[DeS_Current_Index] towards (Angle from DeS_Caster_Point to DeS_Target_Point) degrees)
      • -------- ------------------------------------------------------------ --------
      • -------- Creates a dummy at the middle point set before to use as a point with offset and store the dummy into a variable --------
      • -------- ------------------------------------------------------------ --------
      • Unit - Create 1 DeS_Dummy_Type for (Owner of DeS_Caster[DeS_Current_Index]) at DeS_Middle_Point[DeS_Current_Index] facing Default building facing degrees
      • Set DeS_Middle_Unit[DeS_Current_Index] = (Last created unit)
      • -------- ------------------------------------------------------------ --------
      • -------- Change the effect size --------
      • -------- ------------------------------------------------------------ --------
      • Animation - Change DeS_Middle_Unit[DeS_Current_Index]'s size to (DeS_Middle_Effect_Size%, 0.00%, 0.00%) of its original size
      • -------- ------------------------------------------------------------ --------
      • -------- Adds expiration timer for the effect --------
      • -------- ------------------------------------------------------------ --------
      • Unit - Add a DeS_Middle_Effect_Timer second Generic expiration timer to DeS_Middle_Unit[DeS_Current_Index]
      • -------- ------------------------------------------------------------ --------
      • -------- Creates special effects and stores the created special effects into variables --------
      • -------- ------------------------------------------------------------ --------
      • Special Effect - Create a special effect attached to the DeS_Attachment_1 of DeS_Caster[DeS_Current_Index] using DeS_Effect_Model_1
      • Set DeS_Special_Effect_1[DeS_Current_Index] = (Last created special effect)
      • Special Effect - Create a special effect attached to the DeS_Attachment_2 of DeS_Target[DeS_Current_Index] using DeS_Effect_Model_2
      • Set DeS_Special_Effect_2[DeS_Current_Index] = (Last created special effect)
      • Special Effect - Create a special effect attached to the DeS_Attachment_3 of DeS_Middle_Unit[DeS_Current_Index] using DeS_Effect_Model_3
      • Special Effect - Destroy (Last created special effect)
      • -------- ------------------------------------------------------------ --------
      • -------- Turns the collision off for the caster and target --------
      • -------- ------------------------------------------------------------ --------
      • Unit - Turn collision for DeS_Caster[DeS_Current_Index] Off
      • Unit - Turn collision for DeS_Target[DeS_Current_Index] Off
      • -------- ------------------------------------------------------------ --------
      • -------- Removes the location LEAKS --------
      • -------- ------------------------------------------------------------ --------
      • Custom script: call RemoveLocation(udg_DeS_Caster_Point)
      • Custom script: call RemoveLocation(udg_DeS_Target_Point)
      • -------- ------------------------------------------------------------ --------
      • -------- Pause the target and the caster --------
      • -------- ------------------------------------------------------------ --------
      • Custom script: call PauseUnit(udg_DeS_Caster[udg_DeS_Current_Index], true)
      • Custom script: call PauseUnit(udg_DeS_Target[udg_DeS_Current_Index], true)
      • -------- ------------------------------------------------------------ --------
      • -------- IMPORTANT SYSTEM START --------
      • -------- ------------------------------------------------------------ --------
      • Set DeS_Index_Container[DeS_Index_Listener] = DeS_Current_Index
      • Set DeS_Index_Listener = (DeS_Index_Listener + 1)
      • -------- ------------------------------------------------------------ --------
      • -------- IMPORTANT SYSTEM END --------
      • -------- ------------------------------------------------------------ --------


  • DeS Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • -------- ------------------------------------------------------------ --------
      • -------- IMPORTANT SYSTEM START --------
      • -------- ------------------------------------------------------------ --------
      • For each (Integer DeS_Loop) from 0 to (DeS_Index_Listener - 1), do (Actions)
        • Loop - Actions
          • Set DeS_Current_Index = DeS_Index_Container[DeS_Loop]
          • -------- ------------------------------------------------------------ --------
          • -------- IMPORTANT SYSTEM END --------
          • -------- ------------------------------------------------------------ --------
          • -------- MAIN CONDITION --------
          • -------- ------------------------------------------------------------ --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (DeS_Caster[DeS_Current_Index] is alive) Equal to DeS_Condition_Config[0]
              • (DeS_Target[DeS_Current_Index] is alive) Equal to DeS_Condition_Config[1]
              • DeS_Stage[DeS_Current_Index] Equal to 0
            • Then - Actions
              • -------- ------------------------------------------------------------ --------
              • -------- Sets the position/point of the caster --------
              • -------- ------------------------------------------------------------ --------
              • Set DeS_Caster_Point = (Position of DeS_Caster[DeS_Current_Index])
              • -------- ------------------------------------------------------------ --------
              • -------- Sets the position/point of the target --------
              • -------- ------------------------------------------------------------ --------
              • Set DeS_Target_Point = (Position of DeS_Target[DeS_Current_Index])
              • -------- ------------------------------------------------------------ --------
              • -------- If the caster is near to the end point (or) If the target is near to the start point --------
              • -------- ------------------------------------------------------------ --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between DeS_Caster_Point and DeS_End_Point[DeS_Current_Index]) Less than or equal to 50.00
                  • (Distance between DeS_Target_Point and DeS_Start_Point[DeS_Current_Index]) Less than or equal to 50.00
                • Then - Actions
                  • -------- ------------------------------------------------------------ --------
                  • -------- Then sets the DeS_Stage= 1.So in the next loop the main condition will return false and run the else actions --------
                  • -------- ------------------------------------------------------------ --------
                  • Set DeS_Stage[DeS_Current_Index] = 1
                • Else - Actions
                  • -------- ------------------------------------------------------------ --------
                  • -------- Sets the increased angle from the middle point to the caster point.****Note**** Change the "+" to "-" to change the direction of swapping --------
                  • -------- ------------------------------------------------------------ --------
                  • Set DeS_Angle_1 = ((Angle from DeS_Middle_Point[DeS_Current_Index] to DeS_Caster_Point) + DeS_Swap_Speed)
                  • -------- ------------------------------------------------------------ --------
                  • -------- If the increased angle is greater than or eqaul to 359 ?? --------
                  • -------- ------------------------------------------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeS_Angle_1 Greater than or equal to 359.00
                    • Then - Actions
                      • -------- ------------------------------------------------------------ --------
                      • -------- then it sets the angle to 0 degree --------
                      • -------- ------------------------------------------------------------ --------
                      • Set DeS_Angle_1 = 0.00
                    • Else - Actions
                  • -------- ------------------------------------------------------------ --------
                  • -------- Moves the caster around the middle unit --------
                  • -------- ------------------------------------------------------------ --------
                  • Custom script: call SetUnitX(udg_DeS_Caster[udg_DeS_Current_Index],GetUnitX(udg_DeS_Middle_Unit[udg_DeS_Current_Index]) + udg_DeS_Middle_Distance[udg_DeS_Current_Index] * Cos(udg_DeS_Angle_1 * bj_DEGTORAD))
                  • Custom script: call SetUnitY(udg_DeS_Caster[udg_DeS_Current_Index],GetUnitY(udg_DeS_Middle_Unit[udg_DeS_Current_Index]) + udg_DeS_Middle_Distance[udg_DeS_Current_Index] * Sin(udg_DeS_Angle_1 * bj_DEGTORAD))
                  • -------- ------------------------------------------------------------ --------
                  • -------- Sets the increased angle from the middle point to the target point.****Note**** Change the "+" to "-" to change the direction of swapping --------
                  • -------- ------------------------------------------------------------ --------
                  • Set DeS_Angle_2 = ((Angle from DeS_Middle_Point[DeS_Current_Index] to DeS_Target_Point) + DeS_Swap_Speed)
                  • -------- ------------------------------------------------------------ --------
                  • -------- If the increased angle is greater than or eqaul to 359 ?? --------
                  • -------- ------------------------------------------------------------ --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • DeS_Angle_2 Greater than or equal to 359.00
                    • Then - Actions
                      • -------- ------------------------------------------------------------ --------
                      • -------- then it sets the angle to 0 degree --------
                      • -------- ------------------------------------------------------------ --------
                      • Set DeS_Angle_2 = 0.00
                    • Else - Actions
                  • -------- ------------------------------------------------------------ --------
                  • -------- Moves the target around the middle unit --------
                  • -------- ------------------------------------------------------------ --------
                  • Custom script: call SetUnitX(udg_DeS_Target[udg_DeS_Current_Index],GetUnitX(udg_DeS_Middle_Unit[udg_DeS_Current_Index]) + udg_DeS_Middle_Distance[udg_DeS_Current_Index] * Cos(udg_DeS_Angle_2 * bj_DEGTORAD))
                  • Custom script: call SetUnitY(udg_DeS_Target[udg_DeS_Current_Index],GetUnitY(udg_DeS_Middle_Unit[udg_DeS_Current_Index]) + udg_DeS_Middle_Distance[udg_DeS_Current_Index] * Sin(udg_DeS_Angle_2 * bj_DEGTORAD))
              • -------- ------------------------------------------------------------ --------
              • -------- Removes the location LEAKS --------
              • -------- ------------------------------------------------------------ --------
              • Custom script: call RemoveLocation(udg_DeS_Caster_Point)
              • Custom script: call RemoveLocation(udg_DeS_Target_Point)
            • Else - Actions
              • -------- ------------------------------------------------------------ --------
              • -------- Unpause the target and the caster --------
              • -------- ------------------------------------------------------------ --------
              • Custom script: call PauseUnit(udg_DeS_Caster[udg_DeS_Current_Index], false)
              • Custom script: call PauseUnit(udg_DeS_Target[udg_DeS_Current_Index], false)
              • -------- ------------------------------------------------------------ --------
              • -------- Turns the collision on for the caster and target --------
              • -------- ------------------------------------------------------------ --------
              • Unit - Turn collision for DeS_Caster[DeS_Current_Index] On
              • Unit - Turn collision for DeS_Target[DeS_Current_Index] On
              • -------- ------------------------------------------------------------ --------
              • -------- Destroy the stored special effects --------
              • -------- ------------------------------------------------------------ --------
              • Special Effect - Destroy DeS_Special_Effect_1[DeS_Current_Index]
              • Special Effect - Destroy DeS_Special_Effect_2[DeS_Current_Index]
              • -------- ------------------------------------------------------------ --------
              • -------- Remove the location LEAKS --------
              • -------- ------------------------------------------------------------ --------
              • Custom script: call RemoveLocation(udg_DeS_Middle_Point[udg_DeS_Current_Index])
              • Custom script: call RemoveLocation(udg_DeS_Start_Point[udg_DeS_Current_Index])
              • Custom script: call RemoveLocation(udg_DeS_End_Point[udg_DeS_Current_Index])
              • -------- ------------------------------------------------------------ --------
              • -------- IMPORTANT SYSTEM START --------
              • -------- ------------------------------------------------------------ --------
              • Set DeS_Index_Listener = (DeS_Index_Listener - 1)
              • Set DeS_Index_Container[DeS_Loop] = DeS_Index_Container[DeS_Index_Listener]
              • Set DeS_Recycle_Container[DeS_Current_Index] = DeS_Current_Index
              • Set DeS_Recycle_Size = (DeS_Recycle_Size + 1)
              • Set DeS_Loop = (DeS_Loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • DeS_Index_Listener Equal to 0
                • Then - Actions
                  • Trigger - Turn off DeS Loop <gen>
                • Else - Actions
              • -------- ------------------------------------------------------------ --------
              • -------- IMPORTANT SYSTEM END --------
              • -------- ------------------------------------------------------------ --------


  • DeS Remover
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Dummy
    • Actions
      • -------- ------------------------------------------------------------ --------
      • -------- Removes the dummy immediately upon death --------
      • -------- ------------------------------------------------------------ --------
      • Unit - Remove (Triggering unit) from the game


====================================================================================
V0.01 Uploaded Here
====================================================================================
V0.02 Fixed to MUI
====================================================================================
V0.03a Fixed the LEAKS,added documentation,a new feature with middle unit effect and it's no longer able to cast on friendly units
====================================================================================
V0.03b Fixed the special effect leak
====================================================================================


demonswapjp.jpg



Credits to Magtheridon96:
For taking a look to my spell and telling me the right things to do.
Credits to doomhammer99:
For your advice and spell rating system


Keywords:
Swapping,Moving,Simple,Cool Effects,Two Units,MUI,GUI,TRIGGER
Contents

Demon's Swap v0.03 (Map)

Reviews
11:52, 18th Nov 2012 Magtheridon96: Approved. Splendid work. Configuration is good, comments are abundant, and the code is okay.

Moderator

M

Moderator

11:52, 18th Nov 2012
Magtheridon96: Approved.
Splendid work. Configuration is good, comments are abundant, and the code is okay.
 
Level 7
Joined
Sep 2, 2011
Messages
350
Tested it. And it seems that it isn't MUI because it bugs. Try casting it at the same time. Or try this

Spellcaster#1 - casts to -> Ogre
then
Specaster#2 - casts to -> Spellcaster#1

You will see funny stuff.
 
Top