Custom text: Destroy unit variable?

S

SlasherXpert

Guest
Whats the script for destroying a unit variable?

For unitgroups it's:

Custom script: call DestroyGroup(udg_UnitGroup9)

the UnitGroup9 being your variable name but how do you change it to affect "unit" variables instead of "unitgroup" variables?
 
S

SlasherXpert

Guest
so how exactly do you do it?
Do you use the set variable function?
Or is it some other custom JASS-y function?

*Edit*: I can't find the "null" function in the set variable thing
does it work if I do:

Set UnitGroup1 = (Units in No region)

Would it work or would it leak and cause lagg or crashes?

*Edit*: I found a alternative way so i'm ok.
 
C

CryptWizard

Guest
The way to destroy a unit is RemoveUnit(unit), but that will remove the unit from the game, so you just need to assign null to the variable by:
Code:
set unitvar = null
in JASS.
 

Sim

Forum Administrator
Staff member
Reaction score
534
I think global variables in GUI already null themselves so it is useless to set a global to null.

That's what I read somewhere though. Maybe wrong.
 

SFilip

Gone but not forgotten
Reaction score
634
well they don't exactly destroy their value, but when you reassign them the old value is gone.
however locals create themselves again every time you run the function they are in...and when the function is done executing the local is lost, but its value still stays in the memory.
of course this leak is minor...about 10 bytes i believe. if your trigger only runs once then you don't have to worry about nulling them.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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