• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Trigger request

Status
Not open for further replies.
Level 6
Joined
May 29, 2013
Messages
127
trigger to pick all units that the player owns. and select 12 units in that unit group make the attack order to the ability target location for each second.

I tried to use GetRandomSubGroup, but it has leak :(
Please help
 
Level 6
Joined
May 29, 2013
Messages
127
I wasn't sure what "...for each second" meant, so I left whatever that was out.

I added filters to make sure that structures, peon-type units, dead units, units not owned by the player, and the caster weren't given the order.

thank for your help. but GetRandomSubGroup(random units in group) have leak :( Can I get another way?

JASS:
function GetRandomSubGroup takes integer count, group sourceGroup returns group
    local group g = CreateGroup()

    set bj_randomSubGroupGroup = g
    set bj_randomSubGroupWant  = count
    set bj_randomSubGroupTotal = CountUnitsInGroup(sourceGroup)

    if (bj_randomSubGroupWant <= 0 or bj_randomSubGroupTotal <= 0) then
        return g
    endif

    set bj_randomSubGroupChance = I2R(bj_randomSubGroupWant) / I2R(bj_randomSubGroupTotal)
    call ForGroup(sourceGroup, function GetRandomSubGroupEnum)
    return g
endfunction
 
Status
Not open for further replies.
Top