call TriggerRemoveAction
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
Okay, but I said I don't care if its gui or jass.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.
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?
Can't I just use that spell who blocks all damage by % and use negative value? Like the Orchid Staff in Dota?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.
Now I'm not sure if its a negative value, I think its a natural war debuf who increases damage taken to unit...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.
But will mana shield use mana each attack?Mana Shield can block damage or increase it if you use negative values and spirit link can share the damage with another unit.
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
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.Uhm, exactly :3 If that works will help me alot!I believe it's possible to usecall DestroyTrigger(gg_trg_Double_Damage)
and then remake it by usingset 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])
call TriggerRegisterAnyUnitEventBJ( gg_trg_Double_Damage, EVENT_UNIT_DAMAGED )
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
JASS:function Trig_Double_Damage_Conditions takes nothing returns boolean return (GetUnitAbilityLevel(GetTriggerUnit(), 'B00J') > 0) endfunction
The buff detection calls the ability detection.shouldn't the condition be a buff detection?
err, where does the target pick up 'B00J' ??