- Joined
- Jul 26, 2008
- Messages
- 1,009
Alright, what this spell is suppose to do is curse one random unit in a 650 range every 0.75 for 5.75 seconds. Meaning it happens 7 times. The curse can be one of five things. Curse, Sleep, Impale, Attack an Ally, or Move to a random spot. The latter two elicit the idea of body manipulation thru Voodoo.
Unfortunately I'm not sure how to finish the trigger that I've started, nor does the trigger work at all. I'm also not sure what base spell to use, as I don't want to use Thunderclap, FanofKnives, or Warstomp because other skills use those as well. Right now I'm trying out Avatar.
I rarely use periodic timers, and I always have trouble with pick units in range. So I'm at quite a loss here. Any help is appreciated.
Unfortunately I'm not sure how to finish the trigger that I've started, nor does the trigger work at all. I'm also not sure what base spell to use, as I don't want to use Thunderclap, FanofKnives, or Warstomp because other skills use those as well. Right now I'm trying out Avatar.
JASS:
function VoodooCurseConditions takes nothing returns boolean
//Checks to see if the spell being cast is Voodoo Curse
if GetSpellAbilityId() == 'VdCu' then
return true
endif
return false
endfunction
function CurseConditions takes nothing returns boolean
//Checks to see if the candidates for curse are enemies
return ( IsUnitAlly(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == false )
endfunction
function CurseActions takes nothing returns nothing
local integer random = GetRandomInt(1,5)
local integer i = 1
if random == 1 then
//The Attack-Ally curse
call IssueTargetOrder( GroupPickRandomUnit(GetLastCreatedGroup()), "attack", GroupPickRandomUnit(GetLastCreatedGroup()) )
elseif random == 2 then
//The Move to Random spot curse.
call IssuePointOrderLoc( GroupPickRandomUnit(GetLastCreatedGroup()), "move", OffsetLocation(GetUnitLoc(GetTriggerUnit()), GetRandomReal(900.00, 900.00), 0) )
elseif random == 3 then
//Curse, curse . . .
call CreateNUnitsAtLoc( 1,'e008', GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(GroupPickRandomUnit(GetLastCreatedGroup())), 0.00 )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'Acrs', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'Aloc', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'Avul', GetLastCreatedUnit() )
call IssueTargetOrder( GetLastCreatedUnit(), "curse", GroupPickRandomUnit(GetLastCreatedGroup()) )
elseif random == 4 then
//Sleep curse
call CreateNUnitsAtLoc( 1,'e008', GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(GroupPickRandomUnit(GetLastCreatedGroup())), 0.00 )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'AUsl', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'Aloc', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'Avul', GetLastCreatedUnit() )
call IssueTargetOrder( GetLastCreatedUnit(), "sleep", GroupPickRandomUnit(GetLastCreatedGroup()) )
elseif random == 5 then
//Impale Curse
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'AUim', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'Aloc', GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'Avul', GetLastCreatedUnit() )
call IssueTargetOrder( GetLastCreatedUnit(), "impale", GroupPickRandomUnit(GetLastCreatedGroup()) )
endif
set i = i + 1
if i >= 7 then
//Here is where I'm not sure how to stop the Periodic Timer so the cursing stops.
endif
endfunction
function callback takes nothing returns nothing
//Here the timer begins, picking every enemy unit in the area for the curse
call ForGroupBJ( GetUnitsInRangeOfLocMatching(650.00, GetUnitLoc(GetTriggerUnit()), Condition(function CurseConditions)), function CurseActions )
endfunction
function VoodooCurseActions takes nothing returns nothing
local timer t = CreateTimer()
//Here, we call and destroy the timer
call TimerStart(t,0.75,true,function callback)
call DestroyTimer(t)
set t = null
endfunction
//===========================================================================
function InitTrig_Voodoo_Curse takes nothing returns nothing
set gg_trg_Voodoo_Curse = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Voodoo_Curse, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Voodoo_Curse, Condition( function VoodooCurseConditions ) )
call TriggerAddAction( gg_trg_Voodoo_Curse, function VoodooCurseActions )
endfunction
I rarely use periodic timers, and I always have trouble with pick units in range. So I'm at quite a loss here. Any help is appreciated.