Skip to content

Duel.GetFlagEffect ​

Signature ​

lua
Duel.GetFlagEffect(int player, int code) -> int|nil

Description ​

Returns how many player flag effects with code are registered on player. The return value is a count, not a boolean; compare it with 0 when testing whether a player marker exists.

How To Use It ​

Use this to count matching player markers.

lua
if Duel.GetFlagEffect(tp,id)==0 then
    Duel.RegisterFlagEffect(tp,id,RESET_PHASE+PHASE_END,0,1)
end

The return value is a count. Use Duel.GetFlagEffectLabel when the marker's label value matters.

Parameters ​

  • player int - Player whose flag effects are counted.
  • code int - Flag-effect code; the core masks it with MAX_CARD_ID and adds EFFECT_FLAG_EFFECT.

Returns ​

  • int|nil - Number of matching player flag effects, or nil if player is invalid.

Source ​

  • D:\Programs\GitHub\ygopro-core\libduel.cpp:4854

Guided Examples ​

Learn how to use this function in context:

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 349 indexed script(s).
  • Search this function in the Script Explorer with Duel.GetFlagEffect.
CardIDScriptDetected Calls
Artmage Non-Finito74631897Scripts/c74631897.lua2
Pendulum Evolution55795155Scripts/c55795155.lua1
Eternal Favorite87532344Scripts/c87532344.lua2
Melffy Playtime Surprise58036097Scripts/c58036097.lua1
Mementotlan Fusion66518509Scripts/c66518509.lua3
Favorite HERO Flame Wingman13243124Scripts/c13243124.lua1
Gem-Knight Dispersion24220368Scripts/c24220368.lua3
Magnet Bonding65514302Scripts/c65514302.lua3
Hecahands Tartaros57809669Scripts/c57809669.lua2
Enneacraft - Archa.TAIL81237046Scripts/c81237046.lua1
D/D/D/D Dimensional King Arc Crisis71398055Scripts/c71398055.lua2
Shining Draw35906693Scripts/c35906693.lua1
Barian's Chaos Draw97769122Scripts/c97769122.lua1
Ultimate Crystal Rainbow Dragon Overdrive84544192Scripts/c84544192.lua1
Ashened to Endlessness34813443Scripts/c34813443.lua1
Penetration Fusion8778267Scripts/c8778267.lua1
Fiendsmith Kyrie26434972Scripts/c26434972.lua1
Chef de Nouvelles29251488Scripts/c29251488.lua2
Artmage Pact -Awakening-23599634Scripts/c23599634.lua1
Hunting Horn55421040Scripts/c55421040.lua1
Echelon of the Fire Kings38798785Scripts/c38798785.lua1
Double Interlock38129297Scripts/c38129297.lua3
Mementotlan Shleepy50042011Scripts/c50042011.lua1
K9-X Forced Release53792930Scripts/c53792930.lua1
...and 325 more

Script Examples ​

Artmage Non-Finito (74631897) ​

Source: Scripts/c74631897.lua

lua
end
function s.splimit(e,se,sp,st)
	return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION and Duel.GetFlagEffect(sp,id)==0
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)

Pendulum Evolution (55795155) ​

Source: Scripts/c55795155.lua

lua
end
function c55795155.pcon(e,tp,eg,ep,ev,re,r,rp)
	return Duel.GetFlagEffect(tp,55795155)>0
end
function c55795155.ptg(e,tp,eg,ep,ev,re,r,rp,chk)

Eternal Favorite (87532344) ​

Source: Scripts/c87532344.lua

lua
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetFlagEffect(tp,id)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
		and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) end
	Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())