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

Dark Portal v1.5

Warning:This spell has a long code,so dont be confused!

Tooltip
Summons a portal at a targeted point which is linked to the river of souls.After 2 seconds,the portal will release a random number of souls every 0.20 secs scattered around the portal,dealing damage when it drops to the ground.Portal lasts for a few seconds.
|cffffcc00Level 1|r - 1-3 souls,deals 10 damage,lasts for 14 seconds.
|cffffcc00Level 2|r - 2-4 souls,deals 17.5 damage,lasts for 19 seconds.
|cffffcc00Level 3|r - 3-5 souls,deals 25 damage,lasts for 24 seconds.
[trigger=Init]DP SetUp
Events
Map initialization
Conditions
Actions
Custom script: set udg_DP_Hash = InitHashtable()
-------- Configuration --------
-------- Determines the time for the portal to grow --------
Set DP_PortalGrow = 1.00
-------- Determines the max size the portal can grow --------
Set DP_MaxSize = 300.00
-------- Determines the size interval --------
Set DP_SizeInterval = (DP_MaxSize x 0.03)
-------- Determines the number of AoE Indicator is created after the portal grows --------
Set DP_Sides = 12
-------- Determines the distance between each AoE --------
Set DP_Angles = (360.00 / (Real(DP_Sides)))
-------- Determines the max height the AoEs can go --------
Set DP_AoEMaxHeightX = 0.75
-------- Determines the AoE of the portal --------
Set DP_Radius = 500.00
-------- Determines the speed of the AoEs outwarding --------
Set DP_AoESpeed = ((DP_Radius x 0.50) x 0.03)
-------- Determines the spinning speed of the AoEs --------
Set DP_AoEOrbitSpeed[1] = 180.00
Set DP_AoEOrbitSpeed[2] = (DP_AoEOrbitSpeed[1] x 0.03)
-------- Determines the Lightning model attached to each AoEs --------
Set DP_LModel = CLPB
-------- (Chain Lightning - Primary) --------
-------- Determines the coloration of the lightning --------
Set DP_Red = 1.00
Set DP_Green = 0.00
Set DP_Blue = 1.00
-------- Determines the souls release interval --------
Set DP_Interval = 0.20
-------- Determines the soul number hex --------
Set DP_SoulMin[1] = 1
Set DP_SoulMax[1] = 3
Set DP_SoulMin[2] = 2
Set DP_SoulMax[2] = 4
Set DP_SoulMin[3] = 3
Set DP_SoulMax[3] = 5
-------- Determines the distance hex --------
Set DP_DistanceMin = 0.00
Set DP_DistanceMax = DP_Radius
-------- Determines the arc hex --------
Set DP_ArcMin = 0.75
Set DP_ArcMax = 1.00
-------- Determines the damage dealt by the souls --------
Set DP_SoulDamage[1] = 10.00
Set DP_SoulDamage[2] = 17.50
Set DP_SoulDamage[3] = 25.00
-------- Detemines the duration of the portal effect --------
Set DP_PortalDurationGeneral[1] = 10.00
Set DP_PortalDurationGeneral[2] = 15.00
Set DP_PortalDurationGeneral[3] = 20.00
-------- Determines the Duration of the portal --------
Set DP_PortalDuration[1] = (DP_PortalDurationGeneral[1] + (DP_PortalGrow + 3.00))
Set DP_PortalDuration[2] = (DP_PortalDurationGeneral[2] + (DP_PortalGrow + 3.00))
Set DP_PortalDuration[3] = (DP_PortalDurationGeneral[3] + (DP_PortalGrow + 3.00))
-------- Determines the SFX when the portal dies --------
Set DP_PortalDeathSFx = Objects\Spawnmodels\Undead\UCancelDeath\UCancelDeath.mdl
-------- Determines the SFX when the souls explode --------
Set DP_SoulSFX = Objects\Spawnmodels\Undead\UndeadDissipate\UndeadDissipate.mdl
[/trigger][trigger=Cast]DP Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Dark Portal
Actions
-------- Variables --------
Set DP_Caster = (Triggering unit)
Set DP_TargetLoc = (Target point of ability being cast)
Set DP_Owner = (Triggering player)
Set DP_Levels = (Level of Dark Portal for DP_Caster)
-------- Creating Portal --------
Unit - Create 1 DP Main for DP_Owner at DP_TargetLoc facing Default building facing degrees
Set DP_Portal = (Last created unit)
Custom script: set udg_DP_PortalKey = GetHandleId(udg_DP_Portal)
-------- Adding Duration --------
Unit - Add a DP_PortalDuration[DP_Levels] second Generic expiration timer to DP_Portal
Set DP_Timer = 0.00
Set DP_Stage = 1
-------- Saving Variables --------
Hashtable - Save DP_Timer as 0 of DP_PortalKey in DP_Hash
Hashtable - Save DP_Levels as 1 of DP_PortalKey in DP_Hash
Hashtable - Save Handle OfDP_Owner as 2 of DP_PortalKey in DP_Hash
Hashtable - Save DP_Stage as 3 of DP_PortalKey in DP_Hash
-------- Starting Loop --------
Unit Group - Add DP_Portal to DP_PortalGroup
-------- Cleaning Leaks --------
Custom script: call RemoveLocation(udg_DP_TargetLoc)
[/trigger][trigger=Loop]DP Loop
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in DP_PortalGroup and do (Actions)
Loop - Actions
Set DP_U = (Picked unit)
Custom script: set udg_DP_UKey = GetHandleId(udg_DP_U)
-------- Loading --------
Set DP_Timer = (Load 0 of DP_UKey from DP_Hash)
Set DP_Levels = (Load 1 of DP_UKey from DP_Hash)
Set DP_Owner = (Load 2 of DP_UKey in DP_Hash)
Set DP_Stage = (Load 3 of DP_UKey from DP_Hash)
Set DP_ULoc = (Position of DP_U)
-------- Checking --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(DP_U is alive) Equal to True
Then - Actions
-------- Stage 1 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Stage Equal to 1
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Timer Less than DP_PortalGrow
Then - Actions
Set DP_CurrentSize = (Load 4 of DP_UKey from DP_Hash)
-------- Changing Size --------
Animation - Change DP_U's size to (DP_CurrentSize%, 0.00%, 0.00%) of its original size
-------- Saving --------
Hashtable - Save (DP_CurrentSize + DP_SizeInterval) as 4 of DP_UKey in DP_Hash
Else - Actions
-------- Going to Stage 2 --------
Hashtable - Save 2 as 3 of DP_UKey in DP_Hash
Else - Actions
-------- Stage 2 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Stage Equal to 2
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Timer Greater than 2.00
Then - Actions
-------- Creating AoEs --------
For each (Integer DP_TempInteger) from 1 to DP_Sides, do (Actions)
Loop - Actions
Unit - Create 1 DP AoE for DP_Owner at DP_ULoc facing Default building facing degrees
Set DP_AoEs = (Last created unit)
Custom script: set udg_DP_AoEKey = GetHandleId(udg_DP_AoEs)
-------- Creating Lightning Coordinates --------
Custom script: set udg_DP_UX = GetUnitX(udg_DP_U)
Custom script: set udg_DP_UY = GetUnitY(udg_DP_U)
Custom script: set udg_DP_UZ = GetUnitFlyHeight(udg_DP_U) + 75
Custom script: set udg_DP_AoEX = GetUnitX(udg_DP_AoEs)
Custom script: set udg_DP_AoEY = GetUnitY(udg_DP_AoEs)
Custom script: set udg_DP_AoEZ = GetUnitFlyHeight(udg_DP_AoEs) + 25
-------- Creating Lightning --------
Custom script: set udg_DP_Lightning = AddLightningEx(udg_DP_LModel,true,udg_DP_UX,udg_DP_UY,udg_DP_UZ,udg_DP_AoEX,udg_DP_AoEY,udg_DP_AoEZ)
Lightning - Change color of DP_Lightning to (DP_Red DP_Green DP_Blue) with 1.00 alpha
-------- Setting Variables --------
Set DP_AoEStage = 1
Set DP_AoEAngle = ((Real(DP_TempInteger)) x DP_Angles)
Set DP_MaxHeight = (DP_Radius x DP_AoEMaxHeightX)
Set DP_CurrentHeight = 0.00
Set DP_AoETimer = 2.00
-------- Saving Variables --------
Hashtable - Save DP_AoEStage as 1 of DP_AoEKey in DP_Hash
Hashtable - Save DP_AoEAngle as 2 of DP_AoEKey in DP_Hash
Hashtable - Save DP_MaxHeight as 3 of DP_AoEKey in DP_Hash
Hashtable - Save DP_CurrentHeight as 4 of DP_AoEKey in DP_Hash
Hashtable - Save Handle OfDP_Lightning as 5 of DP_AoEKey in DP_Hash
Hashtable - Save DP_AoETimer as 6 of DP_AoEKey in DP_Hash
Hashtable - Save Handle OfDP_U as 7 of DP_AoEKey in DP_Hash
Hashtable - Save DP_Levels as 8 of DP_AoEKey in DP_Hash
-------- Starting Loop --------
Unit Group - Add (Last created unit) to DP_AoEGroup
-------- Going to Stage 3 --------
Hashtable - Save 3 as 3 of DP_UKey in DP_Hash
Else - Actions
Else - Actions
-------- Stage 3 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Stage Equal to 3
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Timer Less than DP_PortalDurationGeneral[DP_Levels]
Then - Actions
Set DP_Intervals = (Load 5 of DP_UKey from DP_Hash)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Intervals Greater than DP_Interval
Then - Actions
-------- Creating Souls --------
Set DP_SoulHex = (Random integer number between DP_SoulMin[DP_Levels] and DP_SoulMax[DP_Levels])
For each (Integer DP_TempInteger) from 1 to DP_SoulHex, do (Actions)
Loop - Actions
Unit - Create 1 DP Missile for DP_Owner at DP_ULoc facing (Random angle) degrees
Set DP_Soul = (Last created unit)
Custom script: set udg_DP_MissileKey = GetHandleId(udg_DP_Soul)
-------- Setting Variables --------
Set DP_DistanceHex = (Random real number between DP_DistanceMin and DP_DistanceMax)
Set DP_ArcHex = (Random real number between DP_ArcMin and DP_ArcMax)
Set DP_MissileDistance = DP_DistanceHex
Set DP_Arc = (DP_MissileDistance x 0.50)
Set DP_MissileHeight = 0.00
Set DP_MissileTravelled = 0.00
-------- Saving Variables --------
Hashtable - Save DP_MissileDistance as 1 of DP_MissileKey in DP_Hash
Hashtable - Save DP_Arc as 2 of DP_MissileKey in DP_Hash
Hashtable - Save DP_MissileHeight as 3 of DP_MissileKey in DP_Hash
Hashtable - Save DP_Levels as 4 of DP_MissileKey in DP_Hash
Hashtable - Save DP_MissileTravelled as 5 of DP_MissileKey in DP_Hash
-------- Starting Loop --------
Unit Group - Add (Last created unit) to DP_SoulGroup
-------- Saving --------
Hashtable - Save (DP_Intervals x 0.00) as 5 of DP_UKey in DP_Hash
Else - Actions
Hashtable - Save (DP_Intervals + 0.03) as 5 of DP_UKey in DP_Hash
Else - Actions
-------- Going to Stage 4 --------
Hashtable - Save 4 as 3 of DP_UKey in DP_Hash
Else - Actions
-------- Stage 4 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Stage Equal to 4
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_Timer Less than DP_PortalDuration[DP_Levels]
Then - Actions
Set DP_CurrentSize = (Load 4 of DP_UKey from DP_Hash)
-------- Changing Size --------
Animation - Change DP_U's size to (DP_CurrentSize%, 0.00%, 0.00%) of its original size
-------- Saving --------
Hashtable - Save (DP_CurrentSize - DP_SizeInterval) as 4 of DP_UKey in DP_Hash
Else - Actions
Else - Actions
Hashtable - Save (DP_Timer + 0.03) as 0 of DP_UKey in DP_Hash
Else - Actions
Hashtable - Clear all child hashtables of child DP_UKey in DP_Hash
Unit - Remove DP_U from the game
Unit Group - Remove DP_U from DP_PortalGroup
Special Effect - Create a special effect at DP_ULoc using DP_PortalDeathSFx
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation(udg_DP_ULoc)
Unit Group - Pick every unit in DP_AoEGroup and do (Actions)
Loop - Actions
Set DP_AoETemp = (Picked unit)
Custom script: set udg_DP_AoETempKey = GetHandleId(udg_DP_AoETemp)
-------- Load --------
Set DP_AoEStage = (Load 1 of DP_AoETempKey from DP_Hash)
Set DP_AoEAngle = (Load 2 of DP_AoETempKey from DP_Hash)
Set DP_Lightning = (Load 5 of DP_AoETempKey in DP_Hash)
Set DP_AoETimer = (Load 6 of DP_AoETempKey from DP_Hash)
Set DP_U = (Load 7 of DP_AoETempKey in DP_Hash)
Set DP_TempLoc = (Position of DP_AoETemp)
Set DP_MaxHeight = (Load 3 of DP_AoETempKey from DP_Hash)
Set DP_CurrentHeight = (Load 4 of DP_AoETempKey from DP_Hash)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_AoETimer Less than DP_PortalDuration[DP_Levels]
Then - Actions
Set DP_AoELoc = (Position of DP_U)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_AoETimer Less than DP_PortalDurationGeneral[DP_Levels]
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_AoEStage Equal to 3
Then - Actions
Set DP_AoEOffset = (DP_AoELoc offset by DP_Radius towards DP_AoEAngle degrees)
Else - Actions
Set DP_AoEOffset = (DP_AoELoc offset by ((Distance between DP_AoELoc and DP_TempLoc) + DP_AoESpeed) towards DP_AoEAngle degrees)
Else - Actions
Set DP_AoEOffset = (DP_AoELoc offset by ((Distance between DP_AoELoc and DP_TempLoc) - DP_AoEOrbitSpeed[2]) towards DP_AoEAngle degrees)
-------- Moving Unit --------
Unit - Move DP_AoETemp instantly to DP_AoEOffset
-------- Moving Lightning --------
Custom script: set udg_DP_UX = GetUnitX(udg_DP_U)
Custom script: set udg_DP_UY = GetUnitY(udg_DP_U)
Custom script: set udg_DP_UZ = GetUnitFlyHeight(udg_DP_U) + 50
Custom script: set udg_DP_AoEX = GetUnitX(udg_DP_AoETemp)
Custom script: set udg_DP_AoEY = GetUnitY(udg_DP_AoETemp)
Custom script: set udg_DP_AoEZ = GetUnitFlyHeight(udg_DP_AoETemp) + 25
-------- Moving --------
Custom script: call MoveLightningEx(udg_DP_Lightning,true,udg_DP_UX,udg_DP_UY,udg_DP_UZ,udg_DP_AoEX,udg_DP_AoEY,udg_DP_AoEZ)
-------- Stage 1 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_AoEStage Equal to 1
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_CurrentHeight Less than DP_MaxHeight
Then - Actions
-------- Changing Height --------
Animation - Change DP_AoETemp flying height to DP_CurrentHeight at 0.00
-------- Saving --------
Hashtable - Save (DP_CurrentHeight + (DP_MaxHeight x 0.03)) as 4 of DP_AoETempKey in DP_Hash
Else - Actions
-------- Going to Stage 2 --------
Hashtable - Save 2 as 1 of DP_AoETempKey in DP_Hash
Else - Actions
-------- Stage 2 --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_AoEStage Equal to 2
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_CurrentHeight Greater than 0.00
Then - Actions
-------- Changing Height --------
Animation - Change DP_AoETemp flying height to DP_CurrentHeight at 0.00
-------- Saving --------
Hashtable - Save (DP_CurrentHeight - (DP_MaxHeight x 0.03)) as 4 of DP_AoETempKey in DP_Hash
Else - Actions
-------- Going to Stage 2 --------
Hashtable - Save 3 as 1 of DP_AoETempKey in DP_Hash
Else - Actions
Hashtable - Save (DP_AoEAngle + DP_AoEOrbitSpeed[2]) as 2 of DP_AoETempKey in DP_Hash
Hashtable - Save (DP_AoETimer + 0.03) as 6 of DP_AoETempKey in DP_Hash
-------- Clean Leak --------
Custom script: call RemoveLocation(udg_DP_AoELoc)
Custom script: call RemoveLocation(udg_DP_AoEOffset)
Else - Actions
Unit - Kill DP_AoETemp
Unit - Remove DP_AoETemp from the game
Lightning - Destroy DP_Lightning
Hashtable - Clear all child hashtables of child DP_AoETempKey in DP_Hash
Unit Group - Remove DP_AoETemp from DP_AoEGroup
Custom script: call RemoveLocation(udg_DP_TempLoc)
Unit Group - Pick every unit in DP_SoulGroup and do (Actions)
Loop - Actions
Set DP_MissileTemp = (Picked unit)
Custom script: set udg_DP_MissileTempKey = GetHandleId(udg_DP_MissileTemp)
-------- Load --------
Set DP_MissileDistance = (Load 1 of DP_MissileTempKey from DP_Hash)
Set DP_Arc = (Load 2 of DP_MissileTempKey from DP_Hash)
Set DP_MissileHeight = (Load 3 of DP_MissileTempKey from DP_Hash)
Set DP_Levels = (Load 4 of DP_MissileTempKey from DP_Hash)
Set DP_MissileTravelled = (Load 5 of DP_MissileTempKey from DP_Hash)
Set DP_MissileLoc = (Position of DP_MissileTemp)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
DP_MissileTravelled Less than DP_MissileDistance
Then - Actions
Set DP_MissileOffset = (DP_MissileLoc offset by ((DP_MissileDistance x 0.50) x 0.03) towards (Facing of DP_MissileTemp) degrees)
-------- Moving Unit --------
Unit - Move DP_MissileTemp instantly to DP_MissileOffset
Hashtable - Save (DP_MissileTravelled + ((DP_MissileDistance x 0.50) x 0.03)) as 5 of DP_MissileTempKey in DP_Hash
Hashtable - Save (((4.00 x DP_Arc) / DP_MissileDistance) x (((Load 5 of DP_MissileTempKey from DP_Hash) / DP_MissileDistance) x (DP_MissileDistance - (Load 5 of DP_MissileTempKey from DP_Hash)))) as 3 of DP_MissileTempKey in DP_Hash
-------- Changing Height --------
Animation - Change DP_MissileTemp flying height to (Load 3 of DP_MissileTempKey from DP_Hash) at 0.00
Custom script: call RemoveLocation(udg_DP_MissileOffset)
Else - Actions
Unit - Kill DP_MissileTemp
-------- Dealing Damage --------
Set DP_TempGroup = (Units within 75.00 of DP_MissileLoc)
Unit Group - Pick every unit in DP_TempGroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
((Picked unit) is A structure) Not equal to True
((Picked unit) is Magic Immune) Not equal to True
((Picked unit) is alive) Equal to True
((Picked unit) belongs to an enemy of (Owner of DP_MissileTemp)) Equal to True
Then - Actions
Unit - Cause DP_MissileTemp to damage (Picked unit), dealing DP_SoulDamage[DP_Levels] damage of attack type Spells and damage type Normal
Else - Actions
-------- SFX --------
Special Effect - Create a special effect at DP_MissileLoc using DP_SoulSFX
Special Effect - Destroy (Last created special effect)
-------- Clean Up --------
Custom script: call DestroyGroup(udg_DP_TempGroup)
Hashtable - Clear all child hashtables of child DP_MissileTempKey in DP_Hash
Unit - Remove DP_MissileTemp from the game
Unit Group - Remove DP_MissileTemp from DP_SoulGroup
Custom script: call RemoveLocation(udg_DP_MissileLoc)
[/trigger]

Changelogs
v1.1
-Removed Stages at Soul Group
-Fixed Missile Arc(Thanks to Tank-Commander's Formula)
-Raised Arc hex by 0.75 - 1.0 random
-Replaced new model for AoE
-Changed Portal Max Size.
v1.2
-cached units
-added custom integer
-added height for lightnings
v1.3
-As of what Mag said
v1.4
-Clean Unit Leak
-Added new SFX
v1.5
-clean sfx leak(mag didnt spot it out! :D)

Keywords:
dark,obliterate,demon,portal,chaos
Contents

Dark Portal v1.4 (Map)

Reviews
04:30, 27th Aug 2012 Magtheridon96: Approved. Outstanding work my friend.

Moderator

M

Moderator

04:30, 27th Aug 2012
Magtheridon96:

Approved.
Outstanding work my friend.
 
Level 6
Joined
Jul 1, 2010
Messages
51
help please...

Awedome spell, but i have a bit of a problem importing. The custom script for the lightning in the 'DP Loop' trigger don't seem to work- when i try to enable the trigger a script error box appears and says "Expected a variable name" next to each code line.
I changed nothing and when i remove the bugged script lines the spell works fine (although there is no lightning)

Is there anything you can do to help, please? :)
 
Level 33
Joined
Apr 24, 2012
Messages
5,113
Written in that line,make sure to create the variable missing.
Custom script: set udg_DP_UX = GetUnitX(udg_DP_U)
Custom script: set udg_DP_UY = GetUnitY(udg_DP_U)
Custom script: set udg_DP_UZ = GetUnitFlyHeight(udg_DP_U) + 75
Custom script: set udg_DP_AoEX = GetUnitX(udg_DP_AoEs)
Custom script: set udg_DP_AoEY = GetUnitY(udg_DP_AoEs)
Custom script: set udg_DP_AoEZ = GetUnitFlyHeight(udg_DP_AoEs) + 25

This is the problems right? Create the variables then.(ignore the udg_) They are all real types
 
Level 5
Joined
Jul 17, 2013
Messages
125
it doesnt work in terrain level 2 and more (above water) - purple bolts are on level 1 and black circle on level 2, so the spell looks bad

can you fix it please?
 
Top