View Full Version : [Trigger] Removing events from triggers
Saishy
10-09-2008, 07:33 PM
If I use:
Lol
Unit - Unit Takes damage
How can I remove it from the trigger?
Airandius
10-09-2008, 07:43 PM
I don't think u can remove an event... xD
U can only add them. (At least in GUI that is.)
Maybe you can jass? Something like this:
call TriggerRemoveAction
Saishy
10-09-2008, 08:28 PM
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)
Avator
10-09-2008, 08:30 PM
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.
Airandius
10-09-2008, 08:31 PM
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
GhostWolf
10-09-2008, 08:36 PM
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.
Saishy
10-09-2008, 08:51 PM
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).
Airandius
10-10-2008, 07:31 AM
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?
GhostWolf
10-10-2008, 07:45 AM
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.
Saishy
10-10-2008, 12:27 PM
... 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?
Avator
10-10-2008, 12:47 PM
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.
Saishy
10-10-2008, 01:18 PM
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?
Avator
10-10-2008, 01:21 PM
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.
Saishy
10-10-2008, 01:50 PM
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
The Reborn Devil
10-10-2008, 01:58 PM
Mana Shield can block damage or increase it if you use negative values and spirit link can share the damage with another unit.
Saishy
10-10-2008, 02:12 PM
Mana Shield can block damage or increase it if you use negative values and spirit link can share the damage with another unit.
But will mana shield use mana each attack?
And my spell allows you to link 2 units to yourself, ALL the damage those units got will be passed to you.
Avator
10-10-2008, 02:15 PM
You can just set the mana cost to 0.
The Reborn Devil
10-10-2008, 05:03 PM
I tested the Spirit Link now and it didn't work so good. But the Mana Shield will work as long as you put in the correct values for it.
Saishy
10-10-2008, 10:40 PM
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])
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?"
The Reborn Devil
10-11-2008, 06:26 AM
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])
spiwn
10-11-2008, 09:04 AM
Defend and Spiked Carapace are also valid.
Saishy
10-11-2008, 01:41 PM
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.
Saishy
10-13-2008, 10:10 PM
Bumped.
Still not working >.<
Maximilianx
10-14-2008, 01:59 AM
well looking at your jass code there,
i don't see any events registered.
is that maybe el problemo?
like:
call TriggerRegisterAnyUnitEventBJ( gg_trg_Double_Damage, EVENT_UNIT_DAMAGED )
EDIT
oh oh oh, nevermind, i didn't examine the situation enough. sorry.
Airandius
10-14-2008, 04:44 PM
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.
Element of Water
10-14-2008, 06:00 PM
After you create the trigger, you have to add the actions and conditions again.
Maximilianx
10-14-2008, 06:59 PM
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.
Saishy
10-14-2008, 11:20 PM
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])
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?
Maximilianx
10-14-2008, 11:24 PM
function Trig_Double_Damage_Conditions takes nothing returns boolean
return (GetUnitAbilityLevel(GetTriggerUnit(), 'B00J') > 0)
endfunction
shouldn't the condition be a buff detection?
err, where does the target pick up 'B00J' ??
Saishy
10-20-2008, 03:53 PM
shouldn't the condition be a buff detection?
err, where does the target pick up 'B00J' ??
The buff detection calls the ability detection.
Bumped... This trigger works for water elementals, and not for acolytes or peons... o.o
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.
Search Engine Optimization by
vBSEO 3.5.1 PL2