Rainther
I guess I should write something of value here...
- Reaction score
- 61
Sure, please answer my question first: Do you only have one of these heroes?
There is no need for unit groups.
Just every 0.03 (or what have you) seconds of game time, pick every unit that has taunter buff (unit that casts gets the buff) and then pick all units in X units around them and order them to attack the taunter.
then order them every 0.1 seconds
Oh yeah. Forgot about it thanks Kikac. The trigger gives itself an everlasting loop which I forgot about.
Use this instead:Trigger:
- Taunter
- Events
- Unit - A unit Is issued an order with no target
- Unit - A unit Is issued an order targeting an object
- Unit - A unit Is issued an order targeting a point
- Conditions
- ((Triggering unit) has buff Taunted) Equal to True
- Actions
- Set TempGroup= (Units of type Human Footman)
- Trigger - Turn off (This trigger)
- Unit - Order (Triggering unit) to Attack (Random unit from TempGroup)
- Trigger - Turn on (This trigger)
- Custom script: call DestroyGroup(udg_TempGroup)
This makes the event to not trigger itself.
function Trig_Berserker_Call_Conditions takes nothing returns boolean
if(not(GetSpellAbilityId()==039;A0C7039;))then
return false
endif
return true
endfunction
function Berserker_Call_Buff takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(),039;BHwe039;)>0
endfunction
function Berserker_Call_Aim takes nothing returns nothing
local unit lMy=GetUnit(H2Tx(GetTriggeringTrigger()),"Axe")
if GetUnitState(lMy,UNIT_STATE_LIFE)>0 then
call DisableTrigger(GetTriggeringTrigger())
call IssueTargetOrderById(GetTriggerUnit(),OrderId("attack"),lMy)
call EnableTrigger(GetTriggeringTrigger())
endif
endfunction
function Berserker_Call_OrderFilter takes nothing returns boolean
if(UnitHasBuffBJ(GetFilterUnit(),039;BHwe039;))then
if((UnitHasBuffBJ(GetFilterUnit(),039;B008039;)==false)or(UnitHasBuffBJ(GetFilterUnit(),039;Bcyc039;)==false))then
if IsUnitPaused(GetFilterUnit())==false then
return true
endif
endif
endif
return false
endfunction
function Berserker_Call_Caster takes nothing returns nothing
call IssueTargetOrderById(GetEnumUnit(),OrderId("attack"),udg_u_DTAX_temp)
endfunction
function Berserker_Call_CreepVictim takes nothing returns boolean
return GetBooleanAnd((UnitHasBuffBJ(GetFilterUnit(),039;BHwe039;)),GetOwningPlayer(GetFilterUnit())==udg_pA_DTAX_SEPlayers[0]or GetOwningPlayer(GetFilterUnit())==udg_pA_DTAX_SCPlayers[0])
endfunction
function Berserker_Call_CreepAttack takes nothing returns nothing
if(GetOwningPlayer(GetEnumUnit())==udg_pA_DTAX_SEPlayers[0])then
call UnitRemoveAbility(GetEnumUnit(),039;BHwe039;)
call IssuePointOrderByIdLoc(GetEnumUnit(),OrderId("attack"),GetRectCenter(gg_rct_TheFrozenThroneRect))
endif
if(GetOwningPlayer(GetEnumUnit())==udg_pA_DTAX_SCPlayers[0])then
call UnitRemoveAbility(GetEnumUnit(),039;BHwe039;)
call IssuePointOrderByIdLoc(GetEnumUnit(),OrderId("attack"),GetRectCenter(gg_rct_TheWorldTreeRect))
endif
endfunction
function Trig_Berserker_Call_Actions takes nothing returns nothing
local location liD=GetUnitLoc(GetTriggerUnit())
local group lEw
local trigger ltt=CreateTrigger()
local unit lrs=GetSpellAbilityUnit()
call SetHandle(H2Tx(ltt),"Axe",GetTriggerUnit())
call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddCondition(ltt,Condition(function Berserker_Call_Buff))
call TriggerAddAction(ltt,function Berserker_Call_Aim)
call PolledWait(.2)
call CreateNUnitsAtLocFacingLocBJ(1,039;e00E039;,GetOwningPlayer(GetTriggerUnit()),liD,liD)
call RemoveLocation(liD)
call UnitAddAbility(bj_lastCreatedUnit,039;A0E1039;)
call SetUnitAbilityLevelSwapped(039;A0E1039;,bj_lastCreatedUnit,GetUnitAbilityLevel(lrs,039;A0C7039;))
call IssueTargetOrderById(bj_lastCreatedUnit,OrderId("innerfire"),GetTriggerUnit())
set liD=GetUnitLoc(lrs)
set lEw=GetUnitsInRangeOfLocMatching(550.,liD,Condition(function Berserker_Call_OrderFilter))
set udg_u_DTAX_temp=lrs
call ForGroupBJ(lEw,function Berserker_Call_Caster)
call RemoveLocation(liD)
call DestroyGroup(lEw)
call PolledWait(1+.5*GetUnitAbilityLevel(lrs,039;A0C7039;))
set lEw=GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function Berserker_Call_CreepVictim))
call ForGroupBJ(lEw,function Berserker_Call_CreepAttack)
call DestroyGroup(lEw)
call FastFlush(H2Tx(ltt))
call TriggerClearActions(ltt)
call DestroyTriggerEx(ltt)
endfunction
function StartTrigger_Berserker_Call takes nothing returns nothing
set gg_trg_Berserker_Call=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Berserker_Call,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Berserker_Call,Condition(function Trig_Berserker_Call_Conditions))
call TriggerAddAction(gg_trg_Berserker_Call,function Trig_Berserker_Call_Actions)
endfunction