- Joined
- May 21, 2008
- Messages
- 218
Alright so I'll make this breif. I made 2 abilities Thunder Strike off of channel and Stun off of Magic Hammer. Magic hammer doesnt get casted by the dummy unit (I just wanted the units to get stunned and I found you cant give a buff to a unit). What happens is the dummy unit doesnt cast magic hammer and on lightning secondary they all the lightnings go to one unit.
What's Wrong?
JASS:
function Trig_Lightning_Strike_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A000' then
return true
endif
return false
endfunction
function Trig_Lightning_Strike_LightningPrimary takes nothing returns nothing
local lightning l = AddLightningEx("CLPB", true, GetLocationX(udg_temp_point), GetLocationY(udg_temp_point), GetLocationZ(udg_temp_point), GetLocationX(udg_temp_point2), GetLocationY(udg_temp_point2), GetLocationZ(udg_temp_point2))
call TriggerSleepAction(1.00)
call DestroyLightning( l )
set l = null
endfunction
function Trig_Lightning_Strike_LightningSecondary takes nothing returns nothing
local lightning l = AddLightningEx("CLSB", true, GetLocationX(udg_temp_point), GetLocationY(udg_temp_point), GetLocationZ(udg_temp_point), GetLocationX(udg_temp_point2), GetLocationY(udg_temp_point2), GetLocationZ(udg_temp_point2))
call TriggerSleepAction(1.00)
call DestroyLightning( l )
set l = null
endfunction
function Trig_Lightning_Strike_groupfunction1 takes nothing returns nothing
local location unitloc = GetUnitLoc(GetEnumUnit())
local unit c = GetTriggerUnit()
local location casterpoint = GetUnitLoc(c)
local location targetpoint = GetSpellTargetLoc()
call IssueTargetOrder( udg_temp_unit, "thunderbolt", GetEnumUnit() )
set udg_temp_point = casterpoint
set udg_temp_point2 = unitloc
call ExecuteFunc("Trig_Lightning_Strike_LightningPrimary")
call RemoveLocation(unitloc)
call RemoveLocation(casterpoint)
call RemoveLocation(targerpoint)
set c = null
set casterpoint = null
set targetpoint = null
endfunction
function Trig_Lightning_Strike_groupfunction2 takes nothing returns nothing
local location unitloc = GetUnitLoc(GetEnumUnit())
call ExecuteFunc("Trig_Lightning_Strike_LightningSecondary")
call RemoveLocation(unitloc)
set unitloc = null
endfunction
function Trig_Lightning_Strike_Actions takes nothing returns nothing
local group unitgroup = CreateGroup()
local unit c = GetTriggerUnit()
local unit dummy
local location casterpoint = GetUnitLoc(c)
local location targetpoint = GetSpellTargetLoc()
local integer i = GetUnitAbilityLevel( c, 'A000' )
if i == 1 then
call GroupEnumUnitsInRangeOfLoc(unitgroup, targetpoint, 330, null)
elseif i == 2 then
call GroupEnumUnitsInRangeOfLoc(unitgroup, targetpoint, 380, null)
else
call GroupEnumUnitsInRangeOfLoc(unitgroup, targetpoint, 430, null)
endif
set dummy = CreateUnit( Player(0), 'h001', GetLocationX(casterpoint), GetLocationY(casterpoint), bj_RADTODEG * Atan2(GetLocationY(targetpoint) - GetLocationY(casterpoint), GetLocationX(targetpoint) - GetLocationX(casterpoint)))
set udg_temp_unit = dummy
call ForGroup( unitgroup, function Trig_Lightning_Strike_groupfunction1 )
call TriggerSleepAction( 1.00 )
call ForGroup( unitgroup, function Trig_Lightning_Strike_groupfunction2 )
call TriggerSleepAction( 1.00 )
call DestroyGroup(unitgroup)
set unitgroup = null
call RemoveLocation(casterpoint)
set casterpoint = null
call RemoveLocation(targetpoint)
set targetpoint = null
set c = null
endfunction
//===========================================================================
function InitTrig_Lightning_Strike takes nothing returns nothing
set gg_trg_Lightning_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Lightning_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Lightning_Strike, Condition( function Trig_Lightning_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Lightning_Strike, function Trig_Lightning_Strike_Actions )
endfunction