Triggered Incinerate

black.sheep

Active Member
Reaction score
24
How would I go about doing this? I'm not intrested in the explosion, just the damage stacking.
 

XeNiM666

I lurk for pizza
Reaction score
138
Why dont you just go with the Incenerate with 0.00 values for the explosion?

I suppose you dont want it to be an Orb effect.
Well, you need a damage detection System ( Damage by Jesus4Lyf ) and check whether its the same unit with the ability in a certain period of time, then deal bonus damage...
 

Viikuna

No Marlo no game.
Reaction score
265
Its possible if you trigger ranged attack projectiles with some projectile system.

Its no easy job, though. It requires you have acces to lot of object data, and theres no natives to acces them, so it makes it kinda tricky. Also you need to be able to trigger pretty good projectile system which can simulate normal wc3 ranged attacks.

Its hard but possible and has been done succesfully before. ( See: Blueshift )


After doing this you can easily change your heros attack projectiles damage, effect model, and stuff like that, when autocast is activated.

edit. You can of course do it by just detecting attacks and adding damage, which is way easier. Dont know why I always think the hardest way to make stuff. Probably because it also allows you to do cool stuff that is otherwise imposible.
 

black.sheep

Active Member
Reaction score
24
Okay, I've got it working, but it doesnt seem to be MUI, cuz when I attack another unit, or get two people to attack one unit, the damage doesnt go away.
I am using AIDS in my map.
JASS:
scope pressure initializer i
    private struct Dat
        real damage
        real duration
    endstruct
  
    globals
        private group effected = CreateGroup()
        private group g = CreateGroup()
        private constant real    TIMEROUT=.10
        private constant integer USER='h038'
        private constant real DURATION=1.5
        private constant real DAMAGEINC=0.50
        private constant real DAMAGECAP=20
        private constant string EFFECT="Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl"
        private timer time=CreateTimer()
        private Dat array DB
    endglobals
    
    private function c takes nothing returns boolean
        if GetUnitAbilityLevel(GetTriggerUnit(),'B014') == 1 and GetUnitTypeId(GetEventDamageSource()) == USER then
            return true
        endif
        return false
    endfunction
    
    private function gro takes nothing returns nothing
        local Dat tempDat
        set tempDat=DB[GetUnitUserData(GetEnumUnit())]
        set tempDat.duration = tempDat.duration - TIMEROUT
        if tempDat.duration > 0 then
            call GroupRemoveUnit(effected,GetEnumUnit())
            set tempDat.damage = 0
            call tempDat.destroy()
            if CountUnitsInGroup(effected) == 0 then
                call PauseTimer(time)
            endif
        endif
    endfunction
    
    private function p takes nothing returns nothing
       call ForGroup(effected,function gro)
    endfunction
    
    private function a takes nothing returns nothing
        local Dat tempDat
        call UnitRemoveAbility(GetTriggerUnit(),'B014')
        if IsUnitInGroup(GetTriggerUnit(),effected) == true then
            set tempDat=DB[GetUnitUserData(GetTriggerUnit())]
            call Damage_Pure(GetEventDamageSource(),GetTriggerUnit(),tempDat.damage)
            if tempDat.damage < DAMAGECAP then
                set tempDat.damage = tempDat.damage+DAMAGEINC
            endif
            debug call BJDebugMsg(R2S(tempDat.damage))
        else
            set tempDat=Dat.create()
            set tempDat=DB[GetUnitUserData(GetTriggerUnit())]
            set tempDat.damage = 0
            debug call BJDebugMsg(R2S(tempDat.damage))
            set DB[GetUnitUserData(GetTriggerUnit())]=tempDat
            if CountUnitsInGroup(effected)==0 then
                call TimerStart(time,TIMEROUT,true,function p)
            endif
            call GroupAddUnit(effected,GetTriggerUnit())
        endif
        call DestroyEffect(AddSpecialEffectTarget(EFFECT,GetTriggerUnit(),"chest"))
    endfunction
    
    private function i takes nothing returns nothing
        local trigger t=CreateTrigger()
        call Damage_RegisterEvent(t)
        call TriggerAddCondition(t,Condition(function c))
        call TriggerAddAction(t,function a)
    endfunction
endscope
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
JASS:
//Requires AIDS, Damage, Recycle, optional ABC
scope Test initializer Init
    
    globals
        private constant integer ATKER_ID = 'h038'
        private constant integer BUFF_ID = 'B014'
        private constant real DAMAGE_CAP = 20.
        private constant real DAMAGE_INCREASE = .5
        private constant real DURATION = 1.5
        private constant string GFX = "Abilities\\Spells\\Other\\CrushingWave\\CrushingWaveDamage.mdl"
        
        private hashtable hasht = InitHashtable()
    endglobals
    
    private keyword Data
    
    private struct TimerList
        timer t
        thistype next
        thistype prev
        
        method onDestroy takes nothing returns nothing
            //Remove attached stuffs.
            static if LIBRARY_ABC then
            //If ABC is available, use ABC instead of hashtable.
                call ClearTimerStructA(.t)
                call ClearTimerStructB(.t)
                call ClearTimerStructC(.t)
            else
                call FlushChildHashtable(hasht,GetHandleId(.t))
            endif
            
            //Recycle the timer.
            call Timer.release(.t)
            
            //Unlink.
            set .prev.next = .next
            set .next.prev = .prev
            
            //Who can guess why I didn't nullify the timer here? =P
        endmethod
        
        method chainDestroy takes nothing returns nothing
            loop
                set this = this.next
            exitwhen this == 0
                call .destroy()
            endloop
        endmethod
        
        static method onExpired takes nothing returns nothing
            //Get struct from timer
            static if LIBRARY_ABC then
                local timer t = GetExpiredTimer()
                local thistype this = LoadTimerStructA(t)
                local integer damagedUnitId = LoadTimerStructB(t)
                local integer atkerId = LoadTimerStructC(t)
                //Use ABC if available.
            else
                local integer tId = GetHandleId(GetExpiredTimer())
                local thistype this = LoadInteger(hasht,tId,0)
                local integer damagedUnitId = LoadInteger(hasht,tId,1)
                local integer atkerId = LoadInteger(hasht,tId,2)
            endif
            
            local real r = LoadReal(hasht,damagedUnitId,atkerId)
            //Prevent bug, so we get the value again instead of storing it in struct.
        
            set r = r - DAMAGE_INCREASE
            //Decrease the damage stack amount
            
            call SaveReal(hasht,damagedUnitId,atkerId,r)
            //Set it.
            
            call .destroy()
            //destroy the struct.
        endmethod
    
        static method add takes Data d, integer id, real r returns nothing
            local thistype this = .allocate()
            //Get a new instance.
            local integer tId
            
            set .t = Timer.get()
            //Get a timer from timer stack.
            
            set d.head.prev.next = this
            set .prev = d.head.prev
            set d.head.prev = this
            set .next = 0
            //LinkedList
            
            call SaveReal(hasht,d,id,r)
            //Set the damage stack value.
            
            static if LIBRARY_ABC then
                call SetTimerStructA(.t,this)
                call SetTimerStructB(.t,d)
                call SetTimerStructC(.t,id)
            else
                set tId = GetHandleId(.t)
                call SaveInteger(hasht,tId,0,this)
                call SaveInteger(hasht,tId,1,d)
                call SaveInteger(hasht,tId,2,id)
            endif
            //Attach stuffs to timer.
            
            call TimerStart(.t,DURATION,false,function thistype.onExpired)
            //Start the timer.
        endmethod
    endstruct
    
    private struct Data extends array
        boolean isCapped
        TimerList head
        
        method AIDS_onCreate takes nothing returns nothing
            //Create list for timer
            set .head = TimerList.create()
            //LinkedList.
            set .head.next = .head
            set .head.prev = .head
        endmethod
        
        method AIDS_onDestroy takes nothing returns nothing
            call .head.chainDestroy()
            call FlushChildHashtable(hasht,this)
            set .isCapped = false
            //Remove all stacked damage from all source
            //Remove the cap, ready for later usage
            //Force removing the timers, since the unit is removed, the timers are
            //useless and may cause bug.
        endmethod
        //! runtextmacro AIDS()
    endstruct
    
    private function Act takes nothing returns nothing
        local Data d = Data[GetTriggerUnit()] //Struct of attaacked unit.
        local integer id  = GetUnitId(GetEventDamageSource()) //Id of attacker.
        local real r = LoadReal(hasht,d,id) //Damage stack count.
        
        set r = RMinBJ(r + DAMAGE_INCREASE, DAMAGE_CAP) //Limit the amount of damage stacking.
        call Damage_Pure(GetIndexUnit(id),d.unit,r) //Deal damage.
        
        if r < DAMAGE_CAP or (r >= DAMAGE_CAP and d.isCapped == false) then
        //If current value less than capped value
        //or first reach to capped value then
            call TimerList.add(d,id,r)
            //make timer and callback.
            
            if r >= DAMAGE_CAP then
                set d.isCapped = true
                //Flag it.
            endif
        endif
        
        call DestroyEffect(AddSpecialEffectTarget(GFX,d.unit,"chest"))
        //visual effect.
    endfunction
    
    private function Cond takes nothing returns boolean
        if GetUnitAbilityLevel(GetTriggerUnit(),'B014') > 0 and GetUnitTypeId(GetEventDamageSource()) == ATKER_ID and Damage_IsAttack() then
            //Condition : Unit type stuffs and the important : Damage_IsAttack(), it can prevent recursion/ infinite loop.
            call Act()
        endif
        return false
    endfunction
    
    private function Init takes nothing returns nothing
        local trigger t=CreateTrigger()
        call Damage_RegisterEvent(t)
        call TriggerAddCondition(t,Condition(function Cond))
        
    endfunction
endscope
 

black.sheep

Active Member
Reaction score
24
Kingking, you ability crashes my map. It spams Double free of type: HighPressure__TimerList and lags out the map.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Recycle will not show " Double free of type: HighPressure__TimerList ", make sure you use the correct library. I will take a look of my code. Hmm, if you use TimerUtils, make sure it is purple flavor, because other flavors are limiting the number of timers.

Update : I found no problem even I used hashtable to check whether the double free is happening or not.

Reminder : Do you replaced UnitDamageTarget to UnitDamageTargetEx in other spells?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top