- Joined
- Jun 7, 2008
- Messages
- 440
I was wondering, is there a way to make a dummy unit spawn in an random area within 800 of a target unit. And ( I know how to add an ability) is it more efficient to have the created unit cast an ability (fearie fire) and then have that same unit attack the target (with 100% bash) or create a second dummy and have it attack the same unit?
All I am really worried about is creating the dummy in a random spot basically this is what I got (I dont know how to make it a periodic event, nor how to make it a random spot):
Thanks in advance (once again)
All I am really worried about is creating the dummy in a random spot basically this is what I got (I dont know how to make it a periodic event, nor how to make it a random spot):
JASS:
function Trig_Stunner_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00C'
endfunction
function Trig_Stunner_Actions takes nothing returns nothing
local unit cast = GetTriggerUnit()
local location t = GetSpellTargetLoc()
local group g = CreateGroup()
local unit u = FirstOfGroup(g)
local unit dumb
call GroupEnumUnitsInRangeOfLoc(g, t, 800, null)
loop
set u = FirstOfGroup(g)
exitwhen u==null
if IsUnitEnemy(u, GetOwningPlayer(cast)) then
set dumb = CreateUnit(GetOwningPlayer(cast), 'h008', GetUnitX(cast), GetUnitY(cast), 0.00)
call UnitAddAbility(dumb, 'A00F')
call IssueTargetOrder(dumb, "faeriefire", u)
call UnitApplyTimedLife(dumb, 'BTLF', 3)
// I don't know whether to order the dummy to attack, or create another one.
endif
call GroupRemoveUnit(g,u)
endloop
call RemoveLocation(t)
call DestroyGroup(g)
set g = null
set dumb = null
set cast = null
set t = null
endfunction
//===========================================================================
function InitTrig_Stunner takes nothing returns nothing
set gg_trg_Stunner = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Stunner, EVENT_PLAYER_UNIT_SPELL_EFFECT )// I want to make this a repeating event, but Im not sure how to make it every half second.
call TriggerAddCondition( gg_trg_Stunner, Condition( function Trig_Stunner_Conditions ) )
call TriggerAddAction( gg_trg_Stunner, function Trig_Stunner_Actions )
endfunction
Thanks in advance (once again)









