That won't work. If another buff is created since that buff is destroyed, it will overwrite the boolean and destroy the new buff.fixed by adding a new boolean member of the struct that gets flagged when onDestroy is called,.
JASS:// Use .setUnit(null) to unapply a buff without destroying it.
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)
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
//! 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()
I would restore the unit's position at the end of the "Returning" buff, and add the other buff as purely aesthetic.. at least.
Ah, funny that.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&
//! 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")
It does use LUA. So does Status.Would be nice if the object generation done here and in Status was updated to use the Lua stuff
Explain..so that they're safe to use.
//! 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()