- Joined
- Aug 1, 2007
- Messages
- 66
I've converted this to script and am trying to make it more efficient. The long line in the loop starting with ForGroupBJ is supposed to set the target to a new unit in range of the current target that is an enemy of the caster and not equal to the current target. In it's converted from gui form it used 4 or 5 functions, but I'm sure there's an easier way. I also wonder if there's a way to make the unit attack normally in place of playing his animation and dealing a set amount of damage. I tried it, but it didn't seem to do anything. I assumed the attack cooldown was getting in the way or something.
This spell was made by U.V
JASS:
function Trig_Swift_Attack_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A00Y' ) ) then
return false
endif
return true
endfunction
function Trig_Swift_Attack_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local integer level = GetUnitAbilityLevel(caster,'A00Y')
local effect array castereffect
local sound array slice
local real array damage
local integer hits = 4
set slice[1] = gg_snd_MetalHeavySliceFlesh1
set slice[2] = gg_snd_MetalHeavySliceFlesh2
set slice[3] = gg_snd_MetalHeavySliceFlesh3
set damage[1] = 50
set damage[2] = 62.5
set damage[3] = 78.13
set damage[4] = 97.66
set damage[5] = 122.07
set damage[6] = 152.59
set damage[7] = 190.73
set damage[8] = 238.42
set damage[9] = 298.02
set damage[10] = 372.53
call SetUnitTimeScalePercent( caster, 400.00 )
call AddSpecialEffectTargetUnitBJ( "hand right", caster, "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl" )
set castereffect[1] = GetLastCreatedEffectBJ()
call AddSpecialEffectTargetUnitBJ( "hand left", caster, "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl" )
set castereffect[2] = GetLastCreatedEffectBJ()
call AddSpecialEffectTargetUnitBJ( "foot right", caster, "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl" )
set castereffect[3] = GetLastCreatedEffectBJ()
call AddSpecialEffectTargetUnitBJ( "foot left", caster, "Abilities\\Weapons\\IllidanMissile\\IllidanMissile.mdl" )
set castereffect[4] = GetLastCreatedEffectBJ()
call TriggerSleepAction( 0.01 )
call SetUnitPositionLocFacingLocBJ( caster, GetUnitLoc(target), GetUnitLoc(target) )
call SetUnitAnimation( caster, "attack" )
call PlaySoundAtPointBJ( slice[GetRandomInt(1, 3)], 100, GetUnitLoc(caster), 0 )
call UnitDamageTarget( caster, target, damage[level], true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
loop
exitwhen hits == 0
set hits = (hits-1)
call TriggerSleepAction( 0.15 )
call ForGroupBJ( GetRandomSubGroup(1, GetUnitsInRangeOfLocMatching(500.00, GetUnitLoc(target), Condition(GetBooleanAnd( IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(caster)== true ), ( GetFilterUnit() != target ) , set target = GetEnumUnit() )
call SetUnitPositionLocFacingLocBJ( caster, GetUnitLoc(target), GetUnitLoc(target) )
call SetUnitAnimation( caster, "attack" )
call PlaySoundAtPointBJ( slice[GetRandomInt(1, 3)], 100, GetUnitLoc(caster), 0 )
call UnitDamageTarget( caster, target, damage[level], true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
endloop
call SetUnitTimeScalePercent( caster, 100.00 )
call DestroyEffectBJ( castereffect[1] )
call DestroyEffectBJ( castereffect[2] )
call DestroyEffectBJ( castereffect[3] )
call DestroyEffectBJ( castereffect[4] )
set caster = null
set target = null
set castereffect[1] = null
set castereffect[2] = null
set castereffect[3] = null
set castereffect[4] = null
set slice[1] = null
set slice[2] = null
set slice[3] = null
endfunction
This spell was made by U.V