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.
  • 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 The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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