HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

2 events, conditions, and actions

04-21-2007, 05:13 PM#1
darkwulfv
Trigger:
Blade Cage No Attacks
Collapse Events
Unit - A unit Is attacked
Unit - A unit Begins casting an ability
Collapse Conditions
Collapse Or - Any (Conditions) are true
Collapse Conditions
((Attacked unit) has buff AA_Blade Cage ) Equal to True
((Target unit of ability being cast) has buff AA_Blade Cage ) Equal to True
Collapse Actions
Unit - Order (Attacking unit) to Stop
Unit - Order (Casting unit) to Stop

Will this stop not only attacking, but spellcasting units? Or will it stop one or the other? It's impossible for it to fire on the same unit for both events, and I would assume that if no unit is casting an ability, Casting Unit would return null.
04-21-2007, 05:22 PM#2
MaD[Lion]
this will stop casting and attacking unit agains a unit with that buff.
and cannot oocur same time on same unit, cus no untio can cast and attack at the same time
04-21-2007, 05:31 PM#3
darkwulfv
I thought so, but no point in not asking.
04-21-2007, 05:49 PM#4
Earth-Fury
A trigger is an event listener, esentally. when an event happens, the condition is checked, then the action function is excecuted. So of course it should work, if all the event-response functions return null when the event(s) they corrospond to haven't happend.
04-21-2007, 05:49 PM#5
zen87
instead, i'll suggest you add these 2 ability to the unit
- ethernal ('Aetl')
- spell immune / spell resistance of 100%

or just make the unit invulnerable ? O_o
04-21-2007, 06:05 PM#6
darkwulfv
I don't want to make the unit invulnerable, and I'll explain why.

The ability traps a unit for 7 seconds. it can't be attacked or targeted for any type of spell. After 7 seconds, 4 dummy units cast a damaging spell on it. (I added a check to ensure the spell will pass through this trigger). If I made the unit invulnerable, the dummies couldn't cast upon it.

EDIT: Converted to JASS for optimization... I almost cried at how ugly it was. 5 or so functions, lots of BJ's, useless If thens.... here's the final result:

Collapse JASS:
function Blade_Cage_No_Attacks_Actions takes nothing returns nothing
   if ( GetUnitAbilityLevel(GetAttackedUnitBJ(), 'B00T') > 0 ) then
       call IssueImmediateOrder(GetAttacker(), "stop")
   endif
   if GetSpellAbilityId() != 'A020' and GetUnitAbilityLevel(GetSpellTargetUnit(), 'B00T') > 0 then
       call IssueImmediateOrder( GetSpellAbilityUnit(), "stop" )
   endif
endfunction

//===========================================================================
function InitTrig_Blade_Cage_No_Attacks takes nothing returns nothing
  local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ATTACKED )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddAction( t, function Blade_Cage_No_Attacks_Actions )
set t = null
endfunction
04-22-2007, 07:23 AM#7
zen87
*cough*

remove the invulnerability before order the dummy to cast spell upon it -.-?? i cant figure out why is that not working... if i remember correctly, invulnerability does not remove buff like ensare or such...
04-22-2007, 01:57 PM#8
darkwulfv
It's more precise and accurate to do it through this method. Plus, I can add error messages.