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:
    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 The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top