Trouble with adding unit to group

Shadow

TH.net Regular
Reaction score
23
Trying to add a unit to a unit group then when a unit enters circle of power give them all units in the unit group i but the unit isnt getting added for some reason

JASS:
scope Victory initializer onInit
    // Edit the values belows /////////////////////////////////////////////////////////
    globals
        public constant player TEAM_1_PLAYER = Player(0)
        public constant player TEAM_2_PLAYER = Player(6)
        public constant integer Wu_Commander_ID = 'H006'
        public constant integer Wei_Commander_ID = 'Hmkg'
         
    endglobals
    ///////////////////////////////////////////////////////////////////////////////////
    private function Filter_Func1 takes nothing returns boolean
        if IsPlayerAlly(GetFilterPlayer(),TEAM_1_PLAYER) then
            call CustomVictoryBJ(GetFilterPlayer(),true,true)
            return false
        endif
        call CustomDefeatBJ(GetFilterPlayer(),"Defeat!")
        return false
    endfunction

    public function VictoryTeam1 takes nothing returns nothing
        local force f = CreateForce()
        call ForceEnumPlayers(f,Filter(function Filter_Func1))
        call DestroyForce(f)
        set f = null
    endfunction

    private function Filter_Func2 takes nothing returns boolean
        if IsPlayerAlly(GetFilterPlayer(),TEAM_2_PLAYER) then
            call CustomVictoryBJ(GetFilterPlayer(),true,true)
            return false
        endif
        call CustomDefeatBJ(GetFilterPlayer(),"Defeat!")
        return false
    endfunction
    
    public function VictoryTeam2 takes nothing returns nothing
        local force f = CreateForce()
        call ForceEnumPlayers(f,Filter(function Filter_Func2))
        call DestroyForce(f)
        set f = null
    endfunction
    
    public function Conditions takes nothing returns boolean
        if IsUnitAlly(GetTriggerUnit(),Victory_TEAM_1_PLAYER) then
            call VictoryTeam2()
        else
            call VictoryTeam1()
        endif
        return false
    endfunction
         

    
    private function onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local unit u = CreateUnit(Player(13),Wu_Commander_ID,-250,-9081,90)
        set armies_Army[1] = CreateGroup()
        call GroupAddUnit(armies_Army[1], u)
        call TriggerRegisterUnitEvent(t,u,EVENT_UNIT_DEATH)
        set u = null
        call TriggerRegisterUnitEvent(t,CreateUnit(Player(1),Wei_Commander_ID,2681,9006,270),EVENT_UNIT_DEATH)
        call TriggerAddCondition(t,Condition(function Conditions))
    endfunction
endscope


JASS:
scope SunQuan initializer onInit
 
public function ChangeOwner takes nothing returns nothing
    call KillUnit(GetTriggerUnit())
    call SetUnitOwner(GetEnumUnit(), GetOwningPlayer(GetTriggerUnit()), true)
endfunction

private function Conditions takes nothing returns boolean
    call ForGroup(armies_Army[1], function ChangeOwner)
    return false
endfunction

private function onInit takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterUnitInRange(t, CreateUnit(Player(13),'ncop',-5800,4370,90),100,null)
    call TriggerAddCondition(t,Condition(function Conditions))
    endfunction
endscope
 

emjlr3

Change can be a good thing
Reaction score
395
so what have you done to debug?
 

Shadow

TH.net Regular
Reaction score
23
I think I found my issue, in another trigger that happens after .05 secs

JASS:
        call CreateUnits(-200,-7843,3,2,'h003',90,Player(13))
call GroupEnumUnitsInRange(Army[1],-200,-7843,1000,Filter(function OwningPlayer))


I think its overwritten my previous data in group one is there something like GroupAddUnitEnumUnitsInRange?
or do I have to do something like

call GroupAddUnit(Army[1], GroupEnumUnitsInRange(...)) , if so having difficulty filling in the blanks.
 

Shadow

TH.net Regular
Reaction score
23
is there no native? cause when I inline I Get GroupAddUnit. Sorry im sorta new to jass all I want to is create units then add them to a group
 

emjlr3

Change can be a good thing
Reaction score
395
there is no groupaddgroup native
 

Shadow

TH.net Regular
Reaction score
23
so if you personally created units how would you add them to a group after they were created I guess is what im asking
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top