I had this script made for me in the spells section, however it has a minor bug. (it uses local handler vars)
the problem is here:
I want it instead of detecting if it is computer controled to detecting it is an enemy of the owner of (caster)
JASS:
function Trig_Bloodwind_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A001'
endfunction
function Bloodwind_Timer takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t, "KBunit")
local real x = GetHandleReal(t, "X")
local real y = GetHandleReal(t, "Y")
local real angle = bj_RADTODEG * Atan2(GetUnitY(u) - y, GetUnitX(u) - x)
local real ppx = GetUnitX(u) + 10 * Cos(angle * bj_DEGTORAD)
local real ppy = GetUnitY(u) + 10 * Sin(angle * bj_DEGTORAD)
call SetHandleInt(t, "Times", GetHandleInt(t, "Times") + 1)
call SetUnitPosition(u, ppx, ppy)
if GetHandleInt(t, "Times") == 50 then
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
function Trig_Bloodwind_Actions takes nothing returns nothing
local unit caster = GetSpellAbilityUnit()
local location loc = GetUnitLoc(caster)
local group g = GetUnitsInRangeOfLocAll(512, loc)
local unit u = null
local unit d = null
local timer t = null
call RemoveLocation(loc)
loop
set u = FirstOfGroup(g)
call GroupRemoveUnit(g, u)
exitwhen u == null
if GetPlayerController(GetOwningPlayer(u)) == MAP_CONTROL_COMPUTER then
set d = CreateUnit(Player(0), 'h001', GetUnitX(u), GetUnitY(u), 0)
call UnitApplyTimedLife(d, 'BTLF', 1)
call UnitDamageTargetBJ(d, u, 350.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_LIGHTNING )
set d = null
set t = CreateTimer()
call SetHandleHandle(t, "KBunit", u)
call SetHandleReal(t, "X", GetUnitX(caster))
call SetHandleReal(t, "Y", GetUnitY(caster))
call TimerStart(t, 0.02, true, function Bloodwind_Timer)
endif
endloop
call DestroyGroup(g)
set caster = null
set u = null
set g = null
set t = null
endfunction
//===========================================================================
function InitTrig_Bloodwind takes nothing returns nothing
set gg_trg_Bloodwind = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Bloodwind, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Bloodwind, Condition( function Trig_Bloodwind_Conditions ) )
call TriggerAddAction( gg_trg_Bloodwind, function Trig_Bloodwind_Actions )
endfunction
the problem is here:
JASS:
GetPlayerController(GetOwningPlayer(u)) == MAP_CONTROL_COMPUTER