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.
  • Varine Varine:
    A probate is usually done with a will, yes? If so I am sorry for your loss
    +1
  • The Helper The Helper:
    Yeah Tom, me too sorry for your loss buddy my mom told me she finds out her olds friend died from Google searching them. She had not talked to one of her old friends in a year and found out she died from Google. Also another one in the same session. RIP all of them my sincere condolences Tom
    +1
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new
  • Ghan Ghan:
    Good stuff.
  • Ghan Ghan:
    Just make sure it is secure. :)
  • The Helper The Helper:
    It will only be on internal network

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top