System BuffStruct

fixed by adding a new boolean member of the struct that gets flagged when onDestroy is called,.
That won't work. If another buff is created since that buff is destroyed, it will overwrite the boolean and destroy the new buff.

The correct way to dispel a buff, if you're using destroyTimed, is:
JASS:
//          Use .setUnit(null) to unapply a buff without destroying it.

So basically, instead of destroying the buff, use .setUnit(null) to move it into the void until whatever created it effectively destroys it. :)
 
JASS:
function DestroyDeathRunes takes BuffStruct whatBuff returns nothing
    if whatBuff.getType()==RuneWolf.typeid or whatBuff.getType()==RuneTerror.typeid or whatBuff.getType()==RuneOgre.typeid or whatBuff.getType()==RuneArch.typeid then
        call whatBuff.setUnit(null)
    endif
endfunction

    call BuffList[target].forEachBuff(BUFF_ALIGNMENT_POSITIVE, DestroyDeathRunes)
    call BuffList[target].forEachBuff(BUFF_ALIGNMENT_NEGATIVE, DestroyDeathRunes)
    call BuffList[target].forEachBuff(BUFF_ALIGNMENT_NEUTRAL, DestroyDeathRunes)


works. thanks again.
 
JASS:
library Returning
globals
private real x
private real y
endglobals
//! runtextmacro BuffType("Returning")
    //! runtextmacro SetBuffName("Returning")
    //! runtextmacro SetBuffAlignment("NEUTRAL")
    //! runtextmacro SetBuffTooltip("This unit is being Returned; it will return to its previous location soon.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNUnload.blp")
//! runtextmacro BuffStruct()
    method onCreate takes nothing returns nothing
        set x=GetUnitX(this.unit)
        set y=GetUnitY(this.unit)
    endmethod
    method preDestroy takes nothing returns nothing
        local Returned b = Returned.create(this.unit)
    endmethod
//! runtextmacro EndBuff()

//! runtextmacro BuffType("Returned")
    //! runtextmacro SetBuffName("Returned")
    //! runtextmacro SetBuffAlignment("NEUTRAL")
    //! runtextmacro SetBuffTooltip("This unit has just been returned to it's previous location.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNLoad.blp")
//! runtextmacro BuffStruct()

    method onApply takes nothing returns nothing
        call SetUnitX(this.unit,x)
        call SetUnitY(this.unit,y) 
    endmethod
    method preDestroy takes nothing returns nothing

    endmethod
//! runtextmacro EndBuff()

endlibrary


Should this work?:nuts:
Its supposed to be a sort of stealable "return unit" buff. It's similar to one on first post but i like the idea of the buff icon being unload/load cause it makes it look snazzier.
 
Each time you use the "BuffType("SOMETHING")" textmacro, it creates a new struct, and after it you can configure it until you close it with the "EndBuff()" textmacro (it adds the endstruct).
So I think that will work. But you can easily test it.
 
Sorry for the delayed response. :)

It will not multi-instance whatsoever, since the coordinates are stored, for the duration of the buff, in global variables.

Instead, see the below:
JASS:
//! runtextmacro BuffType("Returning")
    //! runtextmacro SetBuffName("Returning")
    //! runtextmacro SetBuffAlignment("NEUTRAL")
    //! runtextmacro SetBuffTooltip("This unit is being Returned; it will return to its previous location soon.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNUnload.blp")
//! runtextmacro BuffStruct()
    real x
    real y
    method onCreate takes nothing returns nothing
        set x=GetUnitX(this.unit)
        set y=GetUnitY(this.unit)
    endmethod
    method preDestroy takes nothing returns nothing
        local Returned b = Returned.create(null)
        set b.x = x
        set b.y = y
        call b.setUnit(this.unit)
    endmethod
//! runtextmacro EndBuff()

//! runtextmacro BuffType("Returned")
    //! runtextmacro SetBuffName("Returned")
    //! runtextmacro SetBuffAlignment("NEUTRAL")
    //! runtextmacro SetBuffTooltip("This unit has just been returned to it's previous location.")
    //! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNLoad.blp")
//! runtextmacro BuffStruct()
    real x
    real y
    method onApply takes nothing returns nothing
        call SetUnitX(this.unit,x)
        call SetUnitY(this.unit,y) 
    endmethod
//! runtextmacro EndBuff()

Freehanded, but should work. :thup:

(Why you want to do it this way, I do not understand. I would restore the unit's position at the end of the "Returning" buff, and add the other buff as purely aesthetic.. at least. :))
 
I would restore the unit's position at the end of the "Returning" buff, and add the other buff as purely aesthetic.. at least.

:banghead:Yeah, i think i originally was going to do it this way but changed it and forgot. I re-did it roughly the way you did it in your first post and made the returned buff part just an aesthetic. Thanks
 
hey j4l. Let say i want to detect when a buffstruct is created. Then check, if it's a negative buff then multiple it's duration by 2. Can you add or teach me the way to make a event similar to 'EVENT_BUFF_CREATED'
 
I have an idea J4L. You should use a global, non-static timer member to call the "destroyTimed" method. If you call it, and you try to set the buff's duration to something different (for example from 5 sec to 10), the buff'll be destroyed after 5 seconds, and we'll have one more timer without any data.
 
JASS:
//          All BuffStructs have the .setUnit(unit) method, which will remove
//          the buff instance from the current unit, and apply it to the given unit.
//          Use .setUnit(null) to unapply a buff without destroying it.


JASS:
call MyBuffInstance.setUnit(myUnit)
 
or
JASS:
call MyBuff.create(<unit>)


Both versions work (but I prefer using the "create" method to apply and the "seUnit" method to move the buff, just for clarity :p)
 
i'm with luorax, and Jesus4Lyf at some point in this thread said the same thing... create the buff for a null unit and set the buff to the target unit
 
so i seem to have hit a wall with buffstruct

it seems if i try to make more than around 60 buffs grimoire stuffs up and chucks out an error pointing to grimex.txt

C:\Users\XX\AppData\Local\Temp\VB55C.tmp.lua:1783: attempt to index field '?' (a nil value)

fyi - the last buff that is made before the error is B@Z&
 
so i seem to have hit a wall with buffstruct

it seems if i try to make more than around 60 buffs grimoire stuffs up and chucks out an error pointing to grimex.txt

C:\Users\XX\AppData\Local\Temp\VB55C.tmp.lua:1783: attempt to index field '?' (a nil value)

fyi - the last buff that is made before the error is B@Z&
Ah, funny that.

Find this in the code:
JASS:
        //! runtextmacro BuffStruct__AllowSysId("@a")
        //! runtextmacro BuffStruct__AllowSysId("@b")
        //! runtextmacro BuffStruct__AllowSysId("@c")
        //! runtextmacro BuffStruct__AllowSysId("@d")
        //! runtextmacro BuffStruct__AllowSysId("@e")
        //! runtextmacro BuffStruct__AllowSysId("@f")
        //! runtextmacro BuffStruct__AllowSysId("@g")
        //! runtextmacro BuffStruct__AllowSysId("@h")
        //! runtextmacro BuffStruct__AllowSysId("@i")
        //! runtextmacro BuffStruct__AllowSysId("@j")
        //! runtextmacro BuffStruct__AllowSysId("@k")
        //! runtextmacro BuffStruct__AllowSysId("@l")
        //! runtextmacro BuffStruct__AllowSysId("@m")
        //! runtextmacro BuffStruct__AllowSysId("@n")
        //! runtextmacro BuffStruct__AllowSysId("@o")
        //! runtextmacro BuffStruct__AllowSysId("@p")
        //! runtextmacro BuffStruct__AllowSysId("@q")
        //! runtextmacro BuffStruct__AllowSysId("@r")
        //! runtextmacro BuffStruct__AllowSysId("@s")
        //! runtextmacro BuffStruct__AllowSysId("@t")
        //! runtextmacro BuffStruct__AllowSysId("@u")
        //! runtextmacro BuffStruct__AllowSysId("@v")
        //! runtextmacro BuffStruct__AllowSysId("@w")
        //! runtextmacro BuffStruct__AllowSysId("@x")
        //! runtextmacro BuffStruct__AllowSysId("@y")
        //! runtextmacro BuffStruct__AllowSysId("@z")
        //! runtextmacro BuffStruct__AllowSysId("@A")
        //! runtextmacro BuffStruct__AllowSysId("@B")
        //! runtextmacro BuffStruct__AllowSysId("@C")
        //! runtextmacro BuffStruct__AllowSysId("@D")
        //! runtextmacro BuffStruct__AllowSysId("@E")
        //! runtextmacro BuffStruct__AllowSysId("@F")
        //! runtextmacro BuffStruct__AllowSysId("@G")
        //! runtextmacro BuffStruct__AllowSysId("@H")
        //! runtextmacro BuffStruct__AllowSysId("@I")
        //! runtextmacro BuffStruct__AllowSysId("@J")
        //! runtextmacro BuffStruct__AllowSysId("@K")
        //! runtextmacro BuffStruct__AllowSysId("@L")
        //! runtextmacro BuffStruct__AllowSysId("@M")
        //! runtextmacro BuffStruct__AllowSysId("@N")
        //! runtextmacro BuffStruct__AllowSysId("@O")
        //! runtextmacro BuffStruct__AllowSysId("@P")
        //! runtextmacro BuffStruct__AllowSysId("@Q")
        //! runtextmacro BuffStruct__AllowSysId("@R")
        //! runtextmacro BuffStruct__AllowSysId("@S")
        //! runtextmacro BuffStruct__AllowSysId("@T")
        //! runtextmacro BuffStruct__AllowSysId("@U")
        //! runtextmacro BuffStruct__AllowSysId("@V")
        //! runtextmacro BuffStruct__AllowSysId("@W")
        //! runtextmacro BuffStruct__AllowSysId("@X")
        //! runtextmacro BuffStruct__AllowSysId("@Y")
        //! runtextmacro BuffStruct__AllowSysId("@Z")

Add some more. It ran out. :p
 
thanks, a little after this post i was thinking it might be something like that, just havent been able to check
 
Would be nice if the object generation done here and in Status was updated to use the Lua stuff so that they're safe to use.

Would also be nice to update all of the other object generating scripts like AIDS.
 
Jesus, I'll actually be planning on writing a tutorial about it.

Basically, Nestharus explained to me last night that the object generation used in BuffStruct and Status is unsafe, because just plain old object merger calls and lua calls with predefined variables can just overwrite things. So if someone has [ljass]'A000'[/LJASS] in their map and you overwrite it, they can't get it back unless it's backed up, and there's no warning it will be overwritten, so it's ... bad.

Nestharus' system LUA_GET_VAR_OBJECT as well as the ones it requires make safe unique ID's.

Also, interesting spin on your interface:
JASS:

//! runtextmacro Buff() // empty textmacro call
	//! runtextmacro BuffType("Knockback")
		//! runtextmacro SetBuffName("Knocked")
		//! runtextmacro SetBuffAlignment("NEGATIVE")
		//! runtextmacro SetBuffTooltip("This unit is being Knocked Back; it is stunned and sliding backwards.")
		//! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNBash.blp")
	//! runtextmacro BuffStruct()
		real speed=400*T32_PERIOD
		private effect e
		private method periodic takes nothing returns nothing
			local real r=GetUnitFacing(this.unit)*bj_DEGTORAD
			call SetUnitX(this.unit,GetUnitX(this.unit)-Cos(r)*this.speed)
			call SetUnitY(this.unit,GetUnitY(this.unit)-Sin(r)*this.speed)
		endmethod
		implement T32x
		method onApply takes nothing returns nothing
			call Status[this.unit].addStun()
			call this.startPeriodic()
			set this.e=AddSpecialEffectTarget("Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl",this.unit,"overhead")
		endmethod
		method onRemove takes nothing returns nothing
			call Status[this.unit].removeStun()
			call this.stopPeriodic()
			call DestroyEffect(this.e)
		endmethod
	//! runtextmacro EndBuffStruct() // empty textmacro call
//! runtextmacro EndBuff()
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    Added new Crab Bisque Soup recipe - which is badass by the way - Crab Bisque - https://www.thehelper.net/threads/soup-crab-bisque.196085/
  • The Helper The Helper:
    I feel like we need to all meet up somewhere sometime. Maybe like in Vegas :)
    +2
  • The Helper The Helper:
    Would love to go to Vegas I have never been and it would be an adventure! Who is in?
  • The Helper The Helper:
    at least the full on bot attack has stopped it was getting ridiculous there for a while and we use cloudflare and everything
  • jonas jonas:
    I'm sure my wife would not be happy if I went to Vegas, but don't let that stop you guys - would be hard for me to attend anyways
    +1
  • jonas jonas:
    Do you know why the bot attack stopped?
  • The Helper The Helper:
    maybe they finally got everything lol
  • Ghan Ghan:
    There's lots of good food in Vegas.
  • Ghan Ghan:
    Everything tends to be pretty expensive though so bring your wallet.
    +1
  • The Helper The Helper:
    I have to wait longer if I am going for food because my teeth are still messed up from the work and I still cannot eat right. Going to be a couple more months before that gets better
    +1
  • The Helper The Helper:
    I would immediately hitting the dispensary though :)
    +1
  • Varine Varine:
    My Xbox account got hijacked, and apparently I have a different one from like 10 years ago that Microsoft keeps telling me is the right one
  • Varine Varine:
    Like NO, I mean for some reason that one is attached to my email, but it's not the right one
  • Varine Varine:
    I have a different one, and that one has my credit card attached to it and I would like that credit card to not be attached to it if I can't get it back
  • Varine Varine:
    Anyway Microsoft is not very helpful with this, they just keep telling me to fill out the Account Recovery form, but that just redirects me to the other account
  • The Helper The Helper:
    They should not allow you to put a credit card on a account that does not have human customer service you can call
  • Varine Varine:
    That's the only thing that got hijacked at least. I don't totally know how these integrate together, but it seems like I should be able to do this via the gamertag. Like my email is still mine, but they changed the email to that account I'm guessing.
    +1
  • Blackveiled Blackveiled:
    I went to Vegas a few weeks ago to visit my mom. I had never been either, lol! But I'm working in Salt Lake City at the moment so it's not a far trip.
    +2
  • The Helper The Helper:
    I have never been to Vegas and it is on the bucket list so...
    +1
  • tom_mai78101 tom_mai78101:
    Recently getting addicted to Shapez.
    +1
  • Ghan Ghan:
    I've heard Shapez 2 is good.
    +1
  • Ghan Ghan:
    Also Satisfactory 1.0 released on the 10th and that has been excellent as well.
    +1
  • The Helper The Helper:
    Happy Saturday! Hope everyone has a fantastic day!
    +1
  • tom_mai78101 tom_mai78101:
    My mistake is moving from Shapez (beaten the game) to Shapez 2.

      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