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

Kinetic Ring v1.3

Kinetic Ring

Tooltip
Covers the caster in the ring of magnetic energies that pulls enemy units inside.If a unit inside the ring tries to escape,the unit will be pulled inside,dealing damage per second and keeping him inside the ring.If the unit is too close to the caster,the unit's mana will be burned per second.Lasts for a few seconds or until the caster is dead.
Level 1 - Deals 30 damage,burns 15 mana and lasts for 5 seconds.
Level 2 - Deals 40 damage,burns 30 mana and lasts for 7.5 seconds.
Level 3 - Deals 50 damage,burns 45 mana and lasts for 10 seconds.
Triggers
[trigger=Initialization]KR Config
Events
Map initialization
Conditions
Actions
Custom script: set udg_KR_Hash = InitHashtable()
-------- ------------------------------------------------- --------
-------- CONFIGURATION --------
-------- ------------------------------------------------- --------
-------- ------------------------------------------------- --------
-------- Determines the number of orbs --------
-------- ------------------------------------------------- --------
Set KR_OrbsNumber = 8
-------- ------------------------------------------------- --------
-------- Determines the distances per orb --------
-------- ------------------------------------------------- --------
Set KR_OrbDegrees = 45.00
-------- ------------------------------------------------- --------
-------- Determines the distance of the orbs from the caster when summoned --------
-------- ------------------------------------------------- --------
Set KR_OrbDistance = 100.00
-------- ------------------------------------------------- --------
-------- Determines the damage --------
-------- ------------------------------------------------- --------
Set KR_Damage[1] = 30.00
Set KR_Damage[2] = 40.00
Set KR_Damage[3] = 50.00
-------- ------------------------------------------------- --------
-------- Determines the mana burn --------
-------- ------------------------------------------------- --------
Set KR_ManaBurn[1] = 15.00
Set KR_ManaBurn[2] = 30.00
Set KR_ManaBurn[3] = 45.00
-------- ------------------------------------------------- --------
-------- Determines the detection radius for the unit to be pulled --------
-------- ------------------------------------------------- --------
Set KR_DetectRadius = 100.00
-------- ------------------------------------------------- --------
-------- Determines the max range of the unit can travel --------
-------- ------------------------------------------------- --------
Set KR_MaxDistance = 500.00
-------- ------------------------------------------------- --------
-------- Determines the distance for mana burn --------
-------- ------------------------------------------------- --------
Set KR_MinDistance = 150.00
-------- ------------------------------------------------- --------
-------- Determines the speed of the orb in outwarding --------
-------- ------------------------------------------------- --------
Set KR_OrbBaseSpeed = 250.00
Set KR_OrbSpeed = (KR_OrbBaseSpeed x 0.04)
-------- ------------------------------------------------- --------
-------- Determines the speed of the orb in spinning --------
-------- ------------------------------------------------- --------
Set KR_SpinSpeed = (180.00 x 0.02)
-------- ------------------------------------------------- --------
-------- Determines the time for the orb to stop outwarding --------
-------- ------------------------------------------------- --------
Set KR_MaxOrbTime = 2.00
-------- ------------------------------------------------- --------
-------- Determines the Duration of the Kinetic Ring --------
-------- ------------------------------------------------- --------
Set KR_Duration[1] = 5.00
Set KR_Duration[2] = 7.50
Set KR_Duration[3] = 10.00
-------- ------------------------------------------------- --------
-------- Determines the lightning model for the Kinetic Ring --------
-------- ------------------------------------------------- --------
Set KR_LModel = CLPB
-------- ------------------------------------------------- --------
-------- Determines the coloration of the lightning --------
-------- ------------------------------------------------- --------
Set KR_Red = 0.00
Set KR_Green = 1.00
Set KR_Blue = 1.00
-------- ------------------------------------------------- --------
-------- Determines the bonus height of lightnings --------
-------- ------------------------------------------------- --------
Set KR_LightningHeight = 75.00
-------- ------------------------------------------------- --------
-------- Determines the SFX created when the orbs are spinning --------
-------- ------------------------------------------------- --------
Set KR_OrbSFX = Abilities\Spells\Human\Feedback\ArcaneTowerAttack.mdl
-------- ------------------------------------------------- --------
-------- END OF CONFIGURATION --------
-------- ------------------------------------------------- --------
[/trigger][trigger=Cast]KR Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Kinetic Ring
Actions
-------- ------------------------------------------------- --------
-------- Variables --------
-------- ------------------------------------------------- --------
Set KR_Caster = (Triggering unit)
Custom script: set udg_KR_CasterKey = GetHandleId(udg_KR_Caster)
Set KR_CasterLoc = (Position of KR_Caster)
Set KR_Levels = (Level of Kinetic Ring for KR_Caster)
Set KR_Owner = (Triggering player)
-------- ------------------------------------------------- --------
-------- Creating Orbs --------
-------- ------------------------------------------------- --------
For each (Integer KR_TotalOrbs) from 1 to KR_OrbsNumber, do (Actions)
Loop - Actions
-------- ------------------------------------------------- --------
-------- Removing Orbs --------
-------- ------------------------------------------------- --------
Set KR_LastOrbs[KR_TotalOrbs] = (Load KR_TotalOrbs of KR_CasterKey in KR_Hash)
Unit - Kill KR_LastOrbs[KR_TotalOrbs]
-------- ------------------------------------------------- --------
-------- Creating Orb --------
-------- ------------------------------------------------- --------
Set KR_CasterOffset = (KR_CasterLoc offset by KR_OrbDistance towards ((Real(KR_TotalOrbs)) x KR_OrbDegrees) degrees)
Unit - Create 1 KR Dummy for KR_Owner at KR_CasterOffset facing Default building facing degrees
Set KR_LastOrbs[KR_TotalOrbs] = (Last created unit)
-------- ------------------------------------------------- --------
-------- Adding Duration --------
-------- ------------------------------------------------- --------
Unit - Add a KR_Duration[KR_Levels] second Generic expiration timer to KR_LastOrbs[KR_TotalOrbs]
-------- ------------------------------------------------- --------
-------- Saving Orb --------
-------- ------------------------------------------------- --------
Hashtable - Save Handle OfKR_LastOrbs[KR_TotalOrbs] as KR_TotalOrbs of KR_CasterKey in KR_Hash
-------- ------------------------------------------------- --------
-------- Clean Leak --------
-------- ------------------------------------------------- --------
Custom script: call RemoveLocation(udg_KR_CasterOffset)
-------- ------------------------------------------------- --------
-------- Saving variables for the loop --------
-------- ------------------------------------------------- --------
Set KR_CurrentDuration = 0.00
Set KR_CurrentDistance = 100.00
Hashtable - Save KR_CurrentDuration as (Key duration) of KR_CasterKey in KR_Hash
Hashtable - Save KR_Levels as (Key level) of KR_CasterKey in KR_Hash
Hashtable - Save KR_CurrentDistance as (Key distance]) of KR_CasterKey in KR_Hash
-------- ------------------------------------------------- --------
-------- Starting Loop --------
-------- ------------------------------------------------- --------
Unit Group - Add KR_Caster to KR_LoopGroup
Trigger - Turn on KR Loop <gen>
-------- ------------------------------------------------- --------
-------- Clean Leak --------
-------- ------------------------------------------------- --------
Custom script: call RemoveLocation(udg_KR_CasterLoc)
[/trigger][trigger=Loop]KR Loop
Events
Time - Every 0.04 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in KR_LoopGroup and do (Actions)
Loop - Actions
Set KR_U = (Picked unit)
Custom script: set udg_KR_UKey = GetHandleId(udg_KR_U)
-------- ------------------------------------------------- --------
-------- Load --------
-------- ------------------------------------------------- --------
Set KR_CurrentDuration = (Load (Key duration) of KR_UKey from KR_Hash)
Set KR_Levels = (Load (Key level) of KR_UKey from KR_Hash)
For each (Integer KR_TotalOrbs) from 1 to KR_OrbsNumber, do (Actions)
Loop - Actions
Set KR_LastOrbs[KR_TotalOrbs] = (Load KR_TotalOrbs of KR_UKey in KR_Hash)
Set KR_CurrentDegrees = (Load (Key degrees) of KR_UKey from KR_Hash)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
KR_CurrentDuration Less than KR_MaxOrbTime
Then - Actions
Set KR_CurrentDistance = (Load (Key distance) of KR_UKey from KR_Hash)
Else - Actions
Set KR_CurrentDistance = KR_MaxDistance
-------- ------------------------------------------------- --------
-------- Checking --------
-------- ------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
KR_CurrentDuration Less than KR_Duration[KR_Levels]
Then - Actions
-------- ------------------------------------------------- --------
-------- Checking if the caster is alive --------
-------- ------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(KR_U is alive) Equal to True
Then - Actions
-------- ------------------------------------------------- --------
-------- Starting Loop --------
-------- ------------------------------------------------- --------
Set KR_ULoc = (Position of KR_U)
-------- ------------------------------------------------- --------
-------- Moving Orbs --------
-------- ------------------------------------------------- --------
For each (Integer KR_TotalOrbs) from 1 to KR_OrbsNumber, do (Actions)
Loop - Actions
Set KR_OrbOffset = (KR_ULoc offset by KR_CurrentDistance towards (((Real(KR_TotalOrbs)) x KR_OrbDegrees) + KR_CurrentDegrees) degrees)
-------- ------------------------------------------------- --------
-------- Moving Orb --------
-------- ------------------------------------------------- --------
Unit - Move KR_LastOrbs[KR_TotalOrbs] instantly to KR_OrbOffset
Special Effect - Create a special effect at KR_OrbOffset using KR_OrbSFX
Special Effect - Destroy (Last created special effect)
-------- ------------------------------------------------- --------
-------- Clean Leak --------
-------- ------------------------------------------------- --------
Custom script: call RemoveLocation(udg_KR_OrbOffset)
-------- ------------------------------------------------- --------
-------- Destroying Lightnings --------
-------- ------------------------------------------------- --------
For each (Integer KR_Counts) from 10 to (Load (Key count) of KR_UKey from KR_Hash), do (Actions)
Loop - Actions
Lightning - Destroy (Load KR_Counts of KR_UKey in KR_Hash)
Set KR_Counts = 9
-------- ------------------------------------------------- --------
-------- Picking Units --------
-------- ------------------------------------------------- --------
Set KR_TempGroup = (Units within (KR_CurrentDistance + KR_DetectRadius) of KR_ULoc)
Unit Group - Pick every unit in KR_TempGroup and do (Actions)
Loop - Actions
Set KR_Picked = (Picked unit)
-------- ------------------------------------------------- --------
-------- Checking --------
-------- ------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(KR_Picked is A structure) Not equal to True
(KR_Picked is Magic Immune) Not equal to True
(KR_Picked is alive) Equal to True
(KR_Picked belongs to an enemy of (Owner of KR_U)) Equal to True
Then - Actions
Set KR_PickedLoc = (Position of KR_Picked)
Set KR_Distance = (Distance between KR_CasterLoc and KR_PickedLoc)
-------- ------------------------------------------------- --------
-------- Starts Counting Units --------
-------- ------------------------------------------------- --------
Set KR_Counts = (KR_Counts + 1)
-------- ------------------------------------------------- --------
-------- Variables for the Lightning --------
-------- ------------------------------------------------- --------
-------- ------------------------------------------------- --------
-------- For the Caster --------
-------- ------------------------------------------------- --------
Custom script: set udg_KR_UX = GetUnitX(udg_KR_U)
Custom script: set udg_KR_UY = GetUnitY(udg_KR_U)
Custom script: set udg_KR_UZ = GetUnitFlyHeight(udg_KR_U) + udg_KR_LightningHeight
-------- ------------------------------------------------- --------
-------- For the Picked Unit --------
-------- ------------------------------------------------- --------
Custom script: set udg_KR_PickedX = GetUnitX(udg_KR_Picked)
Custom script: set udg_KR_PickedY = GetUnitY(udg_KR_Picked)
Custom script: set udg_KR_PickedZ = GetUnitFlyHeight(udg_KR_Picked) + udg_KR_LightningHeight
-------- ------------------------------------------------- --------
-------- Creating Lightning --------
-------- ------------------------------------------------- --------
Custom script: set udg_KR_Lightning = AddLightningEx(udg_KR_LModel,true,udg_KR_UX,udg_KR_UY,udg_KR_UZ,udg_KR_PickedX,udg_KR_PickedY,udg_KR_PickedZ)
-------- ------------------------------------------------- --------
-------- Changing Color --------
-------- ------------------------------------------------- --------
Lightning - Change color of KR_Lightning to (KR_Red KR_Green KR_Blue) with 1.00 alpha
-------- ------------------------------------------------- --------
-------- Saving Lightning --------
-------- ------------------------------------------------- --------
Hashtable - Save Handle OfKR_Lightning as KR_Counts of KR_UKey in KR_Hash
-------- ------------------------------------------------- --------
-------- Checking --------
-------- ------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
KR_Distance Greater than KR_CurrentDistance
Then - Actions
-------- ------------------------------------------------- --------
-------- Starts Pulling Units --------
-------- ------------------------------------------------- --------
Set KR_PullOffset = (KR_ULoc offset by KR_CurrentDistance towards (Angle from KR_ULoc to KR_PickedLoc) degrees)
Unit - Move KR_Picked instantly to KR_PullOffset
-------- ------------------------------------------------- --------
-------- Damaging Unit --------
-------- ------------------------------------------------- --------
Unit - Cause KR_U to damage KR_Picked, dealing (KR_Damage[KR_Levels] x 0.04) damage of attack type Spells and damage type Magic
-------- ------------------------------------------------- --------
-------- Clean Leak --------
-------- ------------------------------------------------- --------
Custom script: call RemoveLocation(udg_KR_PullOffset)
Else - Actions
-------- ------------------------------------------------- --------
-------- Checking if Distance between picked unit and caster is too close --------
-------- ------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
KR_Distance Less than KR_MinDistance
Then - Actions
-------- ------------------------------------------------- --------
-------- Starts Mana Burn --------
-------- ------------------------------------------------- --------
Set KR_Mana = (Mana of KR_Picked)
Set KR_ManaBurnLoop = (KR_Mana - (KR_ManaBurn[KR_Levels] x 0.04))
Unit - Set mana of KR_Picked to KR_ManaBurnLoop
Else - Actions
-------- ------------------------------------------------- --------
-------- Clean Leak --------
-------- ------------------------------------------------- --------
Custom script: call RemoveLocation(udg_KR_PickedLoc)
Else - Actions
-------- ------------------------------------------------- --------
-------- Saving Variables --------
-------- ------------------------------------------------- --------
Hashtable - Save (KR_CurrentDegrees + KR_SpinSpeed) as (Key degrees) of KR_UKey in KR_Hash
Hashtable - Save (KR_CurrentDuration + 0.04) as (Key duration) of KR_UKey in KR_Hash
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
KR_CurrentDistance Less than KR_MaxDistance
Then - Actions
Hashtable - Save (KR_CurrentDistance + KR_OrbSpeed) as (Key distance) of KR_UKey in KR_Hash
Else - Actions
Hashtable - Save 500.00 as (Key distance) of KR_UKey in KR_Hash
Hashtable - Save KR_Counts as (Key count) of KR_UKey in KR_Hash
-------- ------------------------------------------------- --------
-------- Clean Leaks --------
-------- ------------------------------------------------- --------
Custom script: call RemoveLocation(udg_KR_ULoc)
Custom script: call DestroyGroup(udg_KR_TempGroup)
Else - Actions
-------- ------------------------------------------------- --------
-------- Clean Up --------
-------- ------------------------------------------------- --------
-------- ------------------------------------------------- --------
-------- Destroying Lightnings --------
-------- ------------------------------------------------- --------
For each (Integer KR_Counts) from 10 to (Load (Key count) of KR_UKey from KR_Hash), do (Actions)
Loop - Actions
Lightning - Destroy (Load KR_Counts of KR_UKey in KR_Hash)
Hashtable - Clear all child hashtables of child KR_UKey in KR_Hash
Unit Group - Remove KR_U from KR_LoopGroup
Else - Actions
-------- ------------------------------------------------- --------
-------- Clean Up --------
-------- ------------------------------------------------- --------
-------- ------------------------------------------------- --------
-------- Destroying Lightnings --------
-------- ------------------------------------------------- --------
For each (Integer KR_Counts) from 10 to (Load (Key count) of KR_UKey from KR_Hash), do (Actions)
Loop - Actions
Lightning - Destroy (Load KR_Counts of KR_UKey in KR_Hash)
Hashtable - Clear all child hashtables of child KR_UKey in KR_Hash
Unit Group - Remove KR_U from KR_LoopGroup
-------- ------------------------------------------------- --------
-------- Checking --------
-------- ------------------------------------------------- --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(KR_LoopGroup is empty) Equal to True
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
[/trigger]
Credits
Icon

Icon Idea and Originally made by:

IceFrog Team

Icon Made by:

ScourgeWarchief
Changelogs
Version 1.0
-Released
Version 1.1
-View Reviews of Magtheridon96
Version 1.2
-View Reviews Again
Version 1.3
-Fixed a bug that widens the area if cast twice or more.
-Now removes orbs if there are any orbs used.

Keywords:
orb,magnetic,kinetic,lightning,pull,arcane,energy,mind,telekinesis
Contents

Kinetic Ring v1.3 (Map)

Reviews
11:28, 29th Jul 2012 Magtheridon96: 4/5. This is a pretty neat spell. Like I said in the first review, you could use the values of the coordinate variables you're setting directly inside the AddLightningEx call. call...
KILLCIDE
Some global variables are strictly used in JASS scripts, so they will not be created when you import them into another map. For those getting undeclared variable errors or something similar, create the following variables and their type: Variable...

Moderator

M

Moderator

11:28, 29th Jul 2012
Magtheridon96: 4/5. This is a pretty neat spell.

  • Like I said in the first review, you could use the values of the coordinate variables you're setting directly inside the AddLightningEx call.
    call AddLightningEx(udg_KR_LModel, true, GetUnitX(...), GetUnitY(...), GetUnitFlyHeight(...), GetUnitX(...), GetUnitY(...), GetUnitFlyHeight(...))

Other than that, good job, there doesn't seem to be any major issues. You still need to fix the above issues though. Only then would it be approved.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
  • Set KR_Distance = (Distance between KR_CasterLoc and KR_PickedLoc)
The variable "KR_CasterLoc" doesn't exist in the trigger "KR_Loop", so it's just the middle of the map.

On a related note: that's a shitton of variables.
The X/Y-variables don't carry over to other maps (because the editor doesn't copy variables that are only used in JASS - or am I mistaken?) and they can just as well be removed entirely.
I always go by the rule of thumb that you never need more than 3 temporary locations, but you're using 6 of them.

Edit: there's more! You should take the Location Z into account as well, because I just had the problem that my terrain z was about -700 and the lightning effects were completely off.
Don't worry, you've got all the locations you need :D. You do need to keep the 2 Z-variables though, otherwise the custom script will be too long.
This is what I did to fix it:
  • Custom script: set udg_TempReal1 = GetUnitFlyHeight( udg_TempUnit1) + GetLocationZ( udg_TempLoc1)+75.
  • Custom script: set udg_TempReal2 = GetUnitFlyHeight( udg_TempUnit2) + GetLocationZ( udg_TempLoc2)+75.
  • Custom script: set bj_lastCreatedLightning = AddLightningEx( "AFOD", true, GetUnitX(udg_TempUnit1), GetUnitY(udg_TempUnit1), udg_TempReal1, GetUnitX(udg_TempUnit2), GetUnitY(udg_TempUnit2), udg_TempReal2 )
(You can use "bj_lastCreatedLightning in your spell as well).
Endedit


(also, I want people to start using the variable "GlobalHashtable" for all spells/systems and use a "HashtableId" which is an integer like 'KiR' - may upgrade it to 4 digits though
I do accept that it's just a silly dream and it will probably never happen, but a man can have dreams!)
 
Last edited:

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
Spells that use hashtables in general aren't properly useable when it comes to the same unit casting the spell multiple times.
That is what indexing is for.
Please... if you have no clue what you're talking about, then don't be a smartass.

Hashtables (when used right) work just as well as dynamic indexing.
 
Level 33
Joined
Apr 24, 2012
Messages
5,113
Please... if you have no clue what you're talking about, then don't be a smartass.

Hashtables (when used right) work just as well as dynamic indexing.

What he meants is that Hashtables generally use GetHandleId when it comes to an MUI spell, apparently (just like UnitIndexer) doesn't support multiple instances of spells on the same unit.

Dynamic Indexing prevents that from happening.
 

Zwiebelchen

Hosted Project GR
Level 35
Joined
Sep 17, 2009
Messages
7,236
What he meants is that Hashtables generally use GetHandleId when it comes to an MUI spell, apparently (just like UnitIndexer) doesn't support multiple instances of spells on the same unit.

Dynamic Indexing prevents that from happening.
Nobody uses GetHandleId(unit) for the parent key except in systems that have their own hashtable. Why would you do that? You usually attach your spell to a timer, which can be uniquely created and destroyed (and in 99% of cases you need a timer anyway).
 
Nobody uses GetHandleId(unit) for the parent key except in systems that have their own hashtable.
It is/was used often that the indexid or handleid of a unit serves as instance key for a spell.
And as Almia explained it won't allow the unit to have multiple instances at said spell or system.

Please... if you have no clue what you're talking about, then don't be a smartass.
Talking offensivly about this several years old post just out of nowhere... for what >.<
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Some global variables are strictly used in JASS scripts, so they will not be created when you import them into another map. For those getting undeclared variable errors or something similar, create the following variables and their type:
Variable NameType

KR_UX
Real

KR_UY
Real

KR_UZ
Real

KR_PickedX
Real

KR_PickedY
Real

KR_PickedZ
Real


I went ahead and updated the submission so that the error will no longer occur during import. You can either manually create these variables in your map, or re-import the submission with the new update.
 
Level 2
Joined
Nov 28, 2017
Messages
12
Some global variables are strictly used in JASS scripts, so they will not be created when you import them into another map. For those getting undeclared variable errors or something similar, create the following variables and their type:
Variable NameType

KR_UX
Real

KR_UY
Real

KR_UZ
Real

KR_PickedX
Real

KR_PickedY
Real

KR_PickedZ
Real


I went ahead and updated the submission so that the error will no longer occur during import. You can either manually create these variables in your map, or re-import the submission with the update.
Thanks for responding, I didn't see your reply before I delete my post. I exported the map script and open the script file with notepad, so I can see the JASS scripts and add missing variables, now it works!
 
Top