Hi guys, I've brought this problem from another forum where no one knows what's wrong with it. I'm pretty clueless at this point, I'll try pretty much anything, no matter how complex, JASS, GUI triggers, whatever works. Think you can solve this one?
http://www.thehelper.net/forums/showthread.php?t=75878
My current trigger to pull this off:
Connects caster and target with a custom lightning effect and drains health from target every 0.1 sec. Updates targetdistance (real) variable every iteration and moves lightning effect to new target and caster positions every iteration.
Stops previous trigger is drain range is exceeded:
So what is the problem? The problem is that this causes Warcraft 3 to crash after 3 seconds of using it. What happens is that the spell works for the 1st second then suddenly the lightning effect changes place and connects the caster to the center of the map instead of to its target. Then the game proceeds to crash 1 second later. I don't know if it's because the caster has moved or not (doesn't appear to be though). There's probably an easier way to do this in GUI. I'm hoping to make this MUI as soon as I can figure out how.
http://www.thehelper.net/forums/showthread.php?t=75878
My current trigger to pull this off:
Connects caster and target with a custom lightning effect and drains health from target every 0.1 sec. Updates targetdistance (real) variable every iteration and moves lightning effect to new target and caster positions every iteration.
Code:
Moving Drain Life
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Drain Beam (Slow Based)
Actions
Custom script: call AddLightningLoc( "BEAM", GetUnitLoc(GetSpellAbilityUnit()), GetUnitLoc(GetSpellTargetUnit()) )
For each (Integer A) from 1 to 80, do (Actions)
Loop - Actions
Lightning - Move (Last created lightning effect) to source (Position of (Casting unit)) and target (Position of (Target unit of ability being cast))
Set TargetDistance = (Distance between (Position of (Casting unit)) and (Position of (Target unit of ability being cast)))
Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing 50.00 damage of attack type Magic and damage type Normal
Wait 0.10 game-time seconds
Lightning - Destroy (Last created lightning effect)
Stops previous trigger is drain range is exceeded:
Code:
TargetDistance
Events
Time - Every 3.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TargetDistance Greater than 1000.00
Then - Actions
Lightning - Destroy (Last created lightning effect)
Trigger - Remove Moving Drain Life <gen> from the trigger queue
Else - Actions
Do nothing
So what is the problem? The problem is that this causes Warcraft 3 to crash after 3 seconds of using it. What happens is that the spell works for the 1st second then suddenly the lightning effect changes place and connects the caster to the center of the map instead of to its target. Then the game proceeds to crash 1 second later. I don't know if it's because the caster has moved or not (doesn't appear to be though). There's probably an easier way to do this in GUI. I'm hoping to make this MUI as soon as I can figure out how.