• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Spell] leak?

Status
Not open for further replies.
  • Moonlight Touch
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Moonlight Touch for (Attacking unit)) Greater than 0
      • (Unit-type of (Attacking unit)) Equal to Arcane Priestess
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Moonlight Touch for (Attacking unit)) Equal to 1
          • (Random integer number between 1 and 10) Equal to 1
        • Then - Actions
          • Set MT_Index = (Player number of (Owner of (Attacking unit)))
          • Set MT_Caster[MT_Index] = (Attacking unit)
          • Set MT_CasterPos[MT_Index] = (Position of MT_Caster[MT_Index])
          • Set MT_Player[MT_Index] = (Owner of MT_Caster[MT_Index])
          • Set MT_Group[MT_Index] = (Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of (Center of (Playable map area)) matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True))
          • Unit Group - Pick every unit in MT_Group[MT_Index] and do (Actions)
            • Loop - Actions
              • Unit - Create 1 Dummy for MT_Player[MT_Index] at MT_CasterPos[MT_Index] facing Default building facing degrees
              • Set MT_Dummy[MT_Index] = (Last created unit)
              • Unit - Add Moonlight Touch (Dummy) to MT_Dummy[MT_Index]
              • Unit - Set level of Moonlight Touch (Dummy) for MT_Dummy[MT_Index] to (Level of Moonlight Touch for MT_Caster[MT_Index])
              • Unit - Order MT_Dummy[MT_Index] to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
              • Unit - Add a 0.80 second Generic expiration timer to MT_Dummy[MT_Index]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Moonlight Touch for (Attacking unit)) Equal to 2
              • (Random integer number between 1 and 8) Equal to 1
            • Then - Actions
              • Set MT_Index = (Player number of (Owner of (Attacking unit)))
              • Set MT_Caster[MT_Index] = (Attacking unit)
              • Set MT_CasterPos[MT_Index] = (Position of MT_Caster[MT_Index])
              • Set MT_Player[MT_Index] = (Owner of MT_Caster[MT_Index])
              • Set MT_Group[MT_Index] = (Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of (Center of (Playable map area)) matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True))
              • Unit Group - Pick every unit in MT_Group[MT_Index] and do (Actions)
                • Loop - Actions
                  • Unit - Create 1 Dummy for MT_Player[MT_Index] at MT_CasterPos[MT_Index] facing Default building facing degrees
                  • Set MT_Dummy[MT_Index] = (Last created unit)
                  • Unit - Add Moonlight Touch (Dummy) to MT_Dummy[MT_Index]
                  • Unit - Set level of Moonlight Touch (Dummy) for MT_Dummy[MT_Index] to (Level of Moonlight Touch for MT_Caster[MT_Index])
                  • Unit - Order MT_Dummy[MT_Index] to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
                  • Unit - Add a 0.80 second Generic expiration timer to MT_Dummy[MT_Index]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Moonlight Touch for (Attacking unit)) Equal to 3
                  • (Random integer number between 1 and (Integer(6.66))) Equal to 1
                • Then - Actions
                  • Set MT_Index = (Player number of (Owner of (Attacking unit)))
                  • Set MT_Caster[MT_Index] = (Attacking unit)
                  • Set MT_CasterPos[MT_Index] = (Position of MT_Caster[MT_Index])
                  • Set MT_Player[MT_Index] = (Owner of MT_Caster[MT_Index])
                  • Set MT_Group[MT_Index] = (Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of (Center of (Playable map area)) matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True))
                  • Unit Group - Pick every unit in MT_Group[MT_Index] and do (Actions)
                    • Loop - Actions
                      • Unit - Create 1 Dummy for MT_Player[MT_Index] at MT_CasterPos[MT_Index] facing Default building facing degrees
                      • Set MT_Dummy[MT_Index] = (Last created unit)
                      • Unit - Add Moonlight Touch (Dummy) to MT_Dummy[MT_Index]
                      • Unit - Set level of Moonlight Touch (Dummy) for MT_Dummy[MT_Index] to (Level of Moonlight Touch for MT_Caster[MT_Index])
                      • Unit - Order MT_Dummy[MT_Index] to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
                      • Unit - Add a 0.80 second Generic expiration timer to MT_Dummy[MT_Index]
                • Else - Actions
      • Custom script: call RemoveLocation(udg_MT_CasterPos[udg_MT_Index])
      • Custom script: call KillUnit(udg_MT_Dummy[udg_MT_Index])
      • Custom script: call DestroyGroup(udg_MT_Group[udg_MT_Index])
 
Last edited:

Kusanagi Kuro

Hosted Project: SC
Level 10
Joined
Mar 11, 2012
Messages
708
YEs. U have a unit group leaks. First, set the "Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of MT_CasterPos[MT_Index] matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True)" as the Unit Group variable. After u finish work with it, use this custom script to clear the leaks:
Call destroygroup(udg_UnitGroupVar[udg_IndexVar(if it has)]).
Every unit group will create a memory leaks if u dont destroy them (unless u use them overtime).
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
YEs. U have a unit group leaks. First, set the "Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of MT_CasterPos[MT_Index] matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True)" as the Unit Group variable. After u finish work with it, use this custom script to clear the leaks:
Call destroygroup(udg_UnitGroupVar[udg_IndexVar(if it has)]).
Every unit group will create a memory leaks if u dont destroy them (unless u use them overtime).

Call DestroyGroup(udg_UnitGroupVar[udg_IndexVar(if it has)]).

hmm, en trophy. why did you pick unit twice when you could do it only once ?

  • Unit Group - Pick every unit in (Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of MT_CasterPos[MT_Index] matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True)) and do (Actions)
    • Loop - Actions
      • Unit Group - Add (Picked unit) to MT_Group[MT_Index]
  • Unit Group - Pick every unit in MT_Group[MT_Index] and do (Actions)
should be like this, no ?

  • Set MT_Group[MT_Index] = unit in (Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of MT_CasterPos[MT_Index] matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True)) and do (Actions)
  • Unit Group - Pick every unit in MT_Group[MT_Index] and do (Actions)
    • Loop - Actions
      • ///Do Your Actions//
  • Custom script : call DestroyGroup(udg_MT_Group[udg_MT_Index]
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
thanks twovenomous..
E: It doesn't work anymore after i did what you said :(

maybe it's an important part of the spell then. try this :

  • Set MT_Group[MT_Index] = unit in (Units within (500.00 + (50.00 x (Real((Level of Moonlight Touch for MT_Caster[MT_Index]))))) of MT_CasterPos[MT_Index] matching (((Matching unit) belongs to an ally of MT_Player[MT_Index]) Equal to True)) and do (Actions)
  • Unit Group - Pick every unit in MT_Group[MT_Index]
    • Loop - Actions
      • Unit Group - Add (Picked unit) to MT_Group[MT_Index]
  • Unit Group - Pick every unit in MT_Group[MT_Index] and do (Actions)
    • Loop - Actions
      • ///Do Your Actions//
  • Custom script : call DestroyGroup(udg_MT_Group[udg_MT_Index]
the group needed to be destroyed after used, no matter what. else you will leak a unit group everytime you cast the spell.

anyway, you shouldn't edit your original post, people might be confused when they see that.
 
Status
Not open for further replies.
Top