Note that unit groups leak, meaning that the memory they take is not normally given back when you stop using them. Over time leaks build up, causing severe lag and eventually crashing the map.
There's 2 ways to fix it.
In GUI you can make a custom script line before every "Pick units in group" line. The line would be "set bj_wantDestroyGroup = true"(without the " signs).
If you need the group for more than a moment, then you have to story it in a variable and destroy it later.
Well thats my current Trigger:
-
expgain
-

Ereignisse
-

Bedingungen
-


(Owner of (Triggering unit)) Gleich Spieler 12 (Braun)
-

Aktionen
-


Einheitengruppe - Add all units of (Units within 750.00 of (Position of (Dying unit))) to heroexpgroup
-


Einheitengruppe - Pick every unit in heroexpgroup and do (Held - Add (25 x (Level of (Triggering unit))) experience to (Picked unit), Verbergen level-up graphics)
-


Einheitengruppe - Remove all units from heroexpgroup
So i just add that custom line between 'Add Units' and 'Pick every Unit' ?
Like this ?
function Trig_expgain_Conditions takes nothing returns boolean
if ( not ( GetOwningPlayer(GetTriggerUnit()) == Player(11) ) ) then
return false
endif
return true
endfunction
function Trig_expgain_Func002002 takes nothing returns nothing
call AddHeroXPSwapped( ( 25 * GetUnitLevel(GetTriggerUnit()) ), GetEnumUnit(), false )
endfunction
set bj_wantDestroyGroup = true
function Trig_expgain_Actions takes nothing returns nothing
call GroupAddGroup( GetUnitsInRangeOfLocAll(750.00, GetUnitLoc(GetDyingUnit())), udg_heroexpgroup )
call ForGroupBJ( udg_heroexpgroup, function Trig_expgain_Func002002 )
call GroupClear( udg_heroexpgroup )
endfunction
//===========================================================================
function InitTrig_expgain takes nothing returns nothing
set gg_trg_expgain = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_expgain, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_expgain, Condition( function Trig_expgain_Conditions ) )
call TriggerAddAction( gg_trg_expgain, function Trig_expgain_Actions )
endfunction
EDIT: Map cannot be saved and exp-Trigger is deactivated ?
Btw, I used a variable, so no need for this custom script ?