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
399
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
399
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
399
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
399
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.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      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