My triggers leak but I don't know where are the leaks and how to remove it and if you could please explain how to improve my triggering skills as I just started on doing JASS.
This spell does everything right except for the damage (Shard dies) and gets laggier everytime I cast. Please tell me how to fix it and how to improve my triggering skills as I am really willing to learn anything. Thanks!
JASS:
scope Spiderboss initializer Init
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00S'
endfunction
private function damage takes nothing returns nothing
if IsUnitAliveBJ(GetEnumUnit()) and IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(GetTriggerUnit())) then
// call BJDebugMsg(GetUnitName(GetEnumUnit()))
call SetUnitState(GetEnumUnit(),UNIT_STATE_LIFE,GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE) - 2)
endif
endfunction
private function Actions takes nothing returns nothing
local integer i = 20 //20 ice nova 180 degrees each
local location l = GetUnitLoc(GetTriggerUnit())
local location loc
local group g = CreateGroup()
local unit u
local unit dummy
//call BJDebugMsg(I2S(i))
set udg_S_C = GetTriggerUnit()
loop
exitwhen i < 0
// call BJDebugMsg(I2S(i))
set loc = PolarProjectionBJ(l, 1000, i * 18)
call CreateNUnitsAtLoc(1, 'h00E', GetOwningPlayer(GetTriggerUnit()), loc, 0.)
set dummy = GetLastCreatedUnit()
call UnitApplyTimedLife(dummy, 'Bapl', 1)
call CreateNUnitsAtLoc(1, 'h00G', GetOwningPlayer(GetTriggerUnit()), loc, 0.)
set dummy = GetLastCreatedUnit()
call UnitApplyTimedLife(dummy, 'Bapl', 0.8)
// call GroupEnumUnitsInRange(g,GetUnitX(dummy[ii]), GetUnitY(dummy[ii]),400., null)
set g = GetUnitsInRangeOfLocMatching(400., loc, null)
call ForGroup(g, function damage)
call CreateNUnitsAtLoc(1,'h00F',GetOwningPlayer(GetTriggerUnit()),loc,0.)
set udg_dummy1[i] = GetLastCreatedUnit()
call SetUnitFacingToFaceUnitTimed(udg_dummy1[i], GetTriggerUnit(), 0.)
call RemoveLocation(loc)
call DestroyGroup(g)
set i = i - 1
endloop
call RemoveLocation(l)
set udg_S_B = true
set udg_S_BI[0] = 0
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddAction( t, function Actions )
// call TriggerAddCondition( t , Condition(function Conditions))
endfunction
endscope
JASS:
scope Spiderboss1 initializer Init
private function Conditions takes nothing returns boolean
if udg_S_B == true then
return true
endif
return false
endfunction
private function damage takes nothing returns nothing
if IsUnitAliveBJ(GetEnumUnit()) and IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(udg_S_C)) then
// call BJDebugMsg(GetUnitName(GetEnumUnit()))
call SetUnitState(GetEnumUnit(),UNIT_STATE_LIFE,GetUnitState(GetEnumUnit(),UNIT_STATE_LIFE) - 1)
endif
endfunction
private function Actions takes nothing returns nothing
local location l
local location loc
local integer ii = 20
local integer i = 20
local group g = CreateGroup()
local unit u
if udg_S_BI[0] >= 0 and udg_S_BI[0] < 20 then
set udg_S_BI[0] = udg_S_BI[0] + 1
loop
exitwhen i < 0
set l = GetUnitLoc(udg_dummy1[i])
set loc = PolarProjectionBJ(l,50,GetUnitFacing(udg_dummy1[i]))
call UnitApplyTimedLife(udg_dummy1[i], 'BTLF', 0.05)
// call SetUnitPositionLoc(udg_dummy1[i],loc)
call CreateNUnitsAtLoc(1, 'h00F', GetOwningPlayer(udg_dummy1[i]), loc, GetUnitFacing(udg_dummy1[i]))
call SetUnitFacingToFaceUnitTimed(GetLastCreatedUnit(), udg_S_C, 0.)
set udg_dummy1[i] = GetLastCreatedUnit()
set g = GetUnitsInRangeOfLocMatching(100., loc, null)
call ForGroup(g, function damage)
call RemoveLocation(l)
call RemoveLocation(loc)
call DestroyGroup(g)
set i = i - 1
endloop
elseif udg_S_BI[0] >= 20 then
set udg_S_B = false
set udg_S_B1 = true
loop
exitwhen ii < 0
call RemoveUnit(udg_dummy1[ii])
set ii = ii - 1
endloop
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( t, 0.20 )
call TriggerAddAction( t, function Actions )
call TriggerAddCondition( t , Condition(function Conditions))
endfunction
endscope
JASS:
scope Spiderboss2 initializer Init
private function Conditions takes nothing returns boolean
if udg_S_B1 == true then
return true
endif
return false
endfunction
private function Actions takes nothing returns nothing
local location loc = GetUnitLoc(udg_S_C)
local location l = GetRandomLocInRect(RectFromCenterSizeBJ(loc, 1000., 1000.))
if udg_S_BI[0] >= 20 and udg_S_BI[0] < 50 then //20 shards
set udg_S_BI[0] = udg_S_BI[0] + 1
call CreateNUnitsAtLoc(1, 'h00H', GetOwningPlayer(udg_S_C), l, 0)
call SetUnitTimeScale(GetLastCreatedUnit(), 0.5)
call UnitApplyTimedLife(GetLastCreatedUnit(),'BTLF', 1.5)
call RemoveLocation(loc)
call RemoveLocation(l)
elseif udg_S_BI[0] >= 50 then
set udg_S_B1 = false
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( t, 0.50 )
call TriggerAddAction( t, function Actions )
call TriggerAddCondition( t , Condition(function Conditions))
endfunction
endscope
JASS:
scope Novadie initializer Init
private function Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit()) == 'h00H'
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit uu
local location l
local group g = CreateGroup()
call GroupEnumUnitsInRange(g, GetUnitX(u), GetUnitY(u), 1000., null)
loop
set uu = FirstOfGroup(g)
exitwhen uu == null
if IsUnitAliveBJ(uu) == true and IsUnitEnemy(uu, GetOwningPlayer(u)) == true then
call GroupRemoveUnit(g,uu)
set l = GetUnitLoc(uu)
call CreateNUnitsAtLoc(1, 'h00G', GetOwningPlayer(u), l, 0.)
call UnitApplyTimedLife(GetLastCreatedUnit(), 'BTLF', 1.)
call UnitDamageTarget(udg_S_C, uu, 3., false, false, null, null, null )
call RemoveLocation(l)
endif
endloop
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction( t, function Actions )
call TriggerAddCondition( t , Condition(function Conditions))
endfunction
endscope
This spell does everything right except for the damage (Shard dies) and gets laggier everytime I cast. Please tell me how to fix it and how to improve my triggering skills as I am really willing to learn anything. Thanks!