Leaking???

INCINERATE

New Member
Reaction score
12
when i checked Slammer with leak checker it said this , where is the leak and how to fix?

Total lines: 18

Location Leak Detection ON
Unit Group Leak Detection ON
Special Effect Leak Detection ON
Variable Removal Detection ON

Location variable has not been removed:

Completed

Trigger:
  • Reverse Polarity
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Slammer
    • Actions
      • -------- Area of effect --------
      • Set RPPRealAoE = 410.00
      • -------- ----------------------------------------------- --------
      • Set TempPoint = (Position of (Triggering unit))
      • Set TempOffset = (TempPoint offset by (Random real number between 120.00 and 170.00) towards (Facing of (Triggering unit)) degrees)
      • Set TempUnitGroup = (Units within (RPPRealAoE + 32.00) of TempPoint matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is Mechanical) Equal to False) and ((((Matching unit) is A flying unit) Equal to False) and ((((Matching unit) is alive) Equal t
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • Unit - Move (Picked unit) instantly to TempOffset
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempOffset)


-----------------------------------------------------------------------------------------------------------------------------------------

okay for the next trigger, i do not think it leaks, but for some damn reason the average frame rate is lower when i enable this trigger, compared to when i disable it which results in the average frame rate like 15 frames higher , is this trigger possibly leaking? or is it checking for conditions every .03 seconds of gametime which means it checks on average 33 times EAch second for the entire game which is wasted efficiency? just curious


JASS:
scope Webshot initializer Init

    globals
        private constant integer    SPELL_ID            = 'yuty'
        
        //The caster moves MAX_DISTANCE in MAX_DURATION. So, if the distance
        //to the target point is half MAX_DISTANCE, the duration will be half
        //too.
        private constant real       MAX_DISTANCE        = 1200.00
        private constant real       MAX_DURATION        = 1.20
        
        //String path for lightning effect, and some colour configuration.
        private constant string     LIGHTNING_PATH      = "LEAS"
        private constant real       LIGHTNING_A         = 0.82
        private constant real       LIGHTNING_R         = 0.15
        private constant real       LIGHTNING_G         = 1.00
        private constant real       LIGHTNING_B         = 0.10
        //Distance from the center of the caster to the angle direction.
        //The root of the webs are placed on those positions. If you don't
        //get it, test it.
        private constant real       LIGHTNING_DISTANCE  = 75.00
        private constant real       LIGHTNING_ANGLE     = bj_PI / 4

        private constant real       DAMAGE_RADIUS       = 112.00
        private constant attacktype DAMAGE_ATTACK_TYPE  = ATTACK_TYPE_NORMAL
        private constant damagetype DAMAGE_DAMAGE_TYPE  = DAMAGE_TYPE_UNIVERSAL
        private constant weapontype DAMAGE_WEAPON_TYPE  = WEAPON_TYPE_WHOKNOWS
        private constant string     DAMAGE_EFFECT       = "Abilities\\Weapons\\PoisonArrow\\PoisonArrowMissile.mdl"
        private constant string     DAMAGE_EFFECT_POINT = "chest"

        private constant real       INTERVAL            = 0.03
    endglobals

    private constant function DamageFilter takes unit caster, unit target returns boolean
        return IsUnitEnemy(target, GetOwningPlayer(caster)) and IsUnitType(target, UNIT_TYPE_GROUND) == true
    endfunction

    private constant function DamageAmount takes integer level returns real
        return 00.00 + level * 75.00
    endfunction

    private struct Data
        private static timer Timer = CreateTimer()
        private static Data array Array
        private static integer Counter = 0

        private unit caster
        private real angle
        private real xInc
        private real yInc
        private real damage

        private lightning web1
        private lightning web2
        private real targetX
        private real targetY

        private integer ticks

        private group currentGroup = CreateGroup()
        private group damagedGroup = CreateGroup()

        private static method ReturnTrue takes nothing returns boolean
            return true
        endmethod

        private method actions takes nothing returns nothing
            local real casterX = GetUnitX(.caster)
            local real casterY = GetUnitY(.caster)
            local unit f

            call SetUnitPathing(.caster, false)
            call SetUnitPosition(.caster, casterX + .xInc, casterY + .yInc)
            call SetUnitFacing(.caster, .angle * bj_RADTODEG)
            call MoveLightning(.web1, true, casterX + LIGHTNING_DISTANCE * Cos(.angle + LIGHTNING_ANGLE), casterY + LIGHTNING_DISTANCE * Sin(.angle + LIGHTNING_ANGLE), .targetX, .targetY)
            call MoveLightning(.web2, true, casterX + LIGHTNING_DISTANCE * Cos(.angle - LIGHTNING_ANGLE), casterY + LIGHTNING_DISTANCE * Sin(.angle - LIGHTNING_ANGLE), .targetX, .targetY)

            call GroupEnumUnitsInRange(.currentGroup, GetUnitX(.caster), GetUnitY(.caster), DAMAGE_RADIUS, Condition(function Data.ReturnTrue))
            loop
                set f = FirstOfGroup(.currentGroup)
                exitwhen f == null
                call GroupRemoveUnit(.currentGroup, f)
                if not IsUnitInGroup(f, .damagedGroup) and DamageFilter(.caster, f) then
                    call GroupAddUnit(.damagedGroup, f)
                    call UnitDamageTarget(.caster, f, .damage, true, false, DAMAGE_ATTACK_TYPE, DAMAGE_DAMAGE_TYPE, DAMAGE_WEAPON_TYPE)
                    call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT, f, DAMAGE_EFFECT_POINT))
                endif
            endloop
        endmethod

        private static method Handler takes nothing returns nothing
            local integer i = 0

            loop
                exitwhen i == .Counter
                if .Array<i>.ticks == 0 or GetUnitState(.Array<i>.caster, UNIT_STATE_LIFE) &lt; 0.405 then
                    call .Array<i>.destroy()
                    set .Array<i> = .Array[.Counter - 1]
                    set .Counter = .Counter - 1
                    set i = i - 1
                else
                    call .Array<i>.actions()
                    set .Array<i>.ticks = .Array<i>.ticks - 1
                endif
                set i = i + 1
            endloop

            if .Counter == 0 then
                call PauseTimer(.Timer)
            endif
        endmethod

        static method create takes unit caster, real targetX, real targetY returns Data
            local Data dat = .allocate()

            local real casterX = GetUnitX(caster)
            local real casterY = GetUnitY(caster)
            local real dx = targetX - casterX
            local real dy = targetY - casterY
            local real distance = SquareRoot(dx * dx + dy * dy)
            local real angle = Atan2(dy, dx)

            local real web1x = casterX + LIGHTNING_DISTANCE * Cos(angle + LIGHTNING_ANGLE)
            local real web1y = casterY + LIGHTNING_DISTANCE * Sin(angle + LIGHTNING_ANGLE)
            local real web2x = casterX + LIGHTNING_DISTANCE * Cos(angle - LIGHTNING_ANGLE)
            local real web2y = casterY + LIGHTNING_DISTANCE * Sin(angle - LIGHTNING_ANGLE)

            local real duration = distance / MAX_DISTANCE * MAX_DURATION

            set dat.caster = caster
            set dat.xInc = (distance / duration * INTERVAL) * Cos(angle)
            set dat.yInc = (distance / duration * INTERVAL) * Sin(angle)
            set dat.angle = angle
            set dat.damage = DamageAmount(GetUnitAbilityLevel(caster, SPELL_ID))

            set dat.web1 = AddLightning(LIGHTNING_PATH, true, web1x, web1y, targetX, targetY)
            call SetLightningColor(dat.web1, LIGHTNING_R, LIGHTNING_G, LIGHTNING_B, LIGHTNING_A)
            set dat.web2 = AddLightning(LIGHTNING_PATH, true, web2x, web2y, targetX, targetY)
            call SetLightningColor(dat.web2, LIGHTNING_R, LIGHTNING_G, LIGHTNING_B, LIGHTNING_A)
            set dat.targetX = targetX
            set dat.targetY = targetY

            set dat.ticks = R2I(duration / INTERVAL)

            set .Array[.Counter] = dat
            set .Counter = .Counter + 1
            if .Counter == 1 then
                call TimerStart(.Timer, INTERVAL, true, function Data.Handler)
            endif

            return dat
        endmethod

        private method onDestroy takes nothing returns nothing
            call SetUnitPathing(.caster, true)
            call DestroyLightning(.web1)
            call DestroyLightning(.web2)
            call DestroyGroup(.damagedGroup)
            call DestroyGroup(.currentGroup)
        endmethod
    endstruct

    private function Actions takes nothing returns nothing
        local location targetLoc = GetSpellTargetLoc()

        call Data.create(GetTriggerUnit(), GetLocationX(targetLoc), GetLocationY(targetLoc))

        call RemoveLocation(targetLoc)
        set targetLoc = null
    endfunction

    //==========================================================

    private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function Conditions))
        call TriggerAddAction(t, function Actions)
    endfunction

endscope</i></i></i></i></i></i></i>
 

Komaqtion

You can change this now in User CP.
Reaction score
469
There is no leak in that first trigger ;)

Second trigger looks fine to me...
But better wait for some more comments on that one :p

Though, I'd suggest you change it so that it uses at least one global group, of those two used...

Like this:
JASS:
scope Webshot initializer Init

    globals
        private constant integer    SPELL_ID            = &#039;yuty&#039;
        
        //The caster moves MAX_DISTANCE in MAX_DURATION. So, if the distance
        //to the target point is half MAX_DISTANCE, the duration will be half
        //too.
        private constant real       MAX_DISTANCE        = 1200.00
        private constant real       MAX_DURATION        = 1.20
        
        //String path for lightning effect, and some colour configuration.
        private constant string     LIGHTNING_PATH      = &quot;LEAS&quot;
        private constant real       LIGHTNING_A         = 0.82
        private constant real       LIGHTNING_R         = 0.15
        private constant real       LIGHTNING_G         = 1.00
        private constant real       LIGHTNING_B         = 0.10
        //Distance from the center of the caster to the angle direction.
        //The root of the webs are placed on those positions. If you don&#039;t
        //get it, test it.
        private constant real       LIGHTNING_DISTANCE  = 75.00
        private constant real       LIGHTNING_ANGLE     = bj_PI / 4

        private constant real       DAMAGE_RADIUS       = 112.00
        private constant attacktype DAMAGE_ATTACK_TYPE  = ATTACK_TYPE_NORMAL
        private constant damagetype DAMAGE_DAMAGE_TYPE  = DAMAGE_TYPE_UNIVERSAL
        private constant weapontype DAMAGE_WEAPON_TYPE  = WEAPON_TYPE_WHOKNOWS
        private constant string     DAMAGE_EFFECT       = &quot;Abilities\\Weapons\\PoisonArrow\\PoisonArrowMissile.mdl&quot;
        private constant string     DAMAGE_EFFECT_POINT = &quot;chest&quot;

        private constant real       INTERVAL            = 0.03
        
        // ==========================================================================================================
        
        private group currentGroup = CreateGroup()
    endglobals

    private constant function DamageFilter takes unit caster, unit target returns boolean
        return IsUnitEnemy(target, GetOwningPlayer(caster)) and IsUnitType(target, UNIT_TYPE_GROUND) == true
    endfunction

    private constant function DamageAmount takes integer level returns real
        return 00.00 + level * 75.00
    endfunction

    private struct Data
        private static timer Timer = CreateTimer()
        private static Data array Array
        private static integer Counter = 0

        private unit caster
        private real angle
        private real xInc
        private real yInc
        private real damage

        private lightning web1
        private lightning web2
        private real targetX
        private real targetY

        private integer ticks

        private group damagedGroup

        private static method ReturnTrue takes nothing returns boolean
            return true
        endmethod

        private method actions takes nothing returns nothing
            local real casterX = GetUnitX(.caster)
            local real casterY = GetUnitY(.caster)
            local unit f

            call SetUnitPathing(.caster, false)
            call SetUnitPosition(.caster, casterX + .xInc, casterY + .yInc)
            call SetUnitFacing(.caster, .angle * bj_RADTODEG)
            call MoveLightning(.web1, true, casterX + LIGHTNING_DISTANCE * Cos(.angle + LIGHTNING_ANGLE), casterY + LIGHTNING_DISTANCE * Sin(.angle + LIGHTNING_ANGLE), .targetX, .targetY)
            call MoveLightning(.web2, true, casterX + LIGHTNING_DISTANCE * Cos(.angle - LIGHTNING_ANGLE), casterY + LIGHTNING_DISTANCE * Sin(.angle - LIGHTNING_ANGLE), .targetX, .targetY)

            call GroupEnumUnitsInRange(currentGroup, GetUnitX(.caster), GetUnitY(.caster), DAMAGE_RADIUS, Condition(function Data.ReturnTrue))
            loop
                set f = FirstOfGroup(currentGroup)
                exitwhen f == null
                call GroupRemoveUnit(currentGroup, f)
                if not IsUnitInGroup(f, .damagedGroup) and DamageFilter(.caster, f) then
                    call GroupAddUnit(.damagedGroup, f)
                    call UnitDamageTarget(.caster, f, .damage, true, false, DAMAGE_ATTACK_TYPE, DAMAGE_DAMAGE_TYPE, DAMAGE_WEAPON_TYPE)
                    call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT, f, DAMAGE_EFFECT_POINT))
                endif
            endloop
        endmethod

        private static method Handler takes nothing returns nothing
            local integer i = 0

            loop
                exitwhen i == .Counter
                if .Array<i>.ticks == 0 or GetUnitState(.Array<i>.caster, UNIT_STATE_LIFE) &lt; 0.405 then
                    call .Array<i>.destroy()
                    set .Array<i> = .Array[.Counter - 1]
                    set .Counter = .Counter - 1
                    set i = i - 1
                else
                    call .Array<i>.actions()
                    set .Array<i>.ticks = .Array<i>.ticks - 1
                endif
                set i = i + 1
            endloop

            if .Counter == 0 then
                call PauseTimer(.Timer)
            endif
        endmethod

        static method create takes unit caster, real targetX, real targetY returns Data
            local Data dat = .allocate()

            local real casterX = GetUnitX(caster)
            local real casterY = GetUnitY(caster)
            local real dx = targetX - casterX
            local real dy = targetY - casterY
            local real distance = SquareRoot(dx * dx + dy * dy)
            local real angle = Atan2(dy, dx)

            local real web1x = casterX + LIGHTNING_DISTANCE * Cos(angle + LIGHTNING_ANGLE)
            local real web1y = casterY + LIGHTNING_DISTANCE * Sin(angle + LIGHTNING_ANGLE)
            local real web2x = casterX + LIGHTNING_DISTANCE * Cos(angle - LIGHTNING_ANGLE)
            local real web2y = casterY + LIGHTNING_DISTANCE * Sin(angle - LIGHTNING_ANGLE)

            local real duration = distance / MAX_DISTANCE * MAX_DURATION
            
            set dat.damagedGroup = CreateGroup()
            set dat.caster = caster
            set dat.xInc = (distance / duration * INTERVAL) * Cos(angle)
            set dat.yInc = (distance / duration * INTERVAL) * Sin(angle)
            set dat.angle = angle
            set dat.damage = DamageAmount(GetUnitAbilityLevel(caster, SPELL_ID))

            set dat.web1 = AddLightning(LIGHTNING_PATH, true, web1x, web1y, targetX, targetY)
            call SetLightningColor(dat.web1, LIGHTNING_R, LIGHTNING_G, LIGHTNING_B, LIGHTNING_A)
            set dat.web2 = AddLightning(LIGHTNING_PATH, true, web2x, web2y, targetX, targetY)
            call SetLightningColor(dat.web2, LIGHTNING_R, LIGHTNING_G, LIGHTNING_B, LIGHTNING_A)
            set dat.targetX = targetX
            set dat.targetY = targetY

            set dat.ticks = R2I(duration / INTERVAL)

            set .Array[.Counter] = dat
            set .Counter = .Counter + 1
            if .Counter == 1 then
                call TimerStart(.Timer, INTERVAL, true, function Data.Handler)
            endif

            return dat
        endmethod

        private method onDestroy takes nothing returns nothing
            call SetUnitPathing(.caster, true)
            call DestroyLightning(.web1)
            call DestroyLightning(.web2)
            call DestroyGroup(.damagedGroup)
        endmethod
    endstruct

    private function Actions takes nothing returns nothing
        local location targetLoc = GetSpellTargetLoc()

        call Data.create(GetTriggerUnit(), GetLocationX(targetLoc), GetLocationY(targetLoc))

        call RemoveLocation(targetLoc)
        set targetLoc = null
    endfunction

    //==========================================================

    private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == SPELL_ID
    endfunction

    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddCondition(t, Condition(function Conditions))
        call TriggerAddAction(t, function Actions)
    endfunction

endscope</i></i></i></i></i></i></i>
 

INCINERATE

New Member
Reaction score
12
okay ill switch it out for your posted code, what exactly does that do?

also question, is this running a periodic the entire game ? or is it turned on only for the duration of the spell then turned off?


cause i find even without using the spell the map is slower. so i have disabled the hero and the trigger using this spell for now, till this code is more effient, if you are wondering if its maybe the other spells this hero has, it cant be cause the other 3 are blizzard spells with no triggers .
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      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