Sgqvur
FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
- Reaction score
- 62
>An instant casted Chain Lightning which jumps thorugh each unit, from the closest to the farthest.
Well, the way I see it a chain lightning works basiclly in the following way:
1. a [ljass]lightning[/ljass] effect is created ruffly(maybe it has some z for example) from the origin of the caster to the spell target unit.
2. if number of jumps/bounces of the lightning > 0 go to 2.1. else END
---- 2.1. find the closest unit (matching some conditions ex: enemy) which is also not equall to the last spell-target/jump-target unit (otherwise the chain lightning will just hit the first spell target unit multiple times), decrement bounces and go to 2.
My point is that you always have to call GetNearestUnitEx(..., 1), in order for the spell to work properly because not all of the targets of the chain lightning would be located within the initial range of the spell, and this means that the sorting is pretty useless in this case because you don't actaully need GetNearstUnitEx(..., n).
A good example of where the sorting might do well (and no I am not using my imagiantion I am recalling from memory) would be the Healing Wave spell of the Head Hunter (one of orc's heros), the way it works is that after the initial healing of the spell target unit it jumps/finds the unit with least amount of hp and from there it jumps again and again, although the same thing applies here that you still need to call GetLowestHpUnit(..., 1) which again means the sorting is pretty useless.
Well, the way I see it a chain lightning works basiclly in the following way:
1. a [ljass]lightning[/ljass] effect is created ruffly(maybe it has some z for example) from the origin of the caster to the spell target unit.
2. if number of jumps/bounces of the lightning > 0 go to 2.1. else END
---- 2.1. find the closest unit (matching some conditions ex: enemy) which is also not equall to the last spell-target/jump-target unit (otherwise the chain lightning will just hit the first spell target unit multiple times), decrement bounces and go to 2.
My point is that you always have to call GetNearestUnitEx(..., 1), in order for the spell to work properly because not all of the targets of the chain lightning would be located within the initial range of the spell, and this means that the sorting is pretty useless in this case because you don't actaully need GetNearstUnitEx(..., n).
A good example of where the sorting might do well (and no I am not using my imagiantion I am recalling from memory) would be the Healing Wave spell of the Head Hunter (one of orc's heros), the way it works is that after the initial healing of the spell target unit it jumps/finds the unit with least amount of hp and from there it jumps again and again, although the same thing applies here that you still need to call GetLowestHpUnit(..., 1) which again means the sorting is pretty useless.