Narks
Vastly intelligent whale-like being from the stars
- Reaction score
- 90
tornado aura?
If you are using dummy auras hidden in disabled spellbooks...The problem with using dummy auras is, that removing a dummy aura from a unit closes the spellbook, if the player has it opened.
Hmm, you didn't understand what I mean, so I try to be a little bit more precise:I don't see how that is a problem. How could you possibly have a disabled spellbook open?
Not if the ability is directly applied to the buffed unit and only affects the unit itself. In this case, the buff icon appears instantly, as the game doesn't need to do enumerations internally here. Also, I think J4L doesn't scan for the actual buff icon, but only for the tornado ability applied to that unit.@J4L: Using an aura, upon addition, isn't there a momentary delay before the buff actually shows up on a unit?
I didn't know removing a spellbook from a unit closed all open menus - that explains why in DotA occasionally the select ability menu closes itself (or is it just spellbooks...).I didn't know that the tornado aura doesn't have an UI icon and thus doesn't close open spellbooks upon removal. Awesome.
Yeah, I'm intending on it when I get around to it. It's just they're particularly advanced features, because of their self-cleansing stuff if you just destroy the buff, so I need to think carefully on it and find time to do it.Is it possible to add .createTrigger, .destroyTrigger, .startTimer, and .stopTimer like in SpellStruct or would you rather have people keep track of their own triggers and timers in BuffStruct?
Its not the removing of spellbooks that closes all UI, but the removing of abilities that have an UI button.I didn't know removing a spellbook from a unit closed all open menus - that explains why in DotA occasionally the select ability menu closes itself (or is it just spellbooks...).
The buff cannot be removed via a default WC3 ability. It may only be removed through removing it with triggers.Does the onRemove method fire when the buff is removed via ability?
like purge or something.
//! runtextmacro BuffType("MyBuff")
//! runtextmacro SetBuffName("My Buff")
//! runtextmacro SetBuffAlignment("NEUTRAL")
//! runtextmacro SetBuffTooltip("This unit is buffed. Isn't that cool?")
//! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNDaggerOfEscape.blp")
//! runtextmacro BuffStruct()
unit caster
method onCreate takes nothing returns nothing
set this.caster=GetSpellAbilityUnit() // this should probably be set externally, but hey, this is an example. And it works!
endmethod
method killCaster takes nothing returns nothing
if this.getType()!=thistype.typeid then
return // this will only continue if the struct type is thistype.
endif // meaning it is safe to call this method on any BuffStruct type, and it will just fail if it is the wrong type.
call KillUnit(this.caster)
endmethod
//! runtextmacro EndBuff()
function KillCastersOfMyBuffForUnit takes unit u returns nothing
call BuffList[unit].forEachBuff(BUFF_ALIGNMENT_NEUTRAL, MyBuff.killCaster) // passes in the killCaster method. Which has been made safe by those three magic lines. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" />
endfunction
//! runtextmacro BuffType("MyBuff")
//! runtextmacro SetBuffName("My Buff")
//! runtextmacro SetBuffAlignment("NEUTRAL")
//! runtextmacro SetBuffTooltip("This unit is buffed. Isn't that cool?")
//! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNDaggerOfEscape.blp")
//! runtextmacro BuffStruct()
unit caster
// this should probably be set externally, and this time it will be.
//method onCreate takes nothing returns nothing
// set this.caster=GetSpellAbilityUnit()
//endmethod
method killCaster takes nothing returns nothing
if this.getType()!=thistype.typeid then
return // this will only continue if the struct type is thistype.
endif // meaning it is safe to call this method on any BuffStruct type, and it will just fail if it is the wrong type.
call KillUnit(this.caster)
endmethod
//! runtextmacro EndBuff()
function WhenMySpellCasts takes nothing returns nothing
local MyBuff b=MyBuff.create(null) // we apply it to a null unit, as not to apply Status effects, yet, before struct members are set.
set b.caster=GetSpellAbilityUnit()
call b.setUnit(GetSpellTargetUnit())
endfunction
function WhenMySpellCasts takes nothing returns nothing
local MyBuff b=MyBuff.create(null) // we apply it to a null unit, as not to apply Status effects, yet, before struct members are set.
set b.caster=GetSpellAbilityUnit()
call b.setUnit(GetSpellTargetUnit())
endfunction
you can't retrieve a buff from a unit, if the buff is applied from another function/trigger.
I'm thinking it makes sense to return the first instance. Reason being, let's say a unit has a buff which blocks an attack, or a spell, for 5 seconds. It should remove the oldest buff, in theory. Any suggestions?I totally agree on MyBuffType[unit]. The problem there is what if it has the buff twice? I propose to return the last instance added, or maybe the first. I'm not sure which, hence why I haven't added this yet either. Thinking carefully...
yes, that sounds logical.I'm thinking it makes sense to return the first instance. Reason being, let's say a unit has a buff which blocks an attack, or a spell, for 5 seconds.
ItemStruct 2 was able to get 'per instance' accuracy by using ItemUserData..Any suggestions?
That's all this does... that's what structs are.something like giving a unique instance a unique index or something along those lines.