Flare
Stops copies me!
- Reaction score
- 662
I'm making a spell based on Maledict in DotA (curses enemy heroes within the spell AoE, dealing slight damage per second. Every 4 seconds of the curse, a hero will take X damage for every 100 damage they have taken over the duration of the curse). For some reason, my spell only works correctly on the first cast. On the first cast, it lasts 12 seconds (as it should) but on every other cast, it lasts roughly 1 second per unit in the spell AoE and sometimes units are immediately killed from about 500hp) even though they SHOULD be removed from the unit group once the spell duration expires. Here's the code
Also, the damage seems to be fairly random. Sometimes the floating text appears above one unit, but damages a different one
Code:
Maledict Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Maledict
Actions
Set TargetPt = (Target point of ability being cast)
Set TargetGroup = (Units within 200.00 of TargetPt matching ((((Matching unit) is A Hero) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))))
Unit Group - Pick every unit in TargetGroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CustomVal Less than 1000
Then - Actions
Set CustomVal = (CustomVal + 1)
Else - Actions
Set CustomVal = 1
Set Caster[CustomVal] = (Triggering unit)
Set RandomPt = (Random point in (Playable map area))
Unit - Create 1 Hidden Dummy for (Owner of (Triggering unit)) at RandomPt facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to CustomVal
Set Dummy[CustomVal] = (Last created unit)
Unit Group - Add Dummy[CustomVal] to DummyGroup
Set Target[CustomVal] = (Picked unit)
Unit Group - Add Target[CustomVal] to DamageGroup
Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Orc\SpiritLink\SpiritLinkTarget.mdl
Set MaxDuration[CustomVal] = 12.00
Set SFX[CustomVal] = (Last created special effect)
Set DPS[CustomVal] = (5.00 x (Real((Level of Maledict for Caster[CustomVal]))))
Set PeriodicDamage[CustomVal] = (10.00 x (Real((Level of Maledict for Caster[CustomVal]))))
Trigger - Add to Maledict Damage detection <gen> the event (Unit - Target[CustomVal] Takes damage)
Custom script: call RemoveLocation (udg_RandomPt)
Custom script: call DestroyGroup (udg_TargetGroup)
Maledict Damage detection
Events
Conditions
Actions
Unit Group - Pick every unit in DummyGroup and do (Actions)
Loop - Actions
Set RandomPt = (Random point in (Playable map area))
Unit - Create 1 Hidden Dummy for (Owner of (Picked unit)) at RandomPt facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to (Custom value of (Picked unit))
Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
Unit Group - Pick every unit in DamageGroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Picked unit) Equal to (Triggering unit)
Then - Actions
Set DamageTaken[(Custom value of (Last created unit))] = (DamageTaken[(Custom value of (Last created unit))] + (Damage taken))
Else - Actions
Maledict Effect
Events
Time - Every 1.00 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in DummyGroup and do (Actions)
Loop - Actions
Set RandomPt = (Random point in (Playable map area))
Unit - Create 1 Hidden Dummy for (Owner of (Picked unit)) at RandomPt facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to (Custom value of (Picked unit))
Unit - Add a 0.01 second Generic expiration timer to (Last created unit)
Unit Group - Pick every unit in DamageGroup and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CurrentDuration[(Custom value of (Last created unit))] Less than or equal to MaxDuration[(Custom value of (Last created unit))]
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Target[(Custom value of (Last created unit))] is alive) Equal to True
Then - Actions
Set CurrentDuration[(Custom value of (Last created unit))] = (CurrentDuration[(Custom value of (Last created unit))] + 1.00)
Unit - Cause (Last created unit) to damage (Picked unit), dealing PeriodicDamage[(Custom value of (Last created unit))] damage of attack type Spells and damage type Normal
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
CurrentDuration[(Custom value of (Last created unit))] Equal to 4.00
CurrentDuration[(Custom value of (Last created unit))] Equal to 8.00
CurrentDuration[(Custom value of (Last created unit))] Equal to 12.00
Then - Actions
Set Multiplier[(Custom value of (Last created unit))] = ((Integer(DamageTaken[(Custom value of (Last created unit))])) / 100)
Set MultiplierDamage[(Custom value of (Last created unit))] = (PeriodicDamage[(Custom value of (Last created unit))] x (Real(Multiplier[(Custom value of (Last created unit))])))
Unit - Cause (Last created unit) to damage (Picked unit), dealing MultiplierDamage[(Custom value of (Last created unit))] damage of attack type Spells and damage type Normal
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MultiplierDamage[(Custom value of (Last created unit))] Greater than 0.00
Then - Actions
Else - Actions
Else - Actions
Else - Actions
Set CurrentDuration[(Custom value of (Last created unit))] = 0.00
Set DamageTaken[(Custom value of (Last created unit))] = 0.00
Special Effect - Destroy SFX[(Custom value of (Last created unit))]
Unit Group - Remove Dummy[(Custom value of (Last created unit))] from DummyGroup
Unit - Remove Dummy[(Custom value of (Last created unit))] from the game
Unit Group - Remove Target[(Custom value of (Last created unit))] from TargetGroup
Else - Actions
Set CurrentDuration[(Custom value of (Last created unit))] = 0.00
Set DamageTaken[(Custom value of (Last created unit))] = 0.00
Special Effect - Destroy SFX[(Custom value of (Last created unit))]
Unit Group - Remove Dummy[(Custom value of (Last created unit))] from DummyGroup
Unit - Remove Dummy[(Custom value of (Last created unit))] from the game
Unit Group - Remove Target[(Custom value of (Last created unit))] from TargetGroup
Also, the damage seems to be fairly random. Sometimes the floating text appears above one unit, but damages a different one