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

[Trigger] How to destroy leak if i have UnitGroup[Array]

Status
Not open for further replies.
Level 3
Joined
May 7, 2016
Messages
38
Since i have UnitGroup(array[4])
This does not work:
  • Custom script: call DeleteGroup(udg_UnitGroup)
also this:
  • For each (Integer A) from 0 to 3, do (Actions)
    • Loop - Actions
    • Custom script: call DeleteGroup(udg_UnitGroup[GetForLoopIndexA])
than i tried:
  • Custom script: call DeleteGroup(udg_UnitGroup[0])
  • Custom script: call DeleteGroup(udg_UnitGroup[1])
  • Custom script: call DeleteGroup(udg_UnitGroup[2])
  • Custom script: call DeleteGroup(udg_UnitGroup[3])
and none of these work.
What is the correct way?
 

Ardenian

A

Ardenian

It has to be:
  • Custom script: call DestroyGroup(udg_T_US_TR_Selected[GetForLoopIndexA])
This is very simple, maybe try to find it yourself next time.

In this case, you get the error message 'expected array index'.
So what does this mean ?
This means the array is not found although there has to be one, as the variable udg_T_US_TR_Selected uses an array.
If you take a close look yo see you added a not required '(' before '['.
 
Level 3
Joined
May 7, 2016
Messages
38
I see, you ware right Wietlol.
It looks like it is a function.
and ty Ardenian, both rep+

Just one last thing:
if in gui i have group 1,2,3,4
i have to write Clear(0,1,2,3)
everything starts from 0 right?
 
Last edited by a moderator:
^ you don't do that in GUI lol

Player Red is still Player 1 in GUI. it is adjusted in GUI ;)

JASS:
//===========================================================================

function GetConvertedPlayerId takes player whichPlayer returns integer

    return GetPlayerId(whichPlayer) + 1

endfunction



//===========================================================================

function ConvertedPlayer takes integer convertedPlayerId returns player

    return Player(convertedPlayerId - 1)

endfunction
 
Status
Not open for further replies.
Top