System BuffStruct

Grundy

Ultra Cool Member
Reaction score
35
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.

I don't see how that is a problem. How could you possibly have a disabled spellbook open?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
I don't see how that is a problem. How could you possibly have a disabled spellbook open?
Hmm, you didn't understand what I mean, so I try to be a little bit more precise:

Removing a dummy aura from a unit closes ALL opened spellbooks for that unit. Only removing of buffs is always safe.
This is why you basicly need an invisible unit floating overhead of the actual unit that holds the dummy aura, so that the actual unit does not require adding/removing of abilities, but still gets the buff icon.

Only some certain abilities that do not have an icon (like abils based on item abilities) do not close spellbooks.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
@Zwieb: It's based on Slow Aura (Tornado): [ljass]//! i createobject("Aasl",sysIds[sysIdsUsed].abilType)[/ljass], which does not have a UI icon and does not close spellbooks (tested just now).


@J4L: Using an aura, upon addition, isn't there a momentary delay before the buff actually shows up on a unit?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
@J4L: Using an aura, upon addition, isn't there a momentary delay before the buff actually shows up on a unit?
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.

I didn't know that the tornado aura doesn't have an UI icon and thus doesn't close open spellbooks upon removal. Awesome.


Now if only my objectmerger would work ... :(
 

Jesus4Lyf

Good Idea™
Reaction score
397
I didn't know that the tornado aura doesn't have an UI icon and thus doesn't close open spellbooks upon removal. Awesome.
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...).

Yeah, it's based on tornado slow aura. No, as far as I know, there's no delay. But there is a delay on removing the buff when the ability is removed. That's why I remove the ability, and then remove the buff also (to fix that delay). :)
 

Grundy

Ultra Cool Member
Reaction score
35
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?
 

Jesus4Lyf

Good Idea™
Reaction score
397
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?
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. :)

(For now, I'm slowing down a little bit.)
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
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...).
Its not the removing of spellbooks that closes all UI, but the removing of abilities that have an UI button.
There are exceptions to that rule - and some weird bugs also.

Once, I experimented with the Ghost ability of these undead sacrificed acolyte shades. When I was removing the ability alone, UI closed for that unit. If I disabled that ability before removing, it didn't close the UI.
However, that didn't work for ordinary aura abilities. It's weird and one of those many bugs of Warcraft III.

However, if tornado aura works fine, then there is no problem and your system is amazing. However, it requires the object merger and that sucks for me, as mine doesn't work for some reason. :rolleyes:

Sad thing that you didn't wrote this ealier. I wrote my own Buff system for my RPG, which is way less efficient and cool, but I do not want to switch to your system now that I have so many spells using it. :/
 

Jesus4Lyf

Good Idea™
Reaction score
397
JASS:
function RemoveBuff takes BuffStruct b returns nothing
    call b.setUnit(null) // doesn't destroy the buff, just puts it on no unit - so it can be destroyed as per normal.
endfunction

call BuffList[unit].forEachBuff(BUFF_ALIGNMENT_??, RemoveBuff)

Something like that. I think that's the syntax. XD
 

13lade619

is now a game developer :)
Reaction score
398
hmm.. wait this thing does not take arguments?

how about if we want to refer to the 'applier' / caster of the buff to its target?

i.e.
apply a buff that reduced the target's armor (via Status system) according the caster's spell level?..

do we need to attach externally? (using PUI/AIDS)
 

Jesus4Lyf

Good Idea™
Reaction score
397
For any buff, you may find .unit for the unit the buff is on.
If a buff has a caster, you may access them all using typecasting, as is expected.

Example:
For all buffs of type MyBuff, kill the caster:
JASS:
//! 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

Get teh idea?

Edit: Oh, I think you were talking about this...
JASS:
//! runtextmacro BuffType(&quot;MyBuff&quot;)
    //! runtextmacro SetBuffName(&quot;My Buff&quot;)
    //! runtextmacro SetBuffAlignment(&quot;NEUTRAL&quot;)
    //! runtextmacro SetBuffTooltip(&quot;This unit is buffed. Isn&#039;t that cool?&quot;)
    //! runtextmacro SetBuffIcon(&quot;ReplaceableTextures\\CommandButtons\\BTNDaggerOfEscape.blp&quot;)
//! 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

It is done that way so that when onApply is called in the buff struct, all struct members have already been set.
 

13lade619

is now a game developer :)
Reaction score
398
oh yeah.. lol.

JASS:
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


^that.

i forgot it was a struct (even the name says BuffStruct) :facepalm:.
i was treating it as a function..

thanks again.
 

13lade619

is now a game developer :)
Reaction score
398
hmm... i think this has one fatal flaw..

you can't retrieve a buff from a unit, if the buff is applied from another function/trigger.

i think hashtables would enable you to do that though..
a good example is UAC by Romek. it has a retrieval method.
 

Jesus4Lyf

Good Idea™
Reaction score
397
you can't retrieve a buff from a unit, if the buff is applied from another function/trigger.
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...
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?
 

13lade619

is now a game developer :)
Reaction score
398
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.
yes, that sounds logical.

Any suggestions?
ItemStruct 2 was able to get 'per instance' accuracy by using ItemUserData..

well, maybe you can design an Ability/BuffUserData system to go with this...
something like giving a unique instance a unique index or something along those lines.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top