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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. The Lich King has a new champion. The results for the 19th Icon Contest are here!
    Dismiss Notice
  6. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  7. 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

Heaven's Justice v1.2.1 - GUI.w3x
Variables
Map
---------------------------
Initialization
Revive
---------------------------
Unit Indexer
Unit Indexer
Heaven's Justice v1.2.1
---------------------------
READ: Heaven's Justice
Heavens Justice Configuration
Heavens Justice Execution
Heavens Justice Periodic
---------------------------

		
Name Type Is Array Initial Value
HJ_Ability abilcode No
HJ_AbilityMaxLevel integer No
HJ_AttackType attacktype No
HJ_Caster unit Yes
HJ_CasterEffectAttach string No
HJ_CasterPlayer player Yes
HJ_CollisionRange real No
HJ_Counter integer No
HJ_CustomInteger integer No
HJ_CustomReal real Yes
HJ_CustomRealMax real Yes
HJ_CustomRealMin real Yes
HJ_DamageType damagetype No
HJ_DummyType unitcode No
HJ_Effect string Yes
HJ_EnemySoulModelHandler effect Yes
HJ_EnemySoulUnit unit Yes
HJ_FilterFlying boolean No
HJ_FilterGround boolean No
HJ_FilterMagicImmune boolean No
HJ_FilterMechanical boolean No
HJ_FilterStructure boolean No
HJ_FriendlySoulModelHandler effect Yes
HJ_FriendlySoulUnit unit Yes
HJ_Group group No
HJ_ID integer No
HJ_JudgeDuration real Yes
HJ_JudgeDurationCounter real Yes
HJ_Level integer Yes
HJ_LevitateReal real Yes
HJ_LevitateSpeedCalculation real Yes
HJ_ModelHandler effect Yes
HJ_Pause boolean Yes
HJ_PauseAbility abilcode No
HJ_PauseEnemyEffectAttach string No
HJ_PauseEnemyEffectHandler effect Yes
HJ_PauseFriendlyEffectAttach string No
HJ_PauseFriendlyEffectHandler effect Yes
HJ_PauseOrder string No
HJ_PeriodicInterval real No
HJ_PickedUnit unit No
HJ_Pitch integer No
HJ_PropWindow real Yes
HJ_Radius real Yes
HJ_RadiusEffectAngle real No
HJ_RadiusEffectCount integer Yes
HJ_ReturnHeightCalculation real Yes
HJ_SoulDamage real Yes
HJ_SoulDistance real Yes
HJ_SoulDistanceCounter real Yes
HJ_SoulEnemyExitAttach string No
HJ_SoulEnemyModelAttach string No
HJ_SoulFriendlyExitAttach string No
HJ_SoulFriendlyModelAttach string No
HJ_SoulHeal real Yes
HJ_SoulInitialHeight real Yes
HJ_SoulLevitateTime real Yes
HJ_SoulLevitateTravel boolean Yes
HJ_SoulLevitateTravelAngle real Yes
HJ_SoulMaxHeight real Yes
HJ_SoulMotionEffect string Yes
HJ_SoulMotionEffectAttach string Yes
HJ_SoulMotionEffectChance integer No
HJ_SoulReturnDamageAttach string No
HJ_SoulReturnHealAttach string No
HJ_SoulSize real Yes
HJ_SoulUnit unit Yes
HJ_SpawnEffectAttach string No
HJ_TravelSpeedCalculation real Yes
HJ_UnderPolymorphed boolean Yes
HJ_Unit unit No
HJ_Wake boolean No
IsUnitPreplaced boolean Yes
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
Initialization
  Events
    Map initialization
  Conditions
  Actions
    -------- ------------------------------------------------------------------------------------------------- --------
    -------- Camera Smoothness --------
    Camera - Reset camera smoothing factor
    Camera - Change camera smoothing factor to 1.50
    -------- ------------------------------------------------------------------------------------------------- --------
    -------- Game Environment --------
    Game - Set the time of day to 0.00
    Custom script: call UseTimeOfDayBJ( false )
    -------- ------------------------------------------------------------------------------------------------- --------
    -------- Hero Tester Selection --------
    Selection - Clear selection for Player 1 (Red).
    Selection - Select Wizard 0000 <gen>
    -------- ------------------------------------------------------------------------------------------------- --------
    -------- Display Message --------
    Game - Display to (All players) the text: |cffffcc00HEAVEN's JUSTICE|r v|cffffcc001|r.|cffffcc002|r.|cffffcc001|rPlease give a credit whenever you're using my resource.by |cffff0000jakeZinc|rRequires:<|cffffcc00Unit Indexer System|r>by |cffff0000Bribe|r
    -------- ------------------------------------------------------------------------------------------------- --------
    Player - Turn Gives bounty On for Player 1 (Red)
    Player - Turn Gives bounty On for Player 2 (Blue)
    Player - Turn Gives bounty On for Neutral Hostile
    -------- ------------------------------------------------------------------------------------------------- --------
Revive
  Events
    Unit - A unit owned by Player 1 (Red).Dies
    Unit - A unit owned by Player 2 (Blue).Dies
    Unit - A unit owned by Neutral Hostile.Dies
  Conditions
    ((Triggering unit) is Summoned) Equal to False
    (Unit-type of (Triggering unit)) Not equal to Heaven's Justice Dummy
  Actions
    -------- ------------------------------------------------------------------------------------------------- --------
    -------- declaration of locals --------
    Custom script: local unit create = GetTriggerUnit( )
    Custom script: local player owner = GetTriggerPlayer( )
    Custom script: local real createX = GetUnitX( create )
    Custom script: local real createY = GetUnitY( create )
    Custom script: local integer heroLevel = GetHeroLevel( create )
    Custom script: local integer handleUnitTypeId = GetUnitTypeId( create )
    Custom script: local real time = 5
    -------- ------------------------------------------------------------------------------------------------- --------
    -------- revival of the deads --------
    Custom script: call TriggerSleepAction( time )
    Custom script: call CreateUnit( owner, handleUnitTypeId, createX, createY, 0 )
    Custom script: call ReviveHero( create, createX, createY, true )
    Custom script: call SelectUnitAddForPlayer( create, owner )
    Custom script: call SetHeroLevel( create, heroLevel, true )
    -------- ------------------------------------------------------------------------------------------------- --------
    -------- nullification of locals --------
    Custom script: set create = null
    Custom script: set owner = null
    -------- ------------------------------------------------------------------------------------------------- --------
This trigger works in two key phases:

1) During map initialization, enumerate all existing units of all players to give them an index.
2) Adds a second event to itself to index new units as they enter the map.

As a unit enters the map, check for any old units that may have been removed at some point in order to free their index.
Unit Indexer
  Events
    Map initialization
  Conditions
  Actions
    Custom script: call ExecuteFunc("InitializeUnitIndexer")
    Custom script: endfunction
    -------- --------
    -------- This is the core function - it provides an index all existing units and for units as they enter the map --------
    -------- --------
    Custom script: function IndexUnit takes nothing returns boolean
    Custom script: local integer pdex = udg_UDex
    Custom script: local integer ndex
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        IsUnitPreplaced[0] Equal to False
      Then - Actions
        -------- --------
        -------- Check for removed units for every (32) new units created --------
        -------- --------
        Set VariableSet UDexWasted = (UDexWasted + 1)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            UDexWasted Equal to 32
          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
                -------- --------
                -------- Remove index from linked list --------
                -------- --------
                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 IsUnitPreplaced[UDex] = False
                -------- --------
                -------- Fire deindex event for UDex --------
                -------- --------
                Set VariableSet UnitIndexEvent = 2.00
                Set VariableSet UnitIndexEvent = 0.00
                -------- --------
                -------- Recycle the index for later use --------
                -------- --------
                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
          Else - Actions
      Else - Actions
    -------- --------
    -------- You can use the boolean UnitIndexerEnabled to protect some of your undesirable units from being indexed --------
    -------- - Example: --------
    -------- -- Set UnitIndexerEnabled = False --------
    -------- -- Unit - Create 1 Dummy for (Triggering player) at TempLoc facing 0.00 degrees --------
    -------- -- Set UnitIndexerEnabled = True --------
    -------- --------
    -------- You can also customize the following block - if conditions are false the (Matching unit) won't be indexed. --------
    -------- --------
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        UnitIndexerEnabled Equal to True
        (Custom value of (Matching unit)) Equal to 0
      Then - Actions
        -------- --------
        -------- Generate a unique integer index for this unit --------
        -------- --------
        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]
        -------- --------
        -------- Link index to unit, unit to index --------
        -------- --------
        Set VariableSet UDexUnits[UDex] = (Matching unit)
        Unit - Set the custom value of UDexUnits[UDex] to UDex
        Set VariableSet IsUnitPreplaced[UDex] = IsUnitPreplaced[0]
        -------- --------
        -------- Use a doubly-linked list to store all active indexes --------
        -------- --------
        Set VariableSet UDexPrev[UDexNext[0]] = UDex
        Set VariableSet UDexNext[UDex] = UDexNext[0]
        Set VariableSet UDexNext[0] = UDex
        -------- --------
        -------- Fire index event for UDex --------
        -------- --------
        Set VariableSet UnitIndexEvent = 0.00
        Set VariableSet UnitIndexEvent = 1.00
        Set VariableSet UnitIndexEvent = 0.00
      Else - Actions
    Custom script: set udg_UDex = pdex
    Custom script: return false
    Custom script: endfunction
    -------- --------
    -------- The next function initializes the core of the system --------
    -------- --------
    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()
    Custom script: local boolexpr b = Filter(function IndexUnit)
    Set VariableSet UnitIndexEvent = -1.00
    Set VariableSet UnitIndexerEnabled = True
    Set VariableSet IsUnitPreplaced[0] = True
    Custom script: call RegionAddRect(re, r)
    Custom script: call TriggerRegisterEnterRegion(CreateTrigger(), re, b)
    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), b)
    Custom script: set i = i + 1
    Custom script: exitwhen i == bj_MAX_PLAYER_SLOTS
    Custom script: endloop
    Custom script: set b = null
    -------- --------
    -------- This is the "Unit Indexer Initialized" event, use it instead of "Map Initialization" for best results --------
    -------- --------
    Set VariableSet IsUnitPreplaced[0] = False
    Set VariableSet UnitIndexEvent = 3.00
>==============================================================================================<
HEAVEN's JUSTICE
v1.2.1 - GUI

- by jakeZinc -
>==============================================================================================<

"Might be useful at changing the result or outcome of the battlefield and combat."

= Import Instructions =

Go to: File -> Preferences -> General
*Check or Tick the box labelled 'Automatically create unknown variables while pasting trigger data'.
^ Important

Go to: Window
*Make sure the 'brush list' is unchecked.
^ Optional

Please you're REQUIRED to import or copy and paste these things into your map:
* Import Manager ( F12 ) - Model - dummy.mdx ( Vexorian, Anitarf, Infrane )
* Object Editor ( F6 ) - Unit - Heaven's Justice Dummy
* Object Editor ( F6 ) - Ability - Heaven's Justice Ability
* Object Editor ( F6 ) - Ability - Heaven's Justice Pause Ability
* Trigger Editor ( F4 ) - Folder - Heaven's Justice v1.2.1
* Trigger Editor ( F4 ) - Folder - Unit Indexer ( EXCLUDE IF YOU ALREADY HAVE THIS ON YOUR MAP )

= Spell Configurations =

Go to: Heavens Justice Configuration Trigger -> SPELL CONFIGURATION FIELD
* Please READ before modifying some values to prevent unexpected bugs.
* Some basic modification values ( manacosts, descriptions, or levels... ) are set in Object Editor.

>==============================================================================================<
Heavens Justice Configuration
  Events
    Map initialization
  Conditions
  Actions
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- SPELL CONFIGURATION FIELD --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- OBJECT EDITOR ( F6 ) --------
    -------- The spell or ability used in the triggers. ( Strictly Import the Heaven's Justice Ability ) --------
    Set VariableSet HJ_Ability = Heaven's Justice
    -------- --------
    -------- The pause ability ( based on channel ) used in the triggers. --------
    Set VariableSet HJ_PauseAbility = Heaven's Justice Pause
    -------- ^ Configure HJ_Pause boolean expression below ( SPELL DATA SECTION ). IF: True = Import the Heaven's Justice Pause Ability ( Maker ), False = Delete this ( HJ_PauseAbility ) and don't import the Pause Ability. --------
    -------- --------
    -------- The dummy unit used in the triggers. ( Strictly Import the Heaven's Justice Dummy Unit ) --------
    Set VariableSet HJ_DummyType = Heaven's Justice Dummy
    -------- ^ Tip: You can also select one of the dummies already existed or created in your map. ( Make sure dummy.mdx is the model used in that dummy unit and the unit's data value must be similar to it. ) --------
    -------- ^ This tip is useful for sharing dummy type units. ( Saves you 1 Unit Type in your object editor ) ( As long as they have similar object data values. ) --------
    -------- ^ The shadow image of the dummy unit is enabled ( flyer ), you can disable it by setting it to 'none' in Object Editor ( F6 ). --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- * DATA ARRAY VALUES: [ 1 ] = Level 1, [ 2 ] = Level 2, [ 3 ] = Level 3 ..., You can increase the array value if you want to add the levels of the ability in an integer consecutive order. --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- SPELL DATA --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- The maximum level of the ability or the number of levels in Heaven's Justice Ability. --------
    Set VariableSet HJ_AbilityMaxLevel = 3
    -------- ^ Modify at your own risk: Must be equal to the amount of levels in Heaven's Justice Ability in OBJECT EDITOR ( F6 ). Wrong value causes error. --------
    -------- --------
    -------- The area of effect of the spell. ( Must be equal to Area of Effect values in the Heaven's Justice ability data. ) --------
    Set VariableSet HJ_Radius[1] = 400.00
    Set VariableSet HJ_Radius[2] = 400.00
    Set VariableSet HJ_Radius[3] = 400.00
    -------- --------
    -------- A primary effect occurs in the area of effect ( radius ) in circular formation. --------
    Set VariableSet HJ_Effect[1] = Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
    -------- A secondary effect occurs in the area of effect ( radius ) in circular formation. --------
    Set VariableSet HJ_Effect[0] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
    -------- If you don't want secondary effects just make the value the same as above. --------
    Set VariableSet HJ_SpawnEffectAttach = origin
    -------- The pitch value of the radius effects, ranges from 0 - 180. --------
    Set VariableSet HJ_Pitch = 180
    -------- --------
    -------- The number of total effects ( Effect[ 1 ] and [ 0 ] ) created in the area of effect ( radius ). --------
    Set VariableSet HJ_RadiusEffectCount[1] = 20
    Set VariableSet HJ_RadiusEffectCount[2] = 20
    Set VariableSet HJ_RadiusEffectCount[3] = 20
    -------- --------
    -------- TARGETS FILTRATION - you can filter your wanted targets here. --------
    Set VariableSet HJ_FilterFlying = True
    Set VariableSet HJ_FilterGround = True
    Set VariableSet HJ_FilterStructure = False
    Set VariableSet HJ_FilterMechanical = False
    Set VariableSet HJ_FilterMagicImmune = True
    -------- --------
    -------- Want the body unable to move or follow an order when the soul leaves it? --------
    -------- Boolean Expression: True = Yes, False = No --------
    Set VariableSet HJ_Pause[1] = True
    Set VariableSet HJ_Pause[2] = False
    Set VariableSet HJ_Pause[3] = True
    -------- --------
    -------- Want the sleeping units to be affected by the pause? --------
    -------- Boolean Expression: True = Yes, False = No --------
    Set VariableSet HJ_Wake = True
    -------- --------
    -------- The base order ID of the pause ability. ( Must be equal to Heaven's Justice Pause Ability base order ID value. ) --------
    Set VariableSet HJ_PauseOrder = defend
    -------- ^ I'd use defend order as it is rarely used in immediate order. --------
    -------- --------
    -------- An effect occurs in the attachment when the units are in pause state. --------
    -------- Pause Friendly Units: --------
    Set VariableSet HJ_Effect[2] = Abilities\Spells\Items\AIta\CrystalBallCaster.mdl
    Set VariableSet HJ_PauseFriendlyEffectAttach = overhead
    -------- Pause Enemy Units: --------
    Set VariableSet HJ_Effect[3] = Abilities\Spells\Undead\Possession\PossessionTarget.mdl
    Set VariableSet HJ_PauseEnemyEffectAttach = overhead
    -------- --------
    -------- The duration when the heaven judges the soul. --------
    Set VariableSet HJ_JudgeDuration[1] = 0.75
    Set VariableSet HJ_JudgeDuration[2] = 1.50
    Set VariableSet HJ_JudgeDuration[3] = 1.25
    -------- --------
    -------- The attack and damage type of spell. ( Spell Damage ) --------
    Set VariableSet HJ_AttackType = Spells
    Set VariableSet HJ_DamageType = Normal
    -------- --------
    -------- The interval of the periodic solved by ( second / frames per second ). * Recommended Value: ( 1 / 30 ) for great spell performance. --------
    Set VariableSet HJ_PeriodicInterval = (1.00 / 60.00)
    -------- ^ ( 1 / 60 ) value is optional for the smooth motions but it is your choice in performance. --------
    -------- ^Modify at your own risk: Lowering this modified value can cause serious lags because of the possibility of filtering large amount of units in periodic. --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- SOULS DATA --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- Friendly units' soul art model and it's attachment point. --------
    Set VariableSet HJ_Effect[4] = Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
    Set VariableSet HJ_SoulFriendlyModelAttach = origin
    Set VariableSet HJ_SoulFriendlyExitAttach = head
    -------- Enemy units' soul art model and it's attachment point. --------
    Set VariableSet HJ_Effect[5] = Abilities\Weapons\AvengerMissile\AvengerMissile.mdl
    Set VariableSet HJ_SoulEnemyModelAttach = origin
    Set VariableSet HJ_SoulEnemyExitAttach = head
    -------- --------
    -------- The size of the soul. --------
    Set VariableSet HJ_SoulSize[1] = 0.80
    Set VariableSet HJ_SoulSize[2] = 0.80
    Set VariableSet HJ_SoulSize[3] = 0.80
    -------- --------
    -------- The initial height of the soul when leaves the body. --------
    Set VariableSet HJ_SoulInitialHeight[1] = 40.00
    Set VariableSet HJ_SoulInitialHeight[2] = 40.00
    Set VariableSet HJ_SoulInitialHeight[3] = 40.00
    -------- --------
    -------- The maximum height of the soul to reach the heaven. Must be greater than game camera distance field target to be realistic. --------
    Set VariableSet HJ_SoulMaxHeight[1] = 1500.00
    Set VariableSet HJ_SoulMaxHeight[2] = 1500.00
    Set VariableSet HJ_SoulMaxHeight[3] = 1500.00
    -------- --------
    -------- The levitate speed of the soul to reach the heaven. It is based on a time value. ( Seconds ) --------
    Set VariableSet HJ_SoulLevitateTime[1] = 0.75
    Set VariableSet HJ_SoulLevitateTime[2] = 2.30
    Set VariableSet HJ_SoulLevitateTime[3] = 4.60
    -------- --------
    -------- Allow the soul to travel in different direction while levitating? --------
    -------- Boolean Expression: True = Yes, False = No --------
    Set VariableSet HJ_SoulLevitateTravel[1] = True
    Set VariableSet HJ_SoulLevitateTravel[2] = False
    Set VariableSet HJ_SoulLevitateTravel[3] = True
    -------- --------
    -------- An effect occurs when the soul is now in motion state. --------
    -------- Friendly Soul: --------
    Set VariableSet HJ_Effect[6] = Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
    -------- Enemy Soul: --------
    Set VariableSet HJ_Effect[7] = Abilities\Weapons\AvengerMissile\AvengerMissile.mdl
    -------- The probability of a soul motion looping effect to occur. Consider this value as a percentage ( 0%,100% ) --------
    Set VariableSet HJ_SoulMotionEffectChance = 0
    -------- ^ If you want to disable the motion effect, set the chance value to 0. --------
    -------- ^ Modify at your own risk; The large maximum value is 100 do not EXCEED or it will cause problems. Recommended Value: the modified value ( 15 ). --------
    -------- --------
    -------- The heal value to the friendly units when the soul already returned to their own host/body. --------
    Set VariableSet HJ_SoulHeal[1] = 100.00
    Set VariableSet HJ_SoulHeal[2] = 200.00
    Set VariableSet HJ_SoulHeal[3] = 400.00
    -------- --------
    -------- An effect occurs to the friendly units when the soul is returning to the host/body. --------
    Set VariableSet HJ_Effect[8] = Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
    Set VariableSet HJ_SoulReturnHealAttach = origin
    -------- --------
    -------- The damage value to the enemy units when the soul already returned to their own host/body. --------
    Set VariableSet HJ_SoulDamage[1] = 50.00
    Set VariableSet HJ_SoulDamage[2] = 100.00
    Set VariableSet HJ_SoulDamage[3] = 200.00
    -------- --------
    -------- An effect occurs to the enemy units when the soul is returning to the host/body. --------
    Set VariableSet HJ_Effect[9] = Abilities\Spells\Undead\DeathCoil\DeathCoilSpecialArt.mdl
    Set VariableSet HJ_SoulReturnDamageAttach = origin
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- An effect occurs to the caster when the ability is casted. --------
    Set VariableSet HJ_Effect[10] = Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
    Set VariableSet HJ_CasterEffectAttach = origin
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- CODE DATA --------
    -------- ( BE CAREFUL TOUCHING THE LINES BELOW IF YOU HAVE NO EXPERIENCE IN CODING DILEMMA ) --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- PRELOAD OBJECTS --------
    -------- Abilities And Units: --------
    Custom script: set udg_HJ_Unit = CreateUnit( Player( 15 ), udg_HJ_DummyType, 0, 0, 0 )
    Custom script: call UnitAddAbility( udg_HJ_Unit, udg_HJ_Ability )
    Custom script: call UnitAddAbility( udg_HJ_Unit, udg_HJ_PauseAbility )
    Custom script: call RemoveUnit( udg_HJ_Unit )
    -------- Effects: --------
    Set VariableSet HJ_CustomInteger = 0
    For each (Integer HJ_CustomInteger) from 0 to 10, do (Actions)
      Loop - Actions
        Custom script: call Preload( udg_HJ_Effect[ udg_HJ_CustomInteger ] )
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- DON'T TOUCH THESE. ( If this line malfunctions you can touch it to correct the needed parameters or values. ) --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    Custom script: call TriggerRegisterTimerEventPeriodic( gg_trg_Heavens_Justice_Periodic , udg_HJ_PeriodicInterval )
    For each (Integer HJ_CustomInteger) from 1 to 3, do (Actions)
      Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            HJ_SoulLevitateTravel[HJ_CustomInteger] Equal to True
          Then - Actions
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                HJ_FilterFlying Equal to True
              Then - Actions
                Set VariableSet HJ_CollisionRange = 25.00
              Else - Actions
                Set VariableSet HJ_CollisionRange = 10.00
          Else - Actions
            Set VariableSet HJ_CollisionRange = 50.00
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        HJ_SoulMotionEffectChance Equal to 0
      Then - Actions
        Set VariableSet HJ_SoulMotionEffectChance = -1
      Else - Actions
    -------- Initialize Calculations --------
    For each (Integer HJ_CustomInteger) from 1 to HJ_AbilityMaxLevel, do (Actions)
      Loop - Actions
        Set VariableSet HJ_CustomReal[HJ_CustomInteger] = (360.00 / (Real(HJ_RadiusEffectCount[HJ_CustomInteger])))
        Set VariableSet HJ_CustomRealMin[HJ_CustomInteger] = (HJ_Radius[HJ_CustomInteger] / 1.50)
        Set VariableSet HJ_CustomRealMax[HJ_CustomInteger] = (HJ_Radius[HJ_CustomInteger] x 2.50)
    Set VariableSet HJ_PropWindow[0] = 0.00
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- END OF SPELL CONFIGURATION FIELD --------
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
Heavens Justice Execution
  Events
    Unit - A unit Starts the effect of an ability
  Conditions
    (Ability being cast) Equal to HJ_Ability
  Actions
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
    -------- declaration of locals --------
    Custom script: local real X = GetSpellTargetX( )
    Custom script: local real Y = GetSpellTargetY( )
    Custom script: local real spawnX
    Custom script: local real spawnY
    Custom script: local real pickedX
    Custom script: local real pickedY
    Custom script: local real soulX
    Custom script: local real soulY
    Custom script: local real destinationX
    Custom script: local real destinationY
    Custom script: local integer i = 0
    -------- --------
    -------- [ 0 ] = temporary array value before index declares. --------
    Set VariableSet HJ_Caster[0] = (Triggering unit)
    Set VariableSet HJ_Level[0] = (Level of HJ_Ability for HJ_Caster[0])
    -------- --------
    Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_Effect[ 10 ], udg_HJ_Caster[ 0 ], udg_HJ_CasterEffectAttach ) )
    -------- --------
    -------- Radius Creation --------
    -------- --------
    For each (Integer HJ_CustomInteger) from 1 to HJ_RadiusEffectCount[HJ_Level[0]], do (Actions)
      Loop - Actions
        -------- --------
        Set VariableSet HJ_RadiusEffectAngle = (HJ_RadiusEffectAngle + HJ_CustomReal[HJ_Level[0]])
        Custom script: set spawnX= X + udg_HJ_Radius[ udg_HJ_Level[ 0 ] ] * Cos( udg_HJ_RadiusEffectAngle * bj_DEGTORAD )
        Custom script: set spawnY= Y + udg_HJ_Radius[ udg_HJ_Level[ 0 ] ] * Sin ( udg_HJ_RadiusEffectAngle * bj_DEGTORAD )
        Custom script: set udg_HJ_Unit = CreateUnit( GetTriggerPlayer( ), udg_HJ_DummyType, spawnX, spawnY, Atan2( Y - spawnY , X - spawnX ) * bj_RADTODEG )
        Custom script: call SetUnitAnimationByIndex( udg_HJ_Unit, udg_HJ_Pitch )
        Custom script: if i == 0 then
        Custom script: set i = i + 1
        Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_Effect[ 1 ], udg_HJ_Unit, udg_HJ_SpawnEffectAttach ) )
        Custom script: elseif i == 1 then
        Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_Effect[ 0 ], udg_HJ_Unit, udg_HJ_SpawnEffectAttach ) )
        Custom script: set i = 0
        Custom script: endif
        -------- --------
        Unit - Kill HJ_Unit
    -------- --------
    -------- Souls Creation --------
    -------- --------
    Custom script: call GroupEnumUnitsInRange( bj_lastCreatedGroup, X , Y , udg_HJ_Radius[ udg_HJ_Level[ 0 ] ], null )
    Custom script: loop
    Custom script: set udg_HJ_PickedUnit = FirstOfGroup( bj_lastCreatedGroup )
    Custom script: exitwhen udg_HJ_PickedUnit == null
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Owner of HJ_PickedUnit) Not equal to Neutral Passive
        (HJ_PickedUnit is dead) Equal to False
        Or - Any (Conditions) are true
          Conditions
            (HJ_PickedUnit is A flying unit) Equal to False
            HJ_FilterFlying Equal to True
        Or - Any (Conditions) are true
          Conditions
            (HJ_PickedUnit is A ground unit) Equal to False
            HJ_FilterGround Equal to True
        Or - Any (Conditions) are true
          Conditions
            (HJ_PickedUnit is A structure) Equal to False
            HJ_FilterStructure Equal to True
        Or - Any (Conditions) are true
          Conditions
            (HJ_PickedUnit is Mechanical) Equal to False
            HJ_FilterMechanical Equal to True
        Or - Any (Conditions) are true
          Conditions
            (HJ_PickedUnit is Magic Immune) Equal to False
            HJ_FilterMagicImmune Equal to True
        HJ_PickedUnit Not equal to HJ_Caster[0]
        (HJ_PickedUnit is in HJ_Group.) Equal to False
      Then - Actions
        -------- --------
        Custom script: set udg_HJ_ID = GetUnitUserData( udg_HJ_PickedUnit )
        -------- --------
        Set VariableSet HJ_Caster[HJ_ID] = HJ_Caster[0]
        Set VariableSet HJ_CasterPlayer[HJ_ID] = (Owner of HJ_Caster[HJ_ID])
        Set VariableSet HJ_Level[HJ_ID] = HJ_Level[0]
        Set VariableSet HJ_JudgeDurationCounter[HJ_ID] = 0.00
        -------- --------
        Custom script: set pickedX = GetWidgetX( udg_HJ_PickedUnit )
        Custom script: set pickedY = GetWidgetY( udg_HJ_PickedUnit )
        Custom script: set spawnX = Atan2( pickedY-Y , pickedX-X ) * bj_RADTODEG
        -------- --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (HJ_PickedUnit belongs to an enemy of HJ_CasterPlayer[HJ_ID].) Equal to False
          Then - Actions
            -------- --------
            -------- Friendly Souls --------
            -------- --------
            Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_Effect[ 4 ], udg_HJ_PickedUnit, udg_HJ_SoulFriendlyExitAttach ) )
            Custom script: set udg_HJ_FriendlySoulUnit[ udg_HJ_ID ] = CreateUnit( udg_HJ_CasterPlayer[ udg_HJ_ID ], udg_HJ_DummyType, pickedX, pickedY, spawnX )
            Custom script: set udg_HJ_FriendlySoulModelHandler[ udg_HJ_ID ] = AddSpecialEffectTarget( udg_HJ_Effect[ 4 ], udg_HJ_FriendlySoulUnit[ udg_HJ_ID ], udg_HJ_SoulFriendlyModelAttach )
            Custom script: call SetUnitScale( udg_HJ_FriendlySoulUnit[ udg_HJ_ID ], udg_HJ_SoulSize[ udg_HJ_Level[ 0 ] ], 0, 0 )
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (HJ_PickedUnit is A flying unit) Equal to True
              Then - Actions
                Set VariableSet HJ_ReturnHeightCalculation[HJ_ID] = (HJ_SoulMaxHeight[HJ_Level[0]] + (HJ_SoulInitialHeight[HJ_Level[0]] + (Current flying height of HJ_PickedUnit)))
                Custom script: call SetUnitFlyHeight( udg_HJ_FriendlySoulUnit[ udg_HJ_ID ], GetUnitFlyHeight( udg_HJ_PickedUnit ) + udg_HJ_SoulInitialHeight[ udg_HJ_Level[ 0 ] ], 0 )
              Else - Actions
                Set VariableSet HJ_ReturnHeightCalculation[HJ_ID] = HJ_SoulMaxHeight[HJ_Level[0]]
                Custom script: call SetUnitFlyHeight( udg_HJ_FriendlySoulUnit[ udg_HJ_ID ], udg_HJ_SoulInitialHeight[ udg_HJ_Level[ 0 ] ], 0 )
            -------- --------
            Custom script: set soulX = GetUnitX( udg_HJ_FriendlySoulUnit[ udg_HJ_ID ] )
            Custom script: set soulY = GetUnitY( udg_HJ_FriendlySoulUnit[ udg_HJ_ID ] )
            -------- --------
          Else - Actions
            -------- --------
            -------- Enemy Souls --------
            -------- --------
            Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_Effect[ 5 ], udg_HJ_PickedUnit, udg_HJ_SoulEnemyExitAttach ) )
            Custom script: set udg_HJ_EnemySoulUnit[ udg_HJ_ID ] = CreateUnit( udg_HJ_CasterPlayer[ udg_HJ_ID ], udg_HJ_DummyType, pickedX, pickedY, spawnX )
            Custom script: set udg_HJ_EnemySoulModelHandler[ udg_HJ_ID ] = AddSpecialEffectTarget( udg_HJ_Effect[ 5 ], udg_HJ_EnemySoulUnit[ udg_HJ_ID ], udg_HJ_SoulEnemyModelAttach )
            Custom script: call SetUnitScale( udg_HJ_EnemySoulUnit[ udg_HJ_ID ], udg_HJ_SoulSize[ udg_HJ_Level[ 0 ] ], 0, 0 )
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (HJ_PickedUnit is A flying unit) Equal to True
              Then - Actions
                Set VariableSet HJ_ReturnHeightCalculation[HJ_ID] = (HJ_SoulMaxHeight[HJ_Level[0]] + (HJ_SoulInitialHeight[HJ_Level[0]] + (Current flying height of HJ_PickedUnit)))
                Custom script: call SetUnitFlyHeight( udg_HJ_EnemySoulUnit[ udg_HJ_ID ], GetUnitFlyHeight( udg_HJ_PickedUnit ) + udg_HJ_SoulInitialHeight[ udg_HJ_Level[ 0 ] ], 0 )
              Else - Actions
                Set VariableSet HJ_ReturnHeightCalculation[HJ_ID] = HJ_SoulMaxHeight[HJ_Level[0]]
                Custom script: call SetUnitFlyHeight( udg_HJ_EnemySoulUnit[ udg_HJ_ID ], udg_HJ_SoulInitialHeight[ udg_HJ_Level[ 0 ] ], 0 )
            -------- --------
            Custom script: set soulX = GetUnitX( udg_HJ_EnemySoulUnit[ udg_HJ_ID ] )
            Custom script: set soulY = GetUnitY( udg_HJ_EnemySoulUnit[ udg_HJ_ID ] )
            -------- --------
        -------- --------
        Set VariableSet HJ_LevitateSpeedCalculation[HJ_ID] = (HJ_ReturnHeightCalculation[HJ_ID] / (HJ_SoulLevitateTime[HJ_Level[0]] / HJ_PeriodicInterval))
        Set VariableSet HJ_LevitateReal[HJ_ID] = HJ_LevitateSpeedCalculation[HJ_ID]
        -------- --------
        -------- Travel Boolean --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            HJ_SoulLevitateTravel[HJ_Level[0]] Equal to True
          Then - Actions
            Set VariableSet HJ_SoulLevitateTravelAngle[HJ_ID] = (Random angle)
            Custom script: set destinationX = soulX + GetRandomReal( udg_HJ_CustomRealMin[ udg_HJ_Level[ 0 ] ], udg_HJ_CustomRealMax[ udg_HJ_Level[ 0 ] ] ) * Cos( udg_HJ_SoulLevitateTravelAngle[ udg_HJ_ID ] )
            Custom script: set destinationY = soulY + GetRandomReal( udg_HJ_CustomRealMin[ udg_HJ_Level[ 0 ] ], udg_HJ_CustomRealMax[ udg_HJ_Level[ 0 ] ] ) * Sin( udg_HJ_SoulLevitateTravelAngle[ udg_HJ_ID ] )
            Custom script: set udg_HJ_SoulDistance[ udg_HJ_ID ] = SquareRoot( ( soulX - destinationX ) * ( soulX - destinationX ) + ( soulY - destinationY ) * ( soulY - destinationY ) )
            Set VariableSet HJ_TravelSpeedCalculation[HJ_ID] = (HJ_SoulDistance[HJ_ID] / (HJ_SoulLevitateTime[HJ_Level[0]] / HJ_PeriodicInterval))
            Set VariableSet HJ_SoulDistanceCounter[HJ_ID] = 0.00
          Else - Actions
        -------- --------
        -------- Pause Boolean --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            HJ_Pause[HJ_Level[0]] Equal to True
          Then - Actions
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (HJ_PickedUnit is Sleeping) Equal to True
                HJ_Wake Equal to True
              Then - Actions
                Unit - Wake up HJ_PickedUnit
              Else - Actions
            -------- --------
            Custom script: call SetUnitTurnSpeed( udg_HJ_PickedUnit, 0 )
            Custom script: set udg_HJ_PropWindow[ udg_HJ_ID ] = GetUnitPropWindow( udg_HJ_PickedUnit )
            Custom script: call SetUnitPropWindow( udg_HJ_PickedUnit, 0 )
            Custom script: if UnitAddAbility( udg_HJ_PickedUnit, udg_HJ_PauseAbility ) and IssueImmediateOrder( udg_HJ_PickedUnit, udg_HJ_PauseOrder ) then
            Custom script: endif
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (HJ_PickedUnit belongs to an enemy of HJ_CasterPlayer[HJ_ID].) Equal to True
              Then - Actions
                Custom script: set udg_HJ_PauseEnemyEffectHandler[ udg_HJ_ID ] = AddSpecialEffectTarget( udg_HJ_Effect[ 3 ], udg_HJ_PickedUnit, udg_HJ_PauseEnemyEffectAttach )
              Else - Actions
                Custom script: set udg_HJ_PauseFriendlyEffectHandler[ udg_HJ_ID ]=AddSpecialEffectTarget( udg_HJ_Effect[ 2 ], udg_HJ_PickedUnit, udg_HJ_PauseFriendlyEffectAttach )
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (HJ_PickedUnit is Polymorphed) Equal to True
              Then - Actions
                Set VariableSet HJ_UnderPolymorphed[HJ_ID] = True
              Else - Actions
            -------- --------
          Else - Actions
        -------- --------
        Set VariableSet HJ_Counter = (HJ_Counter + 1)
        Unit Group - Add HJ_PickedUnit to HJ_Group
        -------- --------
      Else - Actions
    Custom script: call GroupRemoveUnit( bj_lastCreatedGroup, udg_HJ_PickedUnit )
    Custom script: endloop
    -------- --------
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        HJ_Counter Greater than 0
      Then - Actions
        Custom script: call EnableTrigger( gg_trg_Heavens_Justice_Periodic )
      Else - Actions
    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
Heavens Justice Periodic
  Events
  Conditions
  Actions
    -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- --------
    Unit Group - Pick every unit in HJ_Group and do (Actions)
      Loop - Actions
        -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
        -------- declaration of locals --------
        Custom script: local real hostX
        Custom script: local real hostY
        Custom script: local real soulX
        Custom script: local real soulY
        Custom script: local real returnAngle
        Custom script: local real travelMotionX
        Custom script: local real travelMotionY
        Custom script: local real returnMotionX
        Custom script: local real returnMotionY
        -------- --------
        Set VariableSet HJ_Unit = (Picked unit)
        Custom script: set udg_HJ_ID = GetUnitUserData( udg_HJ_Unit )
        -------- --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
            (HJ_Unit is dead) Equal to True
          Then - Actions
            -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (HJ_Unit belongs to an enemy of HJ_CasterPlayer[HJ_ID].) Equal to True
              Then - Actions
                -------- --------
                Special Effect - Destroy HJ_EnemySoulModelHandler[HJ_ID]
                Unit - Kill HJ_EnemySoulUnit[HJ_ID]
                -------- --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    HJ_Pause[HJ_Level[HJ_ID]] Equal to True
                  Then - Actions
                    Special Effect - Destroy HJ_PauseEnemyEffectHandler[HJ_ID]
                    Unit - Remove HJ_PauseAbility from HJ_Unit
                    Custom script: call SetUnitTurnSpeed( udg_HJ_Unit, GetUnitDefaultTurnSpeed( udg_HJ_Unit ) )
                    Custom script: call SetUnitPropWindow( udg_HJ_Unit, udg_HJ_PropWindow[ udg_HJ_ID ] * bj_RADTODEG )
                  Else - Actions
                -------- --------
              Else - Actions
                -------- --------
                Special Effect - Destroy HJ_FriendlySoulModelHandler[HJ_ID]
                Unit - Kill HJ_FriendlySoulUnit[HJ_ID]
                -------- --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    HJ_Pause[HJ_Level[HJ_ID]] Equal to True
                  Then - Actions
                    Special Effect - Destroy HJ_PauseFriendlyEffectHandler[HJ_ID]
                    Unit - Remove HJ_PauseAbility from HJ_Unit
                    Custom script: call SetUnitTurnSpeed( udg_HJ_Unit, GetUnitDefaultTurnSpeed( udg_HJ_Unit ) )
                    Custom script: call SetUnitPropWindow( udg_HJ_Unit, udg_HJ_PropWindow[ udg_HJ_ID ] * bj_RADTODEG )
                  Else - Actions
                -------- --------
            -------- --------
            Set VariableSet HJ_Counter = (HJ_Counter - 1)
            Unit Group - Remove HJ_Unit from HJ_Group.
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                HJ_Counter Equal to 0
              Then - Actions
                Custom script: call DisableTrigger( GetTriggeringTrigger( ) )
              Else - Actions
            -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
          Else - Actions
            -------- --------
            -------- Update Pause Status --------
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                HJ_Pause[HJ_Level[HJ_ID]] Equal to True
              Then - Actions
                -------- --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (HJ_Unit is Polymorphed) Equal to True
                    HJ_UnderPolymorphed[HJ_ID] Equal to False
                  Then - Actions
                    -------- --------
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        (HJ_Unit belongs to an enemy of HJ_CasterPlayer[HJ_ID].) Equal to True
                      Then - Actions
                        Special Effect - Destroy HJ_PauseEnemyEffectHandler[HJ_ID]
                        Custom script: set udg_HJ_PauseEnemyEffectHandler[ udg_HJ_ID ] = AddSpecialEffectTarget( udg_HJ_Effect[ 3 ], udg_HJ_Unit, udg_HJ_PauseEnemyEffectAttach )
                      Else - Actions
                        Special Effect - Destroy HJ_PauseFriendlyEffectHandler[HJ_ID]
                        Custom script: set udg_HJ_PauseFriendlyEffectHandler[ udg_HJ_ID ] = AddSpecialEffectTarget( udg_HJ_Effect[ 2 ], udg_HJ_Unit, udg_HJ_PauseFriendlyEffectAttach )
                    -------- --------
                    Custom script: call SetUnitTurnSpeed( udg_HJ_Unit, 0 )
                    Custom script: call SetUnitPropWindow( udg_HJ_Unit, 0 )
                    Set VariableSet HJ_UnderPolymorphed[HJ_ID] = True
                    -------- --------
                  Else - Actions
                -------- --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    (Current order of HJ_Unit) Not equal to (Order(HJ_PauseOrder))
                  Then - Actions
                    Unit - Add HJ_PauseAbility to HJ_Unit
                    Custom script: call IssueImmediateOrder( udg_HJ_Unit, udg_HJ_PauseOrder )
                  Else - Actions
                    -------- --------
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        HJ_UnderPolymorphed[HJ_ID] Equal to True
                        (HJ_Unit is Polymorphed) Equal to False
                      Then - Actions
                        -------- --------
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          If - Conditions
                            (HJ_Unit belongs to an enemy of HJ_CasterPlayer[HJ_ID].) Equal to True
                          Then - Actions
                            Special Effect - Destroy HJ_PauseEnemyEffectHandler[HJ_ID]
                            Custom script: set udg_HJ_PauseEnemyEffectHandler[ udg_HJ_ID ] = AddSpecialEffectTarget( udg_HJ_Effect[ 3 ], udg_HJ_Unit, udg_HJ_PauseEnemyEffectAttach )
                          Else - Actions
                            Special Effect - Destroy HJ_PauseFriendlyEffectHandler[HJ_ID]
                            Custom script: set udg_HJ_PauseFriendlyEffectHandler[ udg_HJ_ID ] = AddSpecialEffectTarget( udg_HJ_Effect[ 2 ], udg_HJ_Unit, udg_HJ_PauseFriendlyEffectAttach )
                        -------- --------
                        Custom script: call SetUnitTurnSpeed( udg_HJ_Unit, 0 )
                        Custom script: call SetUnitPropWindow( udg_HJ_Unit, 0 )
                        Set VariableSet HJ_UnderPolymorphed[HJ_ID] = False
                        -------- --------
                      Else - Actions
                -------- --------
              Else - Actions
            -------- --------
            -------- Soul Motions Phase --------
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                (HJ_Unit belongs to an enemy of HJ_CasterPlayer[HJ_ID].) Equal to False
              Then - Actions
                Set VariableSet HJ_SoulUnit[HJ_ID] = HJ_FriendlySoulUnit[HJ_ID]
                Set VariableSet HJ_SoulMotionEffect[HJ_ID] = HJ_Effect[6]
                Set VariableSet HJ_ModelHandler[HJ_ID] = HJ_FriendlySoulModelHandler[HJ_ID]
                Set VariableSet HJ_SoulMotionEffectAttach[HJ_ID] = HJ_SoulFriendlyModelAttach
              Else - Actions
                Set VariableSet HJ_SoulUnit[HJ_ID] = HJ_EnemySoulUnit[HJ_ID]
                Set VariableSet HJ_SoulMotionEffect[HJ_ID] = HJ_Effect[7]
                Set VariableSet HJ_ModelHandler[HJ_ID] = HJ_EnemySoulModelHandler[HJ_ID]
                Set VariableSet HJ_SoulMotionEffectAttach[HJ_ID] = HJ_SoulEnemyModelAttach
            -------- --------
            Custom script: set hostX = GetWidgetX( udg_HJ_Unit )
            Custom script: set hostY = GetWidgetY( udg_HJ_Unit )
            Custom script: set soulX = GetWidgetX( udg_HJ_SoulUnit[ udg_HJ_ID ] )
            Custom script: set soulY = GetWidgetY( udg_HJ_SoulUnit[ udg_HJ_ID ] )
            -------- --------
            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              If - Conditions
                HJ_SoulDistanceCounter[HJ_ID] Less than or equal to HJ_SoulDistance[HJ_ID]
                HJ_LevitateSpeedCalculation[HJ_ID] Less than or equal to HJ_ReturnHeightCalculation[HJ_ID]
              Then - Actions
                -------- --------
                -------- Loads, Updates, Saves: LevitateSpeedCalculation --------
                Set VariableSet HJ_LevitateSpeedCalculation[HJ_ID] = (HJ_LevitateSpeedCalculation[HJ_ID] + HJ_LevitateReal[HJ_ID])
                Custom script: call SetUnitFlyHeight( udg_HJ_SoulUnit[ udg_HJ_ID ], GetUnitFlyHeight( udg_HJ_Unit ) + udg_HJ_LevitateSpeedCalculation[ udg_HJ_ID ], 0 )
                -------- --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    HJ_SoulLevitateTravel[HJ_Level[HJ_ID]] Equal to True
                  Then - Actions
                    -------- --------
                    -------- Travel Motion --------
                    -------- --------
                    Custom script: set travelMotionX = soulX + udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ] * Cos( udg_HJ_SoulLevitateTravelAngle[ udg_HJ_ID ] )
                    Custom script: set travelMotionY = soulY + udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ] * Sin( udg_HJ_SoulLevitateTravelAngle[ udg_HJ_ID ] )
                    Custom script: call SetUnitX( udg_HJ_SoulUnit[ udg_HJ_ID ], travelMotionX )
                    Custom script: call SetUnitY( udg_HJ_SoulUnit[ udg_HJ_ID ], travelMotionY )
                    -------- --------
                    -------- Loads, Updates, Saves: SoulDistanceCounter --------
                    Set VariableSet HJ_SoulDistanceCounter[HJ_ID] = (HJ_SoulDistanceCounter[HJ_ID] + HJ_TravelSpeedCalculation[HJ_ID])
                    -------- --------
                  Else - Actions
                    Custom script: call SetUnitX( udg_HJ_SoulUnit[ udg_HJ_ID ], soulX )
                    Custom script: call SetUnitY( udg_HJ_SoulUnit[ udg_HJ_ID ], soulY )
                -------- --------
              Else - Actions
                -------- --------
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  If - Conditions
                    HJ_JudgeDurationCounter[HJ_ID] Greater than or equal to HJ_JudgeDuration[HJ_Level[HJ_ID]]
                  Then - Actions
                    -------- --------
                    -------- Return Motion --------
                    -------- --------
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        HJ_SoulLevitateTravel[HJ_Level[HJ_ID]] Equal to False
                      Then - Actions
                        Custom script: call SetUnitX( udg_HJ_SoulUnit[ udg_HJ_ID ], hostX )
                        Custom script: call SetUnitY( udg_HJ_SoulUnit[ udg_HJ_ID ], hostY )
                      Else - Actions
                    -------- --------
                    -------- Loads, Updates, Saves: ReturnHeightCalculation --------
                    Set VariableSet HJ_ReturnHeightCalculation[HJ_ID] = (HJ_ReturnHeightCalculation[HJ_ID] - HJ_LevitateReal[HJ_ID])
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        (Current flying height of HJ_SoulUnit[HJ_ID]) Greater than or equal to ((Current flying height of HJ_Unit) + HJ_SoulInitialHeight[HJ_Level[HJ_ID]])
                      Then - Actions
                        Custom script: call SetUnitFlyHeight( udg_HJ_SoulUnit[ udg_HJ_ID ], GetUnitFlyHeight( udg_HJ_Unit ) + udg_HJ_ReturnHeightCalculation[ udg_HJ_ID ], 0 )
                      Else - Actions
                    -------- --------
                    Custom script: if IsUnitInRangeXY( udg_HJ_SoulUnit[ udg_HJ_ID ], hostX, hostY, udg_HJ_CollisionRange ) then
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        (Current flying height of HJ_SoulUnit[HJ_ID]) Less than or equal to ((Current flying height of HJ_Unit) + HJ_SoulInitialHeight[HJ_Level[HJ_ID]])
                      Then - Actions
                        -------- --------
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          If - Conditions
                            (HJ_Unit belongs to an enemy of HJ_CasterPlayer[HJ_ID].) Equal to True
                          Then - Actions
                            -------- --------
                            Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_Effect[ 9 ], udg_HJ_Unit, udg_HJ_SoulReturnDamageAttach ) )
                            Unit - Cause HJ_Caster[HJ_ID] to damage HJ_Unit, dealing HJ_SoulDamage[HJ_Level[HJ_ID]] damage of attack type HJ_AttackType and damage type HJ_DamageType
                            -------- --------
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              If - Conditions
                                HJ_Pause[HJ_Level[HJ_ID]] Equal to True
                              Then - Actions
                                Special Effect - Destroy HJ_PauseEnemyEffectHandler[HJ_ID]
                                Unit - Remove HJ_PauseAbility from HJ_Unit
                                Custom script: call SetUnitTurnSpeed( udg_HJ_Unit, GetUnitDefaultTurnSpeed( udg_HJ_Unit ) )
                                Custom script: call SetUnitPropWindow( udg_HJ_Unit, udg_HJ_PropWindow[ udg_HJ_ID ] * bj_RADTODEG )
                              Else - Actions
                          Else - Actions
                            -------- --------
                            Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_Effect[ 8 ], udg_HJ_Unit, udg_HJ_SoulReturnHealAttach ) )
                            Unit - Set life of HJ_Unit to ((Life of HJ_Unit) + HJ_SoulHeal[HJ_Level[HJ_ID]])
                            -------- --------
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              If - Conditions
                                HJ_Pause[HJ_Level[HJ_ID]] Equal to True
                              Then - Actions
                                Special Effect - Destroy HJ_PauseFriendlyEffectHandler[HJ_ID]
                                Unit - Remove HJ_PauseAbility from HJ_Unit
                                Custom script: call SetUnitTurnSpeed( udg_HJ_Unit, GetUnitDefaultTurnSpeed( udg_HJ_Unit ) )
                                Custom script: call SetUnitPropWindow( udg_HJ_Unit, udg_HJ_PropWindow[ udg_HJ_ID ] * bj_RADTODEG )
                              Else - Actions
                        -------- --------
                        Special Effect - Destroy HJ_ModelHandler[HJ_ID]
                        Unit - Kill HJ_SoulUnit[HJ_ID]
                        -------- --------
                        Set VariableSet HJ_Counter = (HJ_Counter - 1)
                        Unit Group - Remove HJ_Unit from HJ_Group.
                        -------- --------
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          If - Conditions
                            HJ_Counter Equal to 0
                          Then - Actions
                            Custom script: call DisableTrigger( GetTriggeringTrigger( ) )
                          Else - Actions
                        -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
                      Else - Actions
                    -------- --------
                    Custom script: elseif ( udg_HJ_SoulLevitateTravel[udg_HJ_Level[udg_HJ_ID]] == true ) then
                    -------- --------
                    -------- the values are strictly constant --------
                    Custom script: set returnAngle = Atan2 ( hostY - soulY , hostX - soulX )
                    -------- --------
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        HJ_Pause[HJ_Level[HJ_ID]] Equal to False
                        (Current flying height of HJ_SoulUnit[HJ_ID]) Less than or equal to (HJ_SoulInitialHeight[HJ_Level[HJ_ID]] + (2.00 x (Current flying height of HJ_Unit)))
                        HJ_ReturnHeightCalculation[HJ_ID] Less than or equal to (Current flying height of HJ_SoulUnit[HJ_ID])
                      Then - Actions
                        -------- --------
                        Custom script: if not IsUnitInRangeXY( udg_HJ_SoulUnit[ udg_HJ_ID ], hostX, hostY, udg_HJ_CollisionRange ) then
                        Custom script: set returnMotionX = soulX + (udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ]+(udg_HJ_CollisionRange/2.5)) * Cos( returnAngle )
                        Custom script: set returnMotionY = soulY + (udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ]+(udg_HJ_CollisionRange/2.5)) * Sin ( returnAngle )
                        Custom script: else
                        Custom script: set returnMotionX = soulX + (udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ]/0.25) * Cos( returnAngle )
                        Custom script: set returnMotionY = soulY + (udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ]/0.25) * Sin ( returnAngle )
                        Custom script: endif
                        -------- --------
                      Else - Actions
                        Custom script: set returnMotionX = soulX + (udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ]) * Cos( returnAngle )
                        Custom script: set returnMotionY = soulY + (udg_HJ_TravelSpeedCalculation[ udg_HJ_ID ]) * Sin ( returnAngle )
                    -------- --------
                    Custom script: call SetUnitX( udg_HJ_SoulUnit[ udg_HJ_ID ], returnMotionX )
                    Custom script: call SetUnitY( udg_HJ_SoulUnit[ udg_HJ_ID ], returnMotionY )
                    Custom script: endif
                    -------- ---------------------------------------------------------------------------------------------------------------------------------------- --------
                  Else - Actions
                    -------- --------
                    -------- Loads, Updates, Saves: JudgeDurationCounter --------
                    Set VariableSet HJ_JudgeDurationCounter[HJ_ID] = (HJ_JudgeDurationCounter[HJ_ID] + HJ_PeriodicInterval)
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      If - Conditions
                        HJ_SoulLevitateTravel[HJ_Level[HJ_ID]] Equal to False
                      Then - Actions
                        Custom script: call SetUnitX( udg_HJ_SoulUnit[ udg_HJ_ID ], hostX )
                        Custom script: call SetUnitY( udg_HJ_SoulUnit[ udg_HJ_ID ], hostY )
                      Else - Actions
                    -------- --------
            -------- --------
            Custom script: if udg_HJ_SoulMotionEffectChance >= GetRandomReal( 0 , 100 ) then
            Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_HJ_SoulMotionEffect[ udg_HJ_ID ], udg_HJ_SoulUnit[ udg_HJ_ID ], udg_HJ_SoulMotionEffectAttach[ udg_HJ_ID ] ) )
            Custom script: endif
            -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- --------