• 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.

[Trigger] Removing events from triggers

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
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)
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
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.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
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.
 
Level 12
Joined
Mar 23, 2008
Messages
942
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).
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
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?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
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.
 
Level 12
Joined
Mar 23, 2008
Messages
942
... 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?
 
Level 12
Joined
Mar 23, 2008
Messages
942
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?
 
Level 12
Joined
Mar 23, 2008
Messages
942
I don't know what you mean, but it might work. I still suggest the damage check method, since negative values are a little bit unreliable.
Now I'm not sure if its a negative value, I think its a natural war debuf who increases damage taken to unit...
I made my spell after seeing that skill, but I can't find it again o.o
 
Level 12
Joined
Mar 23, 2008
Messages
942
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:
Level 22
Joined
Dec 31, 2006
Messages
2,216
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])
 
Level 12
Joined
Mar 23, 2008
Messages
942
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.
 
Level 7
Joined
Oct 14, 2008
Messages
340
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.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
  • 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.
 
Level 7
Joined
Oct 14, 2008
Messages
340
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.
 
Level 12
Joined
Mar 23, 2008
Messages
942
  • 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.
Top