- Joined
- Nov 13, 2006
- Messages
- 1,814
this leaking or no coz enough the nulling location?
JASS:
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
local integer a = 0
local integer b = 0
local integer c = 0
local integer d = 0
local integer e = 0
local unit u = GetTriggerUnit()
local unit u1 = null
local unit u2 = null
local location l1 = GetUnitLoc(u)
local location l2 = GetSpellTargetLoc()
local real x1 = GetLocationX(l1)
local real y1 = GetLocationY(l1)
local real x2 = GetLocationX(l2)
local real y2 = GetLocationY(l2)
local real x3 = 0
local real y3 = 0
local real x4 = 0
local real y4 = 0
local real g = 3.14159/180
local real dmg = 10 + (GetUnitAbilityLevel(u, 'ANcl')) * 50
local player p = GetOwningPlayer(u)
local string s = "Abilities\\Spells\\Items\\VampiricPotion\\VampPotionCaster.mdl"
local effect f = AddSpecialEffectTarget(s, u, "origin")
loop
exitwhen a > 110
loop
exitwhen b > 10
set x3 = GetLocationX(l1) + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
set y3 = GetLocationY(l1) + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
set u1 = CreateUnit (p, 'h000', x3 , y3, 0)
call UnitAddAbility(u1, 'Amrf' )
call UnitRemoveAbility(u1, 'Amrf' )
call SetUnitFlyHeight( u1, 1500.00, GetRandomReal(800.00, 1000.00) )
call UnitApplyTimedLife( u1,'BTLF', 3.00 )
set u1 = null
set b = b + 1
endloop
if (a > 5) then
loop
exitwhen c > 10
set x4 = GetLocationX(l2) + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
set y4 = GetLocationY(l2) + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
set u2 = CreateUnit (p, 'h001', x4 , y4, 0)
call UnitAddAbility(u2, 'Amrf' )
call UnitRemoveAbility(u2, 'Amrf' )
call SetUnitFlyHeight( u2, GetRandomReal(5.00, 40.00), GetRandomReal(900.00, 1000.00) )
call UnitApplyTimedLife( u2,'BTLF', 6.00 )
set c = c + 1
endloop
set d = d + 1
if ((a - I2R(R2I(a / 2)) * 2) == 0) then
call UnitDamagePoint(u, 0, 200, x2, y2, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
call SetUnitState(u, ConvertUnitState(2), GetUnitState(u,ConvertUnitState(2)) - 5)
endif
endif
call TriggerSleepAction(0.1)
if ((OrderId2StringBJ(GetUnitCurrentOrder(u)) != "channel") and (GetUnitState(u, ConvertUnitState(0)) > 0)) then
set a = 10000
elseif (GetUnitState(u, ConvertUnitState(2)) < 5.00) then
set a = 10000
call IssueImmediateOrder( GetTriggerUnit(), "stop" )
endif
set a = a + 1
set e = e + 1
set b = 0
set c = 0
endloop
call DestroyEffect(f)
set d = e - d + 3
set a = 0
loop
exitwhen a > d
loop
exitwhen c > 10
set x4 = GetLocationX(l2) + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
set y4 = GetLocationY(l2) + GetRandomReal(0, 200.00) * Cos(g * GetRandomReal(0, 359.0))
set u2 = CreateUnit (p, 'h001', x4 , y4, 0)
call UnitAddAbility(u2, 'Amrf' )
call UnitRemoveAbility(u2, 'Amrf' )
call SetUnitFlyHeight( u2, GetRandomReal(10.00, 30.00), GetRandomReal(900.00, 1000.00) )
call UnitApplyTimedLife( u2,'BTLF', 6.00 )
set c = c + 1
endloop
call TriggerSleepAction(0.1)
if ((a - I2R(R2I(a / 2)) * 2) == 0) then
call UnitDamagePoint(u, 0, 200, x2, y2, dmg, true, false, ConvertAttackType(6), ConvertDamageType(4), ConvertWeaponType(0))
endif
set a = a + 1
set c = 0
endloop
set u = null
set u1 = null
set u2 = null
set p = null
set s = null
set f = null
set l1 = null
set l2 = null
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
set gg_trg_Untitled_Trigger_001 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction