Hi! Would be nice if you could take a minute or two to look at my trigger. It is meant to start a spell which spawns two frostballs at the target, moving around it and everything in line of cold gets hit by a frostnova: have fun! ^^
JASS:
function cond takes nothing returns boolean
if (GetSpellAbilityId() == 'A002') then
return true
else
return false
endif
endfunction
function act takes nothing returns nothing
// -- variables --
local unit caster = GetSpellAbilityUnit()
local unit target = GetSpellTargetUnit()
local unit t
local unit dummy
local unit iceball1
local unit iceball2
local group g
local player p = GetOwningPlayer(caster)
local real aim1 = (GetUnitFacing(caster) - 90)
local real aim2 = (GetUnitFacing(caster) + 90)
local real distance = 100.00
local location targetLoc = GetUnitLoc(target)
local location tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
local location tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
local integer i = 30
// -- spawning effects --
set iceball1 = CreateUnitAtLoc(p,'h002',tempLoc1,bj_UNIT_FACING)
set iceball2 = CreateUnitAtLoc(p,'h002',tempLoc2,bj_UNIT_FACING)
// -- action! --
loop
exitwhen (i == -1)
set targetLoc = GetUnitLoc(target)
set aim1 = (aim1 + 40)
set aim2 = (aim2 + 40)
set tempLoc1 = PolarProjectionBJ(targetLoc,distance,aim1)
set tempLoc2 = PolarProjectionBJ(targetLoc,distance,aim2)
call SetUnitPositionLoc(iceball1,tempLoc1)
call SetUnitPositionLoc(iceball2,tempLoc2)
call GroupEnumUnitsInRangeOfLoc(g,tempLoc1,60.00,null)
call GroupEnumUnitsInRangeOfLoc(g,tempLoc2,60.00,null)
loop
exitwhen (t == null)
set t = FirstOfGroup(g)
set dummy = CreateUnitAtLoc(p,'h000',GetUnitLoc(t),0.00)
call UnitAddAbility(dummy,'A003')
call IssueTargetOrder(dummy,"frostnova",t)
call UnitApplyTimedLife(dummy,'BTLF',1.00)
call GroupRemoveUnit(g,t)
endloop
set i = (i - 1)
endloop
// -- removing memory leaks --
set caster = null
set target = null
call KillUnit(iceball1)
call RemoveUnit(iceball1)
set iceball1 = null
call KillUnit(iceball2)
call RemoveUnit(iceball2)
set iceball2 = null
set dummy = null
call DestroyGroup(g)
set g = null
set p = null
call RemoveLocation(targetLoc)
set targetLoc = null
call RemoveLocation(tempLoc1)
set tempLoc1 = null
call RemoveLocation(tempLoc2)
endfunction
//========================================================
function InitTrig_Icera_Jass takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig, Condition(function cond))
call TriggerAddAction(Trig, function act )
set Trig = null
endfunction
Last edited by a moderator: