Group.SelectSubGroup
Signature
Group.SelectSubGroup(Group g, int tp, function f, bool cancelable, [int min], [int max], ... any) -> Group|nilDescription
Lets tp select a subgroup from g with size between min and max that satisfies f. It respects already selected cards and returns nil if no valid selection is completed. Use Group.CheckSubGroup for the legality check, then SelectSubGroup where the player actually chooses the cards. If the chosen Group is stored for a later callback, call KeepAlive and later DeleteGroup. Use this for group-level requirements; use Group.FilterSelect for ordinary one-card filters.
How To Use It
Use this when the player must choose a subset that satisfies a group-level rule, not just individual card filters.
local sg=g:SelectSubGroup(tp,s.goal,false,2,3)
if sg then
Duel.SendtoGrave(sg,REASON_EFFECT)
endUse the matching Group.CheckSubGroup shape in chk==0 legality checks so the real prompt only appears after activation is legal.
Related Functions
Parameters
gGrouptpintffunctioncancelableboolminintoptionalmaxintoptional...any
Returns
Group|nil- The selected subgroup, or nil if no valid selection is completed.
Source
Utilities/utility.lua:1258
Guided Examples
Learn how to use this function in context:
- Filters, Card Objects, and Group Objects
- Link Procedure Guide
- Pendulum Procedure Guide
- Ritual Procedure Guide
- Selection And Group Handling
- Special Summon-Only Monster Guide
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 648 indexed script(s).
- Search this function in the Script Explorer with
Group.SelectSubGroup.
Script Examples
Pendulum Evolution (55795155)
Source: Scripts/c55795155.lua
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
aux.GCheckAdditional=aux.PendOperationCheck(ft1,ft2,ft)
local g=tg:SelectSubGroup(tp,aux.TRUE,false,1,math.min(#tg,ft))
aux.GCheckAdditional=nil
if not g thenLevia-Dragoon - Daedalus (78579058)
Source: Scripts/c78579058.lua
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local cancel=Duel.IsSummonCancelable()
local sg=mg:SelectSubGroup(tp,s.LCheckGoal,cancel,minc,maxc,tp,c,gf,lmat)
if sg then
sg:KeepAlive()Lady's Dragonmaid (48658295)
Source: Scripts/c48658295.lua
local g=Duel.GetMatchingGroup(s.fusfilter,cp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil)
Duel.Hint(HINT_SELECTMSG,cp,HINTMSG_REMOVE)
local sg=g:SelectSubGroup(cp,s.fselect,true,2,2)
if sg then
sg:KeepAlive()