Skip to content

Duel.SetTargetPlayer ​

Signature ​

lua
Duel.SetTargetPlayer(int player) -> void

Description ​

Stores player as the target player for the currently handled Chain. Operations commonly read it with Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER), often together with CHAININFO_TARGET_PARAM. This stores Chain data for a player-facing effect; it does not select a card target.

How To Use It ​

Use this when the Chain Link stores a player choice or player destination rather than an official card target.

lua
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(1000)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000)

Read it during resolution with Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER). This is Chain data; it does not make the player a card target.

Parameters ​

  • player int - Player value stored on the current Chain.

Source ​

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

Guided Examples ​

Learn how to use this function in context:

More guided lessons (1)

Used By ​

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

  • Detected in 967 indexed script(s).
  • Search this function in the Script Explorer with Duel.SetTargetPlayer.
CardIDScriptDetected Calls
Pere-Zenet Em Heru46273941Scripts/c46273941.lua1
Junoldo the Shadespirit Power Patron10266279Scripts/c10266279.lua1
Flower Cardian Peony with Butterfly57261568Scripts/c57261568.lua1
A Bao A Qu, the Lightless Shadow4731783Scripts/c4731783.lua1
Flower Cardian Willow with Calligrapher89818984Scripts/c89818984.lua1
Magikey Dragon - Andrabime71159974Scripts/c71159974.lua1
Forbidden Dark Contract with the Swamp King10833828Scripts/c10833828.lua1
Meklord Astro Mekanikle63468625Scripts/c63468625.lua1
Abyss-steam63941169Scripts/c63941169.lua1
Purrely25550531Scripts/c25550531.lua1
Flower Cardian Moonflowerviewing33541430Scripts/c33541430.lua1
Witchcrafter Pittore95245544Scripts/c95245544.lua1
Fallen Paradise of the Sacred Beasts65861210Scripts/c65861210.lua1
Genex Ally Triforce52709508Scripts/c52709508.lua1
Vernusylph of the Thawing Mountains9238125Scripts/c9238125.lua1
Gladiator Beast Gaiodiaz90957527Scripts/c90957527.lua1
Megalith Anastasis29876299Scripts/c29876299.lua1
Fabled Realm's Revival57775790Scripts/c57775790.lua1
Miracle Synchro Fusion36484016Scripts/c36484016.lua1
Neo Super Quantal Mech King Blaster Magna95493471Scripts/c95493471.lua1
Indiora Doom Volt the Cubic Emperor3775068Scripts/c3775068.lua1
Vulcan Dragni the Cubic King77387463Scripts/c77387463.lua1
Rank-Up-Magic Zexal Force36224040Scripts/c36224040.lua1
Yummy★Redemption65853758Scripts/c65853758.lua1
...and 943 more

Script Examples ​

Pere-Zenet Em Heru (46273941) ​

Source: Scripts/c46273941.lua

lua
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
	Duel.SetTargetPlayer(tp)
	Duel.SetTargetParam(1)
	Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)

Junoldo the Shadespirit Power Patron (10266279) ​

Source: Scripts/c10266279.lua

lua
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
	Duel.SetTargetPlayer(tp)
	Duel.SetTargetParam(2)
	Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)

Flower Cardian Peony with Butterfly (57261568) ​

Source: Scripts/c57261568.lua

lua
function c57261568.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return true end
	Duel.SetTargetPlayer(tp)
	Duel.SetTargetParam(1)
	Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)