- Joined
- May 4, 2007
- Messages
- 2,260
Hi guys, i have a small problem. I have 2 simple triggers but i want to put them into 1 trigger. I want to use "Call Add Event" but i don't know how that works.
Anyway here they are:
trigger 1:
trigger 2:
The 1st trigger is fired when the unit uses the item. All units are picked and a buff is give to them.
The second trigger sets a chance to cast an ability, to the units who have that same buff.
I don't like using buffs because they don't stack ... Is there any other solution ?? Can i get these 2 triggers together ?
Anyway here they are:
trigger 1:
JASS:
function LightningAttack_Conds takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'I012'
endfunction
//================================================================
function LightningAttack_Acts takes nothing returns nothing
local group Targets = CreateGroup()
local unit vic
local unit caster = GetTriggerUnit()
local unit dummy
call GroupEnumUnitsInRange( Targets, GetUnitX( caster ), GetUnitY( caster ), 600, Filter(null) )
loop
set vic = FirstOfGroup( Targets )
exitwhen vic==null
if IsUnitAlly(vic, GetOwningPlayer(caster)) then
set dummy = CreateUnit(GetOwningPlayer(caster), 'h01H', GetUnitX(vic), GetUnitY(vic), 0)
call UnitAddAbility(dummy, 'A046')
call IssueTargetOrder(dummy, "innerfire", vic)
call UnitApplyTimedLife(dummy, 'BTLF', 2.5)
endif
call GroupRemoveUnit(Targets,vic)
endloop
call DestroyGroup(Targets)
call SetUnitExploded(dummy, true)
set Targets = null
set caster = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Lightning_Attack_Cast takes nothing returns nothing
local trigger LightningAttack = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( LightningAttack, EVENT_PLAYER_UNIT_USE_ITEM )
call TriggerAddCondition( LightningAttack, Condition( function LightningAttack_Conds) )
call TriggerAddAction( LightningAttack, function LightningAttack_Acts )
set LightningAttack = null
endfunction
trigger 2:
JASS:
function LightningAttackDamage_Conds takes nothing returns boolean
local integer Dchance = 5
return GetUnitAbilityLevel(GetAttacker(), 'B02G')>0 and GetRandomInt(1, 100)<= Dchance
endfunction
//==========================================================================
function LightningAttackDamage_Acts takes nothing returns nothing
local unit att = GetAttacker()
local unit dum = CreateUnit( GetOwningPlayer(att), 'h01H', GetUnitX(att), GetUnitY(att), 0)
call UnitApplyTimedLife(dum, 'BTLF', 2.5)
call UnitAddAbility(dum, 'A045')
call IssueTargetOrder(dum, "chainlightning", GetTriggerUnit())
call SetUnitExploded(dum, true)
set att = null
set dum = null
endfunction
//===========================================================================
function InitTrig_Lightning_Attack_Damage takes nothing returns nothing
local trigger LightningAttackDamage = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( LightningAttackDamage, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( LightningAttackDamage, Condition( function LightningAttackDamage_Conds ) )
call TriggerAddAction( LightningAttackDamage, function LightningAttackDamage_Acts )
set LightningAttackDamage = null
endfunction
The 1st trigger is fired when the unit uses the item. All units are picked and a buff is give to them.
The second trigger sets a chance to cast an ability, to the units who have that same buff.
I don't like using buffs because they don't stack ... Is there any other solution ?? Can i get these 2 triggers together ?