Skip to content

Duel.GetControl ​

Signature ​

lua
Duel.GetControl(Card|Group targets, int player, [int reset_phase], [int reset_count], [int zone]) -> int

Description ​

Moves control of targets to player and returns the number of cards whose control actually changed. Use reset_phase and reset_count for temporary control, such as PHASE_END, 1. To pass only a zone mask, use 0, 0, zone. Use Card.IsControlerCanBeChanged in target filters and recheck relation before changing control at resolution.

How To Use It ​

Use this when an effect takes control of cards.

For temporary control, pass a phase and count. For permanent control, omit those arguments. If you only need to restrict the destination zone, pass 0,0,zone before the zone mask.

lua
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
    Duel.GetControl(tc,tp,PHASE_END,1)
end

The return value is the number of cards that actually changed control, so use >0 when later logic depends on success.

Parameters ​

  • targets Card|Group
  • player int
  • reset_phase int optional - default: 0
  • reset_count int optional - default: 0
  • zone int optional - default: 0xff

Returns ​

  • int

Source ​

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

Guided Examples ​

Learn how to use this function in context:

Used By ​

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

  • Detected in 159 indexed script(s).
  • Search this function in the Script Explorer with Duel.GetControl.
CardIDScriptDetected Calls
Goyo Emperor59255742Scripts/c59255742.lua1
Tellusion the Magna Warrior24431911Scripts/c24431911.lua1
Enlilgirsu, the Orcust Mekk-Knight74820316Scripts/c74820316.lua1
R.B. Lambda Blade17188206Scripts/c17188206.lua1
Phara the Primordial Goddess82344137Scripts/c82344137.lua1
Eternal Bond45283341Scripts/c45283341.lua1
Possessed Destiny - Wynn60516416Scripts/c60516416.lua1
Borreload Dragon31833038Scripts/c31833038.lua1
Fabled Levilazebul21281085Scripts/c21281085.lua1
Primite Howl41488249Scripts/c41488249.lua1
Vanquish Soul Hollie Sue93156774Scripts/c93156774.lua1
Distrust Paranoia81965543Scripts/c81965543.lua1
Amaze Attraction Viking Vortex97182396Scripts/c97182396.lua1
Hecahands Xeno94410955Scripts/c94410955.lua1
Evil Lord - Zorc73320394Scripts/c73320394.lua1
Chaotic Elements92221402Scripts/c92221402.lua1
SPYRAL MISSION - Recapture39373426Scripts/c39373426.lua1
Ancient Warriors Saga - Deception and Betrayal45115956Scripts/c45115956.lua1
Angelechy Enlisted81797573Scripts/c81797573.lua1
Altergeist Adminia61470213Scripts/c61470213.lua1
Time Thief Double Barrel91135480Scripts/c91135480.lua1
Borreload Liberator Dragon27096833Scripts/c27096833.lua1
Metaphys Horus36898537Scripts/c36898537.lua1
Tragoedia98777036Scripts/c98777036.lua1
...and 135 more

Script Examples ​

Goyo Emperor (59255742) ​

Source: Scripts/c59255742.lua

lua
	local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
	if Duel.GetLocationCount(tp,LOCATION_MZONE)<g:GetCount() then return end
	Duel.GetControl(g,tp)
end
function c59255742.ctcon(e,tp,eg,ep,ev,re,r,rp)

Tellusion the Magna Warrior (24431911) ​

Source: Scripts/c24431911.lua

lua
		if e:GetLabel()==1 and tc:IsControlerCanBeChanged()
			and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then
			Duel.GetControl(tc,tp)
		else
			Duel.Destroy(tc,REASON_EFFECT)

Enlilgirsu, the Orcust Mekk-Knight (74820316) ​

Source: Scripts/c74820316.lua

lua
			if cg:GetCount()>0 then
				Duel.HintSelection(cg)
				Duel.GetControl(cg:GetFirst(),tp)
			end
		end