• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Help me check my custom spell.

Status
Not open for further replies.
Its not think, it destroys if i put it out in the loop at the end of line. Because that is a pointer pointing towards the data from what i understood. If a pointer is destroyed, it destroys the data it is pointing to.

I am just confuse how CreateGroup works, i would need someone to clarify this for me.
 
Okay, people REALY should learn what leaks are.
Leaks are objects in the memory, that you don't need anymore, take memory for sure and most times you lost access to them. In this case you're talking about leaks.
Locations don't leak if you use them again and again, they use memory yes, but thats just normal. They're called a leak in the moment you don't need them anymore, although nothing changed.

The same goes for your group. If you create it, it's stored somewhere in the memory and uses it, like normal stuff on the computer does. If you save it in the hashtable, the table just knows where to find the group in the memory. Loading it from the table does nothing else but saving the "place" where the group is to find, creates nothing new.
However, Slayer is somehow right. Although you're destroying the group, the hashtable still "points" to the spot in the memory, needs you to "remove" this too, but you're clearing the child table of the caster, so it's allright (at least I can't see anything from looking at it).

Group actions also DONT LEAK, only the group that's created in it leaks if you don't use a variable.
 
If i understand correctly, i can safely say that my code works perfectly MUI and leakess. Am i right?

Because on every cast i use:
  • Custom script: set udg_glaive_damagedGroup = CreateGroup()
  • Hashtable - Save Handle Ofglaive_damagedGroup as (Key dgrp) of (Key (Last created unit)) in glaiveTable
and i only delete it once at the end. Just need one last confirmation to get myself clear with this ><
 
I just tested it out. I really need someone that understand fully ensure my doubt =/

Below is the test map, and the triggers here.
  • Test Group
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Divine Shield
    • Actions
      • Set tempGroup = (Units owned by (Owner of (Triggering unit)))
      • Custom script: set udg_testGroup = CreateGroup()
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to testGroup
          • Unit Group - Remove (Picked unit) from tempGroup
      • Custom script: call DestroyGroup(udg_tempGroup)
      • Hashtable - Save Handle OftestGroup as (Key grp) of (Key (Triggering unit)) in testTable
      • Unit Group - Add (Triggering unit) to casterGroup
      • Trigger - Turn on Test Group Run <gen>
      • Wait 3.00 seconds
      • Unit - Order Paladin 0007 <gen> to Human Paladin - Activate Divine Shield
  • Test Group Run
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in casterGroup and do (Actions)
        • Loop - Actions
          • Set testGroup = (Load (Key grp) of (Key (Picked unit)) in testTable)
          • Unit Group - Pick every unit in testGroup and do (Actions)
            • Loop - Actions
              • Game - Display to (All players) the text: (Name of (Picked unit))
          • Game - Display to (All players) the text: |cffffcc00=========...
I used this to test out how create group works. Try removing CreateGroup(), you will notice both players units will be added to one group. If i have CreateGroup() enabled, they will be in different groups.

This is what i wanted to know. And if whether i should destroy it or not at the end.

EDIT: In my 1st post i wanted to ask people who know triggers in detail to check my code since i am not sure how CreateGroup() works. And even after testing, i am still not sure how it works. Like krisserz said it is pointless to use CreateGroup() since it is created at map init. But after testing with the test map, it seems that it is not pointless. Really would like someone to clarify. [:
 

Attachments

Status
Not open for further replies.
Back
Top