HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Buffs

10-23-2006, 03:17 PM#1
aidan_124
How do i get a trigger only to run if a unit has a specific buff
Collapse JASS:
function Sudden_Shock_Conditions takes nothing returns boolean
return GetSpellAbilityId()=='A002'
endfunction

function Sudden_Shock_Conditions2 takes nothing returns boolean
return UnitHasBuffBJ(GetSpellTargetUnit(), 'B000')
endfunction

function Sudden_Shock_Actions takes nothing returns nothing
local integer i = GetUnitAbilityLevel(GetSpellAbilityUnit(),'A002')

call UnitDamageTarget(GetSpellAbilityUnit(),GetSpellTargetUnit(),50*i,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_TYPE_WHOKNOWS)
call AddSpecialEffect("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt",GetUnitX(GetSpellTargetUnit()),GetUnitY(GetSpellTargetUnit()))
call DisplayTextToForce(GetPlayersAll(),"Debug")
call TriggerSleepAction(0.75)
call DestroyEffect(GetLastCreatedEffectBJ())
endfunction

function InitTrig_Sudden_Shock takes nothing returns nothing
local trigger gg_trg_Sudden_Shock
call TriggerRegisterAnyUnitEventBJ(gg_trg_Sudden_Shock,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(gg_trg_Sudden_Shock, Condition(function Sudden_Shock_Conditions))
call TriggerAddCondition(gg_trg_Sudden_Shock, Condition(function Sudden_Shock_Conditions2))
call TriggerAddAction(gg_trg_Sudden_Shock,function Sudden_Shock_Actions)
call Preload("Doodads\\Cinematic\\Lightningbolt\\Lightningbolt")
endfunction

Currently that doesn#t work for some reason :(
10-23-2006, 03:20 PM#2
Chuckle_Brother
Is 'B000' applied by the spell being cast?

If so, then that won't work since you are based on a Unit Begins Casting, not a Unit Starts the Effect of an Ability.

So use
Trigger:
Unit - A unit Starts the effect of an ability
as your action and see if that works.
10-23-2006, 05:54 PM#3
aidan_124
No the Buff is cast by a different ability.
Changed the Event anyway as it should be part of the effect.