Hi there!
since weeks this trigger, designed for a area spell, causes fatal errors (access violation) in random situations. The error appears when only one unit is in range, cant get more information out of it, it seems very random.
Could someone help me plz?
since weeks this trigger, designed for a area spell, causes fatal errors (access violation) in random situations. The error appears when only one unit is in range, cant get more information out of it, it seems very random.
Could someone help me plz?
JASS:
function UnitEnemyNS takes nothing returns boolean
if GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)<= 0 or IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) or GetUnitAbilityLevel(GetEnumUnit(),'Avul')>0 or GetUnitAbilityLevel(GetEnumUnit(),'Aloc')>0 then
return false
endif
return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_tmpUnit))
endfunction
function Trig_Sandstorm_Actions takes nothing returns nothing
local unit uCaster = GetTriggerUnit()
local location tmpLocation = GetSpellTargetLoc()
local real tx = GetLocationX(tmpLocation)
local real ty = GetLocationY(tmpLocation)
local real x
local real y
local real angle
local real dist
local integer i = 0
local integer j = 0
local integer n
local group g = CreateGroup()
local unit u
local integer abilvl = GetUnitAbilityLevel(uCaster,'A05Q')
local real dmg = I2R(abilvl+3)*10+I2R(GetHeroStr(uCaster,true))/2.0
call RemoveLocation( tmpLocation )
set tmpLocation = null
loop
exitwhen i > 20
call CameraNoise(300, tx, ty)
set angle = GetRandomReal(0,2*bj_PI)
set dist = GetRandomReal(64, 256.00)
set x = tx+Cos(angle)*dist
set y = ty+Sin(angle)*dist
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x,y))
set angle = GetRandomReal(0,2*bj_PI)
set dist = GetRandomReal(64, 256.00)
set x = tx+Cos(angle)*dist
set y = ty+Sin(angle)*dist
call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x,y))
call GroupClear(g)
set udg_tmpUnit = uCaster
call GroupEnumUnitsInRange(g,tx,ty,256.0,Condition(function UnitEnemyNS))
set u = null
set n = CountUnitsInGroup(g)
if n>0 then
set n = GetRandomInt(1,n)
set j=1
loop
exitwhen j>=n
call GroupRemoveUnit(g,FirstOfGroup(g))
set j=j+1
endloop
set u = FirstOfGroup(g)
//call UnitDamageTarget(uCaster,u,dmg,true,false,ATTACK_TYPE_MAGIC, DAMAGE_TYPE_MAGIC, WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl",GetUnitX(u),GetUnitY(u)))
endif
call TriggerSleepAction( 0.50 )
set i = i+1
endloop
call DestroyGroup(g)
set g = null
endfunction