- Joined
- Jan 13, 2013
- Messages
- 131
Alright so when I was using GroupEnumUnitsInRange everything was fine. Suddenly new triggers utilizing it won't work UNTIL a trigger that was previously written, such as Blizzzard, is called. I don't understand at all whats happening.
Edit: Also my current work around is making a unit cast blizzard at the start of the map and get removed afterward. It works in any player slot (0-11) however it doesn't work in neutral slots. So weird.
Edit: Also my current work around is making a unit cast blizzard at the start of the map and get removed afterward. It works in any player slot (0-11) however it doesn't work in neutral slots. So weird.
vJASS:
//TESH.scrollpos=20
//TESH.alwaysfold=0
scope SelfDestruct initializer Init
globals
private constant integer ABILID = 'A0IN'
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILID
endfunction
private function Actions takes nothing returns nothing
local unit hero
local unit target
local unit u = null
local group g = CreateGroup()
set hero = GetTriggerUnit()
set target = GetSpellTargetUnit()
call GroupEnumUnitsInRange(g,GetUnitX(target),GetUnitY(target),220,Condition(function EnemyAliveFilter))
loop
set u = FirstOfGroup(g)
exitwhen u == null
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl",u,"chest"))
call Damage_Spell(hero,u,GetUnitAbilityLevel(hero,ABILID)*GetUnitState(target,UNIT_STATE_MAX_LIFE)*0.04+GetHeroInt(hero,true)*0.4)
call GroupRemoveUnit(g,u)
endloop
call DestroyGroup(g)
set g = null
endfunction
private function Init takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig,Condition(function Conditions))
call TriggerAddAction(Trig,function Actions)
endfunction
endscope
vJASS:
//TESH.scrollpos=20
//TESH.alwaysfold=0
scope SelfDestruct initializer Init
globals
private constant integer ABILID = 'A0IN'
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILID
endfunction
private function Actions takes nothing returns nothing
local unit hero
local unit target
local unit u = null
set hero = GetTriggerUnit()
set target = GetSpellTargetUnit()
call GroupEnumUnitsInRange(G2,GetUnitX(target),GetUnitY(target),220,Condition(function EnemyAliveFilter))
loop
set u = FirstOfGroup(G2)
exitwhen u == null
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\FireBallMissile\\FireBallMissile.mdl",u,"chest"))
call Damage_Spell(hero,u,GetUnitAbilityLevel(hero,ABILID)*GetUnitState(target,UNIT_STATE_MAX_LIFE)*0.04+GetHeroInt(hero,true)*0.4)
call GroupRemoveUnit(G2,u)
endloop
endfunction
private function Init takes nothing returns nothing
local trigger Trig = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig,Condition(function Conditions))
call TriggerAddAction(Trig,function Actions)
endfunction
endscope
vJASS:
//TESH.scrollpos=20
//TESH.alwaysfold=0
scope Blizzzard initializer Init
globals
private constant integer ABILID = 'A0HU'
private constant string PROJID = "Blizzzard"
endglobals
private function RemoveBlizzzDummy takes unit dummy returns nothing
call TriggerSleepAction(10)
call RemoveUnit(dummy)
endfunction
private function HitConditions takes nothing returns boolean
return Projectile_Id == PROJID
endfunction
private function HitActions takes nothing returns nothing
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\LichMissile\\LichMissile.mdl",Projectile_HitUnit,"chest"))
call Damage_Spell(Projectile_Source,Projectile_HitUnit,GetUnitAbilityLevel(Projectile_Source,ABILID)*5+GetHeroAgi(Projectile_Source,true)*0.15)
endfunction
private struct Data
unit caster
unit blizzard
integer waves
integer ticks
endstruct
private function Core takes nothing returns boolean
local Data d = TT_GetData()
local Projectile p
local integer b
local unit u = null
local unit dummy = d.blizzard
call UnitAddAbility(dummy,'A0HV')
call IssuePointOrderLoc(dummy,"blizzard",GetUnitLoc(dummy))
if d.ticks > 0 and d.waves > 0 then
set P = GetOwningPlayer(d.caster)
call GroupEnumUnitsInRange(G2,GetUnitX(d.blizzard),GetUnitY(d.blizzard),200,Condition(function EnemyAliveFilter))
if CountUnitsInGroup(G2) > 0 then
set b = d.waves
loop
exitwhen b == 0
// call IssuePointOrderLoc(dummy,"blizzard",GetUnitLoc(dummy))
loop
set u = FirstOfGroup(G2)
exitwhen u == null
set p = Projectile.create()
call p.ProjectileSetId(PROJID)
call p.ProjectileSetModel("Abilities\\Weapons\\LichMissile\\LichMissile.mdl",255,255,255,255,0.8)
call p.ProjectileTargetHoming(d.caster,GetUnitX(d.blizzard),GetUnitY(d.blizzard),20,u,22)
call GroupRemoveUnit(G2,u)
endloop
set b = b - 1
endloop
endif
else
set dummy = null
call RemoveBlizzzDummy.execute(dummy)
call RemoveUnit(d.blizzard)
call d.destroy()
return true
endif
// call IssuePointOrderLoc(dummy,"blizzard",GetUnitLoc(dummy))
set d.ticks = d.ticks - 1
return false
endfunction
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == ABILID
endfunction
private function Actions takes nothing returns nothing
local Data d = Data.create()
local unit caster = GetTriggerUnit()
set d.caster = caster
set d.blizzard = CreateUnit(Player(bj_PLAYER_NEUTRAL_VICTIM),'dumy',GetSpellTargetX(),GetSpellTargetY(),GetRandomReal(0,360))
// set d.blizzard = CreateUnit(GetOwningPlayer(caster),'dumy',GetSpellTargetX(),GetSpellTargetY(),GetRandomReal(0,360))
set d.waves = R2I(1+(GetHeroInt(caster,true))*0.1)
set d.ticks = R2I(1+(GetHeroInt(caster,true))*0.1)
call TT_StartEx(function Core,d,1)
set caster = null
endfunction
private function Init takes nothing returns nothing
local trigger Trig = CreateTrigger()
local trigger Hit = CreateTrigger()
call TriggerRegisterEventProjectileHit(Hit)
call TriggerAddCondition(Hit,Condition(function HitConditions))
call TriggerAddAction(Hit,function HitActions)
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(Trig,Condition(function Conditions))
call TriggerAddAction(Trig,function Actions)
endfunction
endscope
Last edited: