[JASS] spawning units from building

Status
Not open for further replies.
i have this so far but for some reason it doesnt add the unit to the group

JASS:
function Trig_Battlegrounds_setting_Groups_Actions takes nothing returns nothing
    local unit u
    set u = GetTrainedUnit()
    call GroupAddUnit( Battlegrounds_Group_Player[0], u )
    
endfunction

//===========================================================================
function InitTrig_Battlegrounds_setting_Groups takes nothing returns nothing
    set gg_trg_Battlegrounds_setting_Groups = CreateTrigger(  )
    call TriggerRegisterUnitEvent( gg_trg_Battlegrounds_setting_Groups, gg_unit_u00J_0085, EVENT_UNIT_TRAIN_FINISH )
    call TriggerAddAction( gg_trg_Battlegrounds_setting_Groups, function Trig_Battlegrounds_setting_Groups_Actions )
endfunction

and its for like when barracks creates a unit
 
In the post #4, I don't see any CreateGroup() function there ?
As I said before, if it is a Unit Group variable with ARRAY enabled, you must create it first by using the function CreateGroup() before accessing it.

You can't simply have globals to a Unit Group ARRAY, if it is non-array, well you can leave it as it is.

But we're talking about ARRAY Unit Group, that is why that function is needed.
 
lol i found out the problem i accidently set the units being trained in the unit editor to units sold instead of units trained lol oops thx for ur help tho and ik #4 isnt the trigger tht the group is created in it is created in another group thts wat i meant ive dealt w group arrays i have a few in my map it was the first thing i looked at it was just under the object editor tht it was the problem lol and in post #5 i said it was created in the trigger tht declares it as a group lol i did not say tht the trigger i posted on here was the trigger tht declared or created it
 
Status
Not open for further replies.
Back
Top