Leaking??

INCINERATE

New Member
Reaction score
12
hey guys , would anyone mind taking a look at this code? this is a spell i found on www.thehiveworkshop.com from XXDINGO93XX.

ever since i put it in, i have notice the frame rate drops, and never recovers .. this only started when i put this in , so does this code leak? and if it does can you guys please post the necessary fixes . thanks :p


JASS:
//               °                                        Mapmaking since 2006...
//            °
//          °
//         °
//       °°°ÛÜ
//      °°X°ÛÛÛ                          ÛÛÛÛÛÛÛÛ     ÿÜÛÛÛÛÛÛÛÛÜ 
//     °°XX° ÛÛÛ        ßÛÛÛÛÛ        ÛÛÛÛÛÛÛÛÛÛÛÛ   ÛÛÛÛÛÛÛÛÛÛÛÛÛ
//     °XX ° ÛÛÛÛ         ÛÛÛÛÜ     ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ  ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
//     °XX °  ÛÛÛÛÛ        ÛÛÛÛ    ÛÛÛÛÛß    ßÛÛÛÛÛÛ  ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ  
//    °°XXX°° ÛÛÛÛÛÛÜ       ÛÛÛÜ  ÛÛÛÛÛ        ßÛÛÛÛÛ ßÛÛÛÛ    ÛÛÛÛÛÛ  
//   °°°°°°°°  ÛÛÛÛÛÛÛ      ÛÛÛÛ  ÛÛÛÛ                 ÛÛÛÛ      ÛÛÛÛÜ  
//             ÛÛÛÛÛÛÛÛ     ÛÛÛÛ  ÛÛÛÛ        ÛÛÛÛÛÛÛ  ÛÛÛÛÛÜ     ÛÛÛÛ  
//   °°°°°°°°  ÛÛÛÛÛÛÛÛÛ    ÛÛÛÛÜ  ÛÛÛÛÜ     ÛÛÛÛÛÛÛÛ   ÛÛÛÛÛÜ  ÜÛÛÛÛÛÛ  
//   °°XXXXX°   ÛÛÛÛ  ÛÛÛÜ  ÛÛÛÛÛ   ÛÛÛÛÛÛÜ    ßÛÛÛÛÛ   ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ  
//   °°XXXXX °° ÛÛÛÛ   ÛÛÛÛÜ ÛÛÛÛ °°°ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ°°° ÛÛÛÛÛÛÛÛÛÛÛÛÛß  
//   °  XXXXX °°ÛÛÛÛÛ°°°°ÛÛÛÛÛÛÛÛ°°XX ÛÛÛÛÛÛÛÛÛÛÛÛÛÛ XXX°°ÛÛÛÛÛÛÛÛÛÛÛ     ÛÛÛ
//   °°  XXXXX ÜÛÛÛÛÛÛ X ÛÛÛÛÛÛÛÛÛ XXX ÛÛÛÛÛÛÛÛÛÛÛ  XXXXXX  ÛÛÛÛÛÛÛ°      ÛÛÛ
//    °°  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX °°°°°°   °°°°
//     °°   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX °°°°°X°°
//      °°°  XXXXXXXXXX  °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° XXXXXXXXXXXXXXXXX°°
//        °°°°°°°°°°°°°°°°                                  °°°°°°°°  XXXXXXX °°°
//                                                                  °°°°°° XX °°
//   ...2009 and still moving on.                                        °°°°°°°
//                                                                             °°
//   Screen Solution: 1280x1024                             Visit <a href="http://www.ngo.clan.su" target="_blank" class="link link--external" rel="nofollow ugc noopener">www.ngo.clan.su</a>!
//========================================================================================
scope SpikedImpact initializer Init
//========================================================================================
//====================================SETUP START=========================================
//========================================================================================
    globals
        //Default: &#039;SpIm&#039;
        private constant integer AID = &#039;SpIm&#039; //the rawcode of the ability &quot;Spike Impact&quot;
        //Default: &#039;eSp1&#039;
        private constant integer SPIKED_ONE = &#039;eSp1&#039; //the rawcode of the unit spike 1
        //Default: &#039;eSp2&#039;
        private constant integer SPIKED_TWO = &#039;eSp2&#039; //the rawcode of the unit spike 2
        //Default: &#039;eSp3&#039;
        private constant integer SPIKED_THREE = &#039;eSp3&#039; //the rawcode of the unit spike 3
        //Default: &#039;eSp4&#039;
        private constant integer SPIKED_FOUR = &#039;eSp4&#039; //the rawcode of the unit spike 4
        //Default: 8
        private constant integer MAX = 8 //the maximal amount of spikes for each heigh
        //Default: &quot;Morph&quot;
        private constant string START_ANIMATION = &quot;Morph&quot; //the animation the caster will play when he casts the spell
        //Default: &quot;Morph Defend&quot;
        private constant string END_ANIMATION = &quot;Morph Defend&quot; //the animation the caster will play when the spell ends
        //Default: 255
        private constant integer RED = 255 //The red RGB color of the affected units from 0 to 255
        //Default: 45
        private constant integer GREEN = 45 //The green RGB color of the affected units from 0 to 255
        //Default: 45
        private constant integer BLUE = 45 //The blue RGB color of the affected units from 0 to 255
        //Default: &quot;Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl&quot;
        private constant string ENEMY_EFFECT = &quot;Objects\\Spawnmodels\\Orc\\Orcblood\\BattrollBlood.mdl&quot; //the that will be created at the enemy when it is affected, in this case is blood.
        //Default: 0.3
        private constant real SPIKE_GROW = 0.3 //the time the spikes will have to grow before they are paused
        //Default: 1.5
        private constant real SPIKE_PAUSE = 1.5 //the duration of pausing the spikes
        //Default: 1.2
        private constant real SPIKE_DEATH = 1.2 //this is how long the death animation of the spikes lasts
    endglobals

    private constant function Radius takes integer level returns real
        //Default: 650. + level * 50.
        return 650. + level * 50.
    endfunction

    private constant function Damage takes integer level returns real
        //Default: level * 80. + 25.
        return level * 80. + 25.
    endfunction
//========================================================================================
//====================================SETUP END===========================================
//========================================================================================
    globals
        private unit TempCaster = null
    endglobals

    private function Pick takes nothing returns boolean 
        return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(TempCaster)) and (GetWidgetLife(GetFilterUnit()) &gt; 0.405) and not IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE)
    endfunction
    
    private function KillEnemies takes unit caster, unit target, integer level returns nothing
        local real DamageToDeal = Damage(level)
        
        call PauseUnit(target, false)
        call SetUnitTimeScale(target, 100. * 0.01)
        if(GetWidgetLife(target) &lt;= DamageToDeal) then
            call SetUnitExploded(target, true)
            call KillUnit(target)
        else
            call UnitDamageTarget(caster, target, DamageToDeal, true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
            call SetUnitVertexColor(target, 255, 255, 255, 255)
            call DestroyEffect(AddSpecialEffectTarget(ENEMY_EFFECT, target, &quot;chest&quot;))
        endif
    endfunction
    
    private function RecolorEnemies takes nothing returns nothing
        local unit Enemy = GetEnumUnit()
        
        call PauseUnit(Enemy, true)
        call SetUnitTimeScale(Enemy, 0.00)
        call SetUnitVertexColor(Enemy, RED, GREEN, BLUE, 255)
        call DestroyEffect(AddSpecialEffectTarget(ENEMY_EFFECT, Enemy, &quot;chest&quot;))
        set Enemy = null
    endfunction
    
    private struct SIData
        unit caster
        integer level
        unit array spikes [36]
        timer t
        group g 
        
        static method Reset takes nothing returns nothing
            local SIData data = SIData(GetTimerData(GetExpiredTimer()))
            call data.destroy()
        endmethod
        
        static method End takes nothing returns nothing
            local SIData data = SIData(GetTimerData(GetExpiredTimer()))
            local unit f
            local integer i = 0
            
            loop
                set f = FirstOfGroup(data.g)
                exitwhen f == null
                call KillEnemies(data.caster, f, data.level)
                call GroupRemoveUnit(data.g, f)
            endloop
            set i = 0
            loop
                exitwhen (i == MAX * 4)
                call PauseUnit(data.spikes<i>, false)
                call UnitApplyTimedLife(data.spikes<i>, &#039;BTLF&#039;, 1.00)
                call SetUnitTimeScale(data.spikes<i>, 1)
                set i = i + 1
            endloop
            
            call SetTimerData(data.t, integer(data))
            call SetUnitAnimation(data.caster, END_ANIMATION)
            call TimerStart(data.t, 0.5, false, function SIData.Reset)
        endmethod
        
        static method Growth takes nothing returns nothing
            local SIData data = SIData(GetTimerData(GetExpiredTimer()))
            local integer i = 0
            
            loop
                exitwhen (i == MAX * 4)
                call PauseUnit(data.spikes<i>, true)
                call SetUnitTimeScale(data.spikes<i>, 0.)
                set i = i + 1
            endloop 
            set TempCaster = data.caster
            call GroupEnumUnitsInRange(data.g, GetUnitX(data.caster), GetUnitY(data.caster), Radius(data.level), Condition(function Pick))
            call ForGroup(data.g, function RecolorEnemies)
            
            call SetTimerData(data.t, integer(data))
            call TimerStart(data.t, SPIKE_DEATH, false, function SIData.End)
        endmethod
        
        static method create takes unit aCaster returns SIData
            local SIData data = SIData.allocate()
            local real x
            local real y
            local real Degrees
            local integer SpikeNumber = 0
            local integer i = 0
            local player owner = GetOwningPlayer(aCaster)
            
            set data.caster = aCaster
            set data.level = GetUnitAbilityLevel(aCaster, AID)
            set data.g = CreateGroup()
            loop
                exitwhen (i == MAX)
                set Degrees = (360./MAX * I2R(i))
                set x = GetUnitX(data.caster) + 10.0 * Cos(Degrees * bj_DEGTORAD)
                set y = GetUnitY(data.caster) + 10.0 * Sin(Degrees * bj_DEGTORAD)
                set data.spikes [SpikeNumber]     = CreateUnit(owner, SPIKED_ONE, x, y, Degrees)
                set data.spikes [SpikeNumber + 1] = CreateUnit(owner, SPIKED_TWO, x, y, Degrees)
                set data.spikes [SpikeNumber + 2] = CreateUnit(owner, SPIKED_THREE, x, y, Degrees)
                set data.spikes [SpikeNumber + 3] = CreateUnit(owner, SPIKED_FOUR, x, y, Degrees)
                set SpikeNumber = SpikeNumber + 4
                set i = i + 1
            endloop
            call PauseUnit(data.caster, true)
            call SetUnitAnimation(data.caster, START_ANIMATION)
            
            set data.t = NewTimer() 
            call SetTimerData(data.t, integer(data))
            call TimerStart(data.t, SPIKE_GROW, false, function SIData.Growth)
            
            return data
        endmethod
        
        method onDestroy takes nothing returns nothing
            local integer Index = 1
            
            loop
                exitwhen Index &gt; 36
                set this.spikes [Index] = null
                set Index = Index + 1
            endloop
            call ReleaseTimer(this.t)
            call IssueImmediateOrder(this.caster, &quot;stop&quot;)
            call SetUnitAnimation(this.caster, &quot;stand&quot;)
            call PauseUnit(this.caster, false)
            call GroupClear(this.g)
            set this.caster = null
            set this.g = null
        endmethod
    endstruct
//====================================================================================
    private function Conditions takes nothing returns boolean
        return GetSpellAbilityId() == AID
    endfunction
//====================================================================================
    private function Actions takes nothing returns nothing
        call SIData.create(GetSpellAbilityUnit())
    endfunction
//===========================Creating the trigger=====================================
    private function Init takes nothing returns nothing
        local trigger Tri = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(Tri, EVENT_PLAYER_UNIT_SPELL_EFFECT)
        call TriggerAddAction(Tri, function Actions)
        call TriggerAddCondition(Tri, Condition(function Conditions))
        
        // this will remove the first cast lag
        call RemoveUnit(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),  SPIKED_ONE, 0.00, 0.00, 0.00))
        call RemoveUnit(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),  SPIKED_TWO, 0.00, 0.00, 0.00))
        call RemoveUnit(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),  SPIKED_THREE, 0.00, 0.00, 0.00))
        call RemoveUnit(CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE),  SPIKED_FOUR, 0.00, 0.00, 0.00))
        
        call Preload(ENEMY_EFFECT)
    endfunction
endscope</i></i></i></i></i>
 
Reaction score
341
Erm, not as far as I could see. But the spell could use some improvements.
Probably nothing that would affect framerate too much.
 

INCINERATE

New Member
Reaction score
12
okay thanks, im just trying to figure out what was causing the lag, im glad it isnt this spell, it has to be my other spell i put in today :p
 

INCINERATE

New Member
Reaction score
12
hey guys , a new problem just aroused with this spell and since i no good with jass can you guys help?

2 problems. shouldn't be to hard for some of you guys



a)the first one is that when units are killed by this spell, it does not give any gold bounties for the units it has killed.


b) the second one is that , it shoots out these huge spikes that grow out,then stabs the units, turn the units red, then retracts back in .. now if a hero happens to die from these spikes, the color wont be reverted back to normal ( the hero is stuck in the color red)


this doesn't happen under normal situations where the hero does not die, as its only temporarily red for a short time ,

in testing we found that if a unit dies from this and revives back(from alter), he will be permanently red until you cast the spikes again on him. if the hero lives his color will change back to normal


can you guys please tell me whats wrong? :confused:
 

Rushhour

New Member
Reaction score
46
For a) Are you sure that the playerflag GIVES_BOUNTY is on (==1) for the owner of killed unit? Another problem could be that the unit is directly killed when the damage amount is greater than its remaining life points.
So you should change that line that turns explosion on and instantly kills the target. ("UnitDamageTarget" gives rewards for killing unit /player)

b) Defeated Heroes aren't "dead" and removed, but only sent to heaven ;P So it keeps all items carried, exprience gained,..., and also the changed color. So I suggest that you simply change the color back when a hero is revived (SetUnitVertexColor(unit,255,255,255,255) )
 

INCINERATE

New Member
Reaction score
12
my map has bounty on , thats forsure, cause its based of killing units for gold .. but only during this trigger it dont work


which part should i put "UnitDamageTarget" ?


how to change the hero color back when its revived? what happens to other heroes in the game that are deliberately made to be another color threwout the game , would this setting of colour screw things up?


its funny cause , even when ur hero is stuck red, if you get spiked again, and dont die, your hero would be reverted back to its orginal color. so i am guessing that its missing the action to turn units back to its orginal color after a hero death event.

where to put in these changes?
 

INCINERATE

New Member
Reaction score
12
bump plz?

nobody???

how to get bounty on for the units this spell kills? (and yes i do have bounty on ) it just doesn't get any from this spell

and how to set the heroes color back to normal if they die from this spell?
 

INCINERATE

New Member
Reaction score
12
okay i found the author, pointed out the 2 bugs, and he hasnt given me any reply .


theres nothing you jass pros out there can suggest? whats causing this spell to not give bounty, i guess the color thing can be fixed , by not allowing it to change colors at all in the configurable constants . that should solve that issue ( prevention better than cure Lol),

but the bounty bugs me, as its needed :p

help anyone?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top