- Joined
- Jul 1, 2008
- Messages
- 1,314
Hello guys,
this trigger is working fine, but it creates giant leaks during its execution.
After 2 executions, the game cant be played anymore!
I have no idea why, so maybe you guys can help me out?
this trigger is working fine, but it creates giant leaks during its execution.
After 2 executions, the game cant be played anymore!
I have no idea why, so maybe you guys can help me out?
JASS:
function Trig_Morgenstern_Conditions takes nothing returns boolean
local unit u = GetTriggerUnit()
if GetUnitAbilityLevel(u,'A009') > 0 then
if GetUnitTypeId(u) == 'U000' and IsUnitAlly(u,GetOwningPlayer(GetAttacker())) == false and udg_Capricorn_Spin == false then
set u = null
return true
endif
endif
set u = null
return false
endfunction
function CM_GroupEnumTargets takes nothing returns boolean
local unit u = GetFilterUnit()
local player p = GetOwningPlayer(udg_HERO_Capricorn)
if IsUnitAlly(u,p) != true and IsUnitDead(u) != true and IsUnitType(u, UNIT_TYPE_STRUCTURE) != true then
set u = null
set p = null
return true
endif
set u = null
set p = null
return false
endfunction
function Trig_Morgenstern_Actions takes nothing returns nothing
local integer i = 0
local integer count = 0
local group g
local unit u
local real cx
local real cy
local effect array e
// LVL DATA
local integer SPELL_LVL = GetUnitAbilityLevel(udg_HERO_Capricorn,'A009')
local integer DMG = 30 + SPELL_LVL * 10
// Percentage chance
if GetRandomInt(1,10) <= SPELL_LVL + 1 then
set udg_Capricorn_Spin = true
// Enum targets
set cx = GetUnitX(udg_HERO_Capricorn)
set cy = GetUnitY(udg_HERO_Capricorn)
set g = CreateGroup()
call GroupEnumUnitsInRange(g,cx,cy,250.00,Condition(function CM_GroupEnumTargets))
loop
set u = FirstOfGroup(g)
exitwhen u == null
set e[count] = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Stampede\\StampedeMissileDeath.mdl",u,"chest")
set count = count + 1
// dmg unit
call UnitDamageTarget( udg_HERO_Capricorn, u, DMG,true,false, ATTACK_TYPE_MELEE, DAMAGE_TYPE_FORCE,WEAPON_TYPE_WHOKNOWS )
endloop
// Capricorn Anim
set e[count] = AddSpecialEffectTarget("war3mapImported\\Flail.mdx",udg_HERO_Capricorn,"overhead")
call TriggerSleepAction(0.60 - I2R(SPELL_LVL / 10))
loop
exitwhen i > count
call DestroyEffect(e[i])
set e[i] = null
set i = i + 1
endloop
set udg_Capricorn_Spin = false
call DestroyGroup(g)
endif
set g = null
set u = null
endfunction
//===========================================================================
function InitTrig_Morgenstern takes nothing returns nothing
set gg_trg_Morgenstern = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Morgenstern, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( gg_trg_Morgenstern, Condition( function Trig_Morgenstern_Conditions ) )
call TriggerAddAction( gg_trg_Morgenstern, function Trig_Morgenstern_Actions )
endfunction