I've made spell in JASS. this spell should take units in a cone, which begins at caster and has angle 120. I don't know why it frezees only in the same angle,
which rotation doesn't depend of the casters facing. I place here only needed part of code:
// This condition checks angle and distance
function ConeOfColdCondition takes location c, location u, real a, integer d returns boolean
local integer n = 0
if (AngleBetweenPoints(c, u) >= (a-60)) then
set n = n+1
else
endif
if (AngleBetweenPoints(c, u) <= (a+60)) then
set n = n+1
else
endif
if (DistanceBetweenPoints(c, u) <= (d)) then
set n = n+1
else
endif
if n == 3 then
return true
else
return false
endif
endfunction
function ConeOfColdRange takes integer l returns integer
if l == 1 then
return 600
elseif l == 2 then
return 700
elseif l == 3 then
return 800
elseif l == 4 then
return 900
else
return 0
endif
endfunction
function ConeOfColdFreezeGroup takes group g, unit c, integer l, real a returns nothing
local integer maxr = ConeOfColdRange(l)
local unit u
loop
set u = FirstOfGroup(g)
exitwhen g == null
if ConeOfColdCondition(GetUnitLoc(c), GetUnitLoc(u), a, maxr) then
call ConeOfColdFreeze(c, u, l)
call ConeOfColdFreezeTimer(c, u)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "Coś działa 2")
else
endif
call GroupRemoveUnit(g, u)
endloop
endfunction
function Trig_ConeOfCold_Actions takes nothing returns nothing
local group g = CreateGroup()
local unit c = GetTriggerUnit()
local real angle = GetUnitFacing(c)
local integer l = GetUnitAbilityLevel(c, 'A00U')
local unit u = CreateUnit(GetOwningPlayer(c), 'h00T', GetUnitX(c), GetUnitY(c), bj_UNIT_FACING)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "Coś działa")
call UnitAddAbility( u, 'A07H')
call SetUnitAbilityLevel( u, 'A07H', l)
call ConeOfColdEffect(c, ConeOfColdRange(l))
call GroupEnumUnitsInRange(g, GetUnitX(c), GetUnitY(c), 1000, Condition (function ConeOfColdCond))
call ConeOfColdFreezeGroup(g, c, l, angle)
set c = null
call DestroyGroup(g)
set g = null
endfunction
Please help!
which rotation doesn't depend of the casters facing. I place here only needed part of code:
// This condition checks angle and distance
function ConeOfColdCondition takes location c, location u, real a, integer d returns boolean
local integer n = 0
if (AngleBetweenPoints(c, u) >= (a-60)) then
set n = n+1
else
endif
if (AngleBetweenPoints(c, u) <= (a+60)) then
set n = n+1
else
endif
if (DistanceBetweenPoints(c, u) <= (d)) then
set n = n+1
else
endif
if n == 3 then
return true
else
return false
endif
endfunction
function ConeOfColdRange takes integer l returns integer
if l == 1 then
return 600
elseif l == 2 then
return 700
elseif l == 3 then
return 800
elseif l == 4 then
return 900
else
return 0
endif
endfunction
function ConeOfColdFreezeGroup takes group g, unit c, integer l, real a returns nothing
local integer maxr = ConeOfColdRange(l)
local unit u
loop
set u = FirstOfGroup(g)
exitwhen g == null
if ConeOfColdCondition(GetUnitLoc(c), GetUnitLoc(u), a, maxr) then
call ConeOfColdFreeze(c, u, l)
call ConeOfColdFreezeTimer(c, u)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "Coś działa 2")
else
endif
call GroupRemoveUnit(g, u)
endloop
endfunction
function Trig_ConeOfCold_Actions takes nothing returns nothing
local group g = CreateGroup()
local unit c = GetTriggerUnit()
local real angle = GetUnitFacing(c)
local integer l = GetUnitAbilityLevel(c, 'A00U')
local unit u = CreateUnit(GetOwningPlayer(c), 'h00T', GetUnitX(c), GetUnitY(c), bj_UNIT_FACING)
call DisplayTextToForce(bj_FORCE_ALL_PLAYERS, "Coś działa")
call UnitAddAbility( u, 'A07H')
call SetUnitAbilityLevel( u, 'A07H', l)
call ConeOfColdEffect(c, ConeOfColdRange(l))
call GroupEnumUnitsInRange(g, GetUnitX(c), GetUnitY(c), 1000, Condition (function ConeOfColdCond))
call ConeOfColdFreezeGroup(g, c, l, angle)
set c = null
call DestroyGroup(g)
set g = null
endfunction
Please help!