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.
  • 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 The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1
  • 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