- Joined
- Jul 24, 2007
- Messages
- 40
This is one is of my first Jass attempts...it works perfectly then doesn't work after about 4 tests of the spells. Any ideas?
I am using NewGen.
I am using NewGen.
JASS:
function Trig__Blinding_Light1_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A002'
endfunction
function Trig_Blinding_Light1_Actions takes nothing returns nothing
//variables begin
local player castplayer
local unit castunit //Casting unit
local location temploc //Targets location
local location castloc
local unit temp
local group enemies = CreateGroup()
local integer lcount
local effect e1
local effect ec
set castunit = GetTriggerUnit()
set castloc = GetUnitLoc(castunit)
set castplayer = GetOwningPlayer(castunit)
// variables end
//Spell Begins
set ec = AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl",castloc)
set enemies = GetUnitsInRangeOfLocAll(300,castloc)
set lcount = 2 + (2 * GetUnitAbilityLevel(castunit,'A002'))
loop
set temp = FirstOfGroup(enemies)
exitwhen temp == null or lcount == 0
if IsUnitEnemy(temp,GetOwningPlayer(castunit)) then
set temploc = GetUnitLoc(temp)
set lcount = lcount - 1
set e1 = AddSpecialEffectLoc("Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl",temploc)
call TriggerSleepAction(.05)
call UnitDamageTarget( castunit, temp, 40 * GetUnitAbilityLevel(castunit,'A002'), false,true,ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL,null )
call DestroyEffect(e1)
call RemoveLocation(temploc)
set temploc = null
set e1 = null
endif
call GroupRemoveUnit(enemies, temp)
endloop
//Clean
call RemoveLocation(temploc)
call RemoveLocation(castloc)
call DestroyEffect(e1)
call DestroyGroup(enemies)
call DestroyEffect(e1)
call DestroyEffect(ec)
set castplayer = null
set castunit = null
set temploc = null
set castloc = null
set temp = null
set e1 = null
set ec = null
set enemies = null
endfunction
//===========================================================================
function InitTrig_Holy_Eruption takes nothing returns nothing
set gg_trg_Holy_Eruption = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Holy_Eruption, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Holy_Eruption, Condition( function Trig__Blinding_Light1_Conditions ) )
call TriggerAddAction( gg_trg_Holy_Eruption, function Trig_Blinding_Light1_Actions )
endfunction
Last edited: