Whilst I agree on principle, it's in the config section for that very reason... it is not difficult to change. Also, I don't see how any script could detect this (especially not correctly) since I can have two buffs with the same name, one positive and one negative, which are different objects. Keeping in mind that buffs made by BuffStruct are never removed, but are purposefully overwritten every time you save, what if you change a buff slightly? I don't believe a script can do this right for BuffStruct.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.
//! externalblock extension=lua ObjectMerger $FILENAME$
//place the file header
//! runtextmacro LUA_FILE_HEADER()
//import the script
//! i dofile("GetVarObject")
//get the dynamic object id and import it under ABILITIES_UNIT_INDEXER var
//! i local id = getvarobject("Adef", "abilities", "ABILITIES_UNIT_INDEXER", true)
//create the object
//! i createobject("Adef", id)
//! i makechange(current, "anam", "Unit Indexing")
//! i makechange(current, "ansf", "(Unit Indexing)")
//! i makechange(current, "aart", "")
//! i makechange(current, "arac", "0")
//update the persistent table for the map
//! i updateobjects()
//! endexternalblock
See: SpellStruct.There should be a way to refresh the buff duration, get the remaining time of the buff, increase buff duration.
And more event responses maybe? Such as onSpellCast, onSelection, onKill, onXXX ...
Too bad the bug with the bufficon removal on multiple buff instances of same type has not been fixed, is there some kind of inofficial fix somewhere? Otherwise im really thinking about fixing it, should be less work then writing a similar system from scratch.
//TESH.scrollpos=9
//TESH.alwaysfold=0
//! runtextmacro DurationBuff("HungryPseudopods")
scope HungryPseudopods initializer Init
globals
private integer array Pods
private constant integer ABILID = 'A0HP'
private constant string PROJID = "HungryPseudopods"
private constant string PODSON = "immolation"
private constant string PODSOFF = "unimmolation"
endglobals
private struct Data
unit caster
boolean on
endstruct
private function Core takes nothing returns boolean
local Data d = TT_GetData()
local unit u = null
local integer level = GetUnitAbilityLevel(d.caster,ABILID)
local Projectile p
if GetUnitAbilityLevel(d.caster,'B017') > 0 and d.on == true then
set P = GetOwningPlayer(d.caster)
call GroupEnumUnitsInRange(G2,GetUnitX(d.caster),GetUnitY(d.caster),450,Condition(function EnemyAliveFilter))
loop
set u = FirstOfGroup(G2)
exitwhen u == null
set p = Projectile.create()
call p.ProjectileSetId(PROJID)
call p.ProjectileSetModel("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl",50,50,50,255,0.8)
call p.ProjectileTargetHoming(d.caster,GetUnitX(d.caster),GetUnitY(d.caster),20,u,35)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl",Projectile_HitUnit,"chest"))
call GroupRemoveUnit(G2,u)
endloop
else
set Pods[GetUnitId(d.caster)] = 0
call d.destroy()
return true
endif
return false
endfunction
private function ConditionsOn takes nothing returns boolean
return OrderId2String(GetIssuedOrderId()) == PODSON
endfunction
private function ActionsOn takes nothing returns nothing
local Data d = Data.create()
set d.caster = GetOrderedUnit()
set Pods[GetUnitId(d.caster)] = d
set d.on = true
call TT_StartEx(function Core,d,1)
endfunction
private function ConditionsOff takes nothing returns boolean
return OrderId2String(GetIssuedOrderId()) == PODSOFF
endfunction
private function ActionsOff takes nothing returns nothing
local Data d = Pods[GetUnitId(GetOrderedUnit())]
set Pods[GetUnitId(GetOrderedUnit())] = 0
set d.on = false
endfunction
private function HitConditions takes nothing returns boolean
return Projectile_Id == PROJID
endfunction
private function HitActions takes nothing returns nothing
local HungryPseudopods buf
local unit BuffCaster = Projectile_Source
local unit BuffTarget = Projectile_HitUnit
set BuffAbilId = ABILID
// call buf.create(BuffTarget).destroyTimed(1.5)
call AddBuffHungryPseudopods(BuffCaster,BuffTarget,2,true)
call Damage_Physical(BuffCaster,BuffTarget,GetUnitAbilityLevel(BuffCaster,ABILID)*2-1+0.1*GetHeroAgi(BuffCaster,true),DARKNESS,false,false)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\DeathandDecay\\DeathandDecayDamage.mdl",BuffTarget,"chest"))
set BuffCaster = null
set BuffTarget = null
endfunction
private function Init takes nothing returns nothing
local trigger Trig = CreateTrigger()
local trigger Trig2 = CreateTrigger()
local trigger Hit = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Trig,EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddCondition(Trig,Condition(function ConditionsOn))
call TriggerAddAction(Trig,function ActionsOn)
call TriggerRegisterAnyUnitEventBJ(Trig2,EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddCondition(Trig2,Condition(function ConditionsOff))
call TriggerAddAction(Trig2,function ActionsOff)
call TriggerRegisterEventProjectileHit(Hit)
call TriggerAddCondition(Hit,Condition(function HitConditions))
call TriggerAddAction(Hit,function HitActions)
endfunction
endscope
//! runtextmacro BuffType("HungryPseudopods")
//! runtextmacro SetBuffName("Hungry Pseudopods")
//! runtextmacro SetBuffAlignment("NEGATIVE")
//! runtextmacro SetBuffTooltip("Being dissolved by pseudopods.")
//! runtextmacro SetBuffIcon("ReplaceableTextures\\PassiveButtons\\PASBTNPoisonSting.blp")
//! runtextmacro BuffStruct()
unit caster
unit target
integer abilId
integer armor
method onCreate takes nothing returns nothing
set this.abilId = BuffAbilId
set this.caster = BuffCaster
set this.target = BuffTarget
endmethod
method onApply takes nothing returns nothing
set armor = GetUnitAbilityLevel(this.caster,this.abilId)*1
call Status[this.unit].modArmorBonus(-armor)
endmethod
method onRemove takes nothing returns nothing
call Status[this.unit].modArmorBonus(armor)
endmethod
//! runtextmacro EndBuff()
//TESH.scrollpos=0
//TESH.alwaysfold=0
//! runtextmacro BuffType("CalamitousGaze")
//! runtextmacro SetBuffName("Calamitous Gaze")
//! runtextmacro SetBuffAlignment("NEGATIVE")
//! runtextmacro SetBuffTooltip("Bad luck gets you hurt.")
//! runtextmacro SetBuffIcon("ReplaceableTextures\\CommandButtons\\BTNEyeofblood.blp")
//! runtextmacro BuffStruct()
unit caster
unit target
integer attackSpeed
method onCreate takes nothing returns nothing
set this.caster = BuffCaster
set this.target = BuffTarget
endmethod
//! runtextmacro EndBuff()