• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] How can i remove these leaks?

Level 17
Joined
Jun 2, 2009
Messages
1,174
I believe i make it mui but i am not 100% sure

  • Shockwaves
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave //
    • Actions
      • Set TempPointShockwave[(Custom value of (Triggering unit))] = (Target point of ability being cast)
      • Set TempCasterShockwave[(Custom value of (Triggering unit))] = (Triggering unit)
      • Wait 0.75 seconds
      • Set TempGroupShockwave[(Custom value of (Triggering unit))] = (Units within 300.00 of TempPointShockwave[(Custom value of (Triggering unit))])
      • Special Effect - Create a special effect at TempPointShockwave[(Custom value of (Triggering unit))] using Units\NightElf\Wisp\WispExplode.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in TempGroupShockwave[(Custom value of (Triggering unit))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of TempCasterShockwave[(Custom value of (Triggering unit))])) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is Mechanical) Equal to False
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is Magic Immune) Equal to False
            • Then - Actions
              • Unit - Cause TempCasterShockwave[(Custom value of (Triggering unit))] to damage (Picked unit), dealing (Real((Strength of TempCasterShockwave[(Custom value of (Triggering unit))] (Include bonuses)))) damage of attack type Spells and damage type Magic
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPointShockwave)
      • Custom script: call DestroyGroup(udg_TempGroup)
First i want to be sure that. Every player only can have one Hero.
Does it works without issue and how can i remove this leaks? I am not familiar with arrays.
 
Level 39
Joined
Feb 27, 2007
Messages
5,062
  • Custom script: call RemoveLocation(udg_TempPointShockwave)
  • Custom script: call DestroyGroup(udg_TempGroup)
Those variables are arrays and you are not giving an array index like [6]. You need to convert "Custom value of (Triggering unit)" into JASS and use it in those variable removal lines.

How do you learn what JASS means what? Make a new, blank trigger. Copy and paste the line into this new blank trigger. Navigate at the top to Edit > Convert to Custom Text, which will convert the trigger from GUI to JASS. Then look at the line and grab the part you need. Most JASS functions have names that make it obvious what they do.

[GetUnitUserData(GetTriggerUnit())]



That said... there is no reason the point and group have to be array variables here. They aren't saved during a wait or while another trigger does something, so they can just be some temporary variables. Make them regular non-arrays and it will be fine. This is what people use tempgroup or temppoint for.
 
Level 39
Joined
Feb 27, 2007
Messages
5,062
I’m not going to answer that question directly and instead ask you to think about it yourself so you can practice this skill. Which variables are being used? Would a second simultaneous cast overwrite them and cause issues? Are the objects they point to properly removed/destroyed?
 
Level 17
Joined
Jun 2, 2009
Messages
1,174
That would work if
1. you have a unit indexer
2. the same unit does not cast the ability again in 0.75 seconds

There is a lot of unnecessary stuff and you are leaking, but it would work.
This is why i have asked actually. This is the trigger after Pyrogasm show me the [GetUnitUserData(GetTriggerUnit())]
  • Shockwaves
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shockwave //
    • Actions
      • Set TempPointShockwave[(Custom value of (Triggering unit))] = (Target point of ability being cast)
      • Set TempCasterShockwave[(Custom value of (Triggering unit))] = (Triggering unit)
      • Wait 0.75 seconds
      • Set TempGroupShockwave[(Custom value of (Triggering unit))] = (Units within 300.00 of TempPointShockwave[(Custom value of (Triggering unit))])
      • Special Effect - Create a special effect at TempPointShockwave[(Custom value of (Triggering unit))] using Units\NightElf\Wisp\WispExplode.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit Group - Pick every unit in TempGroupShockwave[(Custom value of (Triggering unit))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of TempCasterShockwave[(Custom value of (Triggering unit))])) Equal to True
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is Mechanical) Equal to False
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is Magic Immune) Equal to False
            • Then - Actions
              • Unit - Cause TempCasterShockwave[(Custom value of (Triggering unit))] to damage (Picked unit), dealing (Real((Strength of TempCasterShockwave[(Custom value of (Triggering unit))] (Include bonuses)))) damage of attack type Spells and damage type Magic
            • Else - Actions
      • Custom script: call RemoveLocation(udg_TempPointShockwave[GetUnitUserData(GetTriggerUnit())])
      • Custom script: call DestroyGroup(udg_TempGroupShockwave[GetUnitUserData(GetTriggerUnit())])
 
Top