• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

What's wrong with this spell???

Status
Not open for further replies.
Level 6
Joined
Dec 28, 2006
Messages
102
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!
 
Status
Not open for further replies.
Top