• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Removing events from triggers

Status
Not open for further replies.
It don't mind if its jass or gui, but I have a spell that increase the next damage the unit takes, but I need to remove the buff after it takes any damage. (and also, remove the event, or in the end of the game the trigger will have 500 events or more o.o)

(Also, what is the name of the spell who gives % protection from all damages? I need to find it to put a negative value, I found it yesterday but I forgot xD)
 
In probably most cases it would work if you'd turn it off with 'Trigger - Turn Off', and then execute the trigger with 'Trigger - Run'. This will ofcourse force you to make the trigger run by triggers only.

Another option is to make a copy of the trigger without the event. Then you turn off the first trigger and turn on the copy of that trigger.
 
u can just make it like:

Event- Unit is attacked
Condition - Attacked uint has buff <your buff>
Action - Remove buff

To lazy to open op WE but this should work :P

No it shouldn't, because if you'd look at the other 394857 threads with this events, you'd see that "Unit is attacked" is fired when a unit is STARTING to attack and not hitting the target.

As to removing events - you can't.

You can't make a on-damage detection in GUI without leaking.
 
No it shouldn't, because if you'd look at the other 394857 threads with this events, you'd see that "Unit is attacked" is fired when a unit is STARTING to attack and not hitting the target.

As to removing events - you can't.

You can't make a on-damage detection in GUI without leaking.
Okay, but I said I don't care if its gui or jass.
I have many spells that uses temporarily "Takes Damage" events, I just need a way to remove it (or the entire trigger, if I can remake him).
 
No it shouldn't, because if you'd look at the other 394857 threads with this events, you'd see that "Unit is attacked" is fired when a unit is STARTING to attack and not hitting the target.

As to removing events - you can't.

You can't make a on-damage detection in GUI without leaking.

Yeh, that's true but think about it.
If you throw in a condition that it will only work when an enemy unit attacks it would work fine.

Because: why would an enemy attack and then stop to remove a buff that's in their advantage?
 
Yeh, that's true but think about it.
If you throw in a condition that it will only work when an enemy unit attacks it would work fine.

Because: why would an enemy attack and then stop to remove a buff that's in their advantage?

Ever heard of bugs abuse? A player attacks,stops,attacks,stops,attacks,stops and poops your game is messed up.

As to your second sentence, I didn't hear here anything that has to do with buffs, but even if it's to their advantage, people will always find away to mess up the game if they find how.
 
... The problem is my buff doubles the damage the target takes, ANY damage, not only attacks.
My other buf nulls the next damage, and the other sends all the damage to another unit.

They are all based in "Takes Damage" events, there is a way to double the trigger, add the event to the duplicate and delete it? Or remove the event? Or delete the entire trigger and do another one like it? In JASS?
 
Check the 'checking for damage' tutorial and use it to check the damage, and use the damage command to do damage by trigger equal to the damage dealt. That way you actually check all damage sources and give it 2 times that damage.
Can't I just use that spell who blocks all damage by % and use negative value? Like the Orchid Staff in Dota?

Edit: Also, I can't find that damn skill again, someone knows it?
 
I can't use mana shield, it needs a activation...

Edit: Actually, I can use nothing because I can't remove the damn events from the trigger.

My trigger isn't working, its not doing more damage or either removing the buf from the unit...
  • Lex Aeterna
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lex Aeterna (based in Channel)
    • Actions
      • Set SpellPoint[0] = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at SpellPoint[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Trigger - Add to Double Damage <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
JASS:
function Trig_Double_Damage_Conditions takes nothing returns boolean
    return (GetUnitAbilityLevel(GetTriggerUnit(), 'B00J') > 0)
endfunction

function Trig_Double_Damage_Actions takes nothing returns nothing
    local unit caster = GetEventDamageSource()
    local unit target = GetTriggerUnit()
    local real damage = GetEventDamage()
    call UnitRemoveAbility(target, 'B00J')
    call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE, WEAPON_TYPE_WHOKNOWS)
    set caster = null
    set target = null
endfunction

//===========================================================================
function InitTrig_Double_Damage takes nothing returns nothing
    set gg_trg_Double_Damage = CreateTrigger()
    call TriggerAddCondition(gg_trg_Double_Damage, Condition(function Trig_Double_Damage_Conditions))
    call TriggerAddAction(gg_trg_Double_Damage, function Trig_Double_Damage_Actions)
endfunction

Also, can I use DestroyTrigger(GetTrigerringTrigger()) and them "remake" the trigger with CreateTrigger()? If yes, how? That will remove the event "Takes damage?"
 
Last edited:
I believe it's possible to use call DestroyTrigger(gg_trg_Double_Damage) and then remake it by using set gg_trg_Double_Damage = CreateTrigger() but this will remove all the events from the trigger.
But you could make another trigger which checks if any units got the buff and if not then destroy the trigger and when you use the spell on someone you check if the trigger is destroyed and if it is then recreate the trigger and after that you add the a new event to the trigger. This way it won't bug I think, but I have never tested this.

Example:
  • Lex Aeterna
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lex Aeterna (based in Channel)
    • Actions
      • Set SpellPoint[0] = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at SpellPoint[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Custom script: if gg_trg_Double_Damage == null then
      • Custom script: set gg_trg_Double_Damage = CreateTrigger()
      • Custom script: endif
      • Trigger - Add to Double Damage <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
 
I believe it's possible to use call DestroyTrigger(gg_trg_Double_Damage) and then remake it by using set gg_trg_Double_Damage = CreateTrigger() but this will remove all the events from the trigger.
But you could make another trigger which checks if any units got the buff and if not then destroy the trigger and when you use the spell on someone you check if the trigger is destroyed and if it is then recreate the trigger and after that you add the a new event to the trigger. This way it won't bug I think, but I have never tested this.

Example:
  • Lex Aeterna
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lex Aeterna (based in Channel)
    • Actions
      • Set SpellPoint[0] = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at SpellPoint[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Custom script: if gg_trg_Double_Damage == null then
      • Custom script: set gg_trg_Double_Damage = CreateTrigger()
      • Custom script: endif
      • Trigger - Add to Double Damage <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
Uhm, exactly :3 If that works will help me alot!
But... first the trigger itself need to works o.o

Its not damaging the unit.
 
well looking at your jass code there,
i don't see any events registered.
is that maybe el problemo?

like:
JASS:
call TriggerRegisterAnyUnitEventBJ( gg_trg_Double_Damage, EVENT_UNIT_DAMAGED )

EDIT
oh oh oh, nevermind, i didn't examine the situation enough. sorry.
 
  • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at SpellPoint[0] facing Default building facing degrees
  • Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)
Lol you did add the spell to the dummy right?
Cause thats the way to do it, make 1 dummy and with every spell u just add the spell you want the dummy to cast to the dummy.
 
perhaps you can write a code that detects the attack or buff or whatever you're looking for, then have the actions of that trigger create an entirely new trigger and you can add the event, and actions, then destroy the trigger after a timer runs.
 
  • Lex Aeterna
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lex Aeterna (based in Channel)
    • Actions
      • Set SpellPoint[0] = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at SpellPoint[0] facing Default building facing degrees
      • Unit - Order (Last created unit) to Undead Banshee - Curse (Target unit of ability being cast)
      • Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
      • Trigger - Add to Double Damage <gen> the event (Unit - (Target unit of ability being cast) Takes damage)
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
JASS:
function Trig_Double_Damage_Conditions takes nothing returns boolean
    return (GetUnitAbilityLevel(GetTriggerUnit(), 'B00J') > 0)
endfunction

function Trig_Double_Damage_Actions takes nothing returns nothing
    local unit caster = GetEventDamageSource()
    local unit target = GetTriggerUnit()
    local real damage = GetEventDamage()
    call UnitRemoveAbility(target, 'B00J')
    call UnitDamageTarget(caster, target, damage, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_DIVINE, WEAPON_TYPE_WHOKNOWS)
    call DisplayTextToPlayer(GetOwningPlayer(GetEventDamageSource()), 0, 0, I2S(R2I(damage)))
    set caster = null
    set target = null
endfunction

//===========================================================================
function InitTrig_Double_Damage takes nothing returns nothing
    set gg_trg_Double_Damage = CreateTrigger()
    call TriggerAddCondition(gg_trg_Double_Damage, Condition(function Trig_Double_Damage_Conditions))
    call TriggerAddAction(gg_trg_Double_Damage, function Trig_Double_Damage_Actions)
endfunction
Ok, I tried it on a peon... don't work, on a acolyte, don't work... Tried on a water elemental, worked o.O?

wtf?
 
Status
Not open for further replies.
Back
Top