• 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.

Custom Script help needed

Status
Not open for further replies.
Level 9
Joined
Nov 4, 2007
Messages
933
I would guess that it might look something like this
  • Custom Script - call RemoveUnit(udg_Unit[GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))])
Assuming you were talking about getting rid units assigned to a unit array and not destroying the entire unit array itself, that should work.
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
You can't destroy a unit-array. You wouldn't need to anyways, since an array is not an object that will cause a memory leak. The only value that will cause a memory leak is the unit itself, which can be "destroyed" as Darkness-4ever has stated:

Darkness-4ever said:
  • Custom Script - call RemoveUnit(udg_Unit[GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))])
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
Well,what i wanted is to clear unit array variable from 1 unit - so the variable is empty (atleast 1 index of that array variable) like in the start of the game,not to destroy/kill unit and this isn't for leak purposes.

EDIT: I've found another way for thing i needed,but thanks for the efforts anyway ^^
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Garfield1337 said:
since i found another way to solve my problem.

The only reason I can think of as to why you would want to "destroy" them all at map initialization is so that you can distinguish between indexes that have and have not been used. In such a case, you can check if a unit variable is equal to "No unit" in which case it has not.

  • Melee Initialization
    • Events
    • Conditions
      • UnitArray[4] Equal to No unit
    • Actions
 
Status
Not open for further replies.
Top