Duel.MoveToField
Signature
Duel.MoveToField(Card c, int move_player, int target_player, int dest, int positions, bool enable, [int zone]) -> boolDescription
Moves c onto target_player's field and returns true if the move succeeds. dest is normally LOCATION_MZONE or LOCATION_SZONE. LOCATION_FZONE and LOCATION_PZONE are accepted and converted to the matching Spell & Trap Zone handling by the core. For LOCATION_PZONE, the core requires a Pendulum Card, lets the player choose an open Pendulum Zone, and sends the card to the GY by rule if no matching Pendulum Zone is usable. Use this for field placement, not for Equip relationships; Equip Cards should use Duel.Equip.
How To Use It
Use this for effects that place an existing card directly onto the field, such as moving a card to the Field Zone, Pendulum Zone, or Spell & Trap Zone.
if tc:IsRelateToEffect(e) then
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
endenable=true applies the moved card's field effects immediately. The optional zone mask restricts which zone can be used.
Related Functions
Parameters
cCard- Card to move.move_playerint- Player making the placement selection.target_playerint- Player whose field receives the card.destint- Destination location. LOCATION_PZONE is accepted for Pendulum Zone placement.positionsint- Allowed position mask, commonly POS_FACEUP for Pendulum Zone placement.enablebool- Whether to enable the card's field effects after it moves. Local Pendulum placement scripts commonly pass true.zoneintoptional - Optional zone mask. For LOCATION_PZONE, low bit 0 allows the left Pendulum Zone and low bit 1 allows the right Pendulum Zone; omitted defaults to both.
Returns
bool- true if the move succeeds; false if the move is invalid or no usable zone is available.
Source
D:\Programs\GitHub\ygopro-core\libduel.cpp:4882
Guided Examples
Learn how to use this function in context:
- Counters
- Equip Spells and Equip Cards
- Field Spells
- Functions That Move Cards Across Locations
- Pendulum Procedure Guide
Used By
Generated from the local Scripts/ folder and cards.cdb.
- Detected in 264 indexed script(s).
- Search this function in the Script Explorer with
Duel.MoveToField.
Script Examples
Astrograph Sorcerer, the Starfrost Magician (48171151)
Source: Scripts/c48171151.lua
local g=Duel.SelectMatchingCard(tp,s.pfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,tp)
local tc=g:GetFirst()
if tc and Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)Astrograph Sorcerer (76794549)
Source: Scripts/c76794549.lua
end
if op==0 then
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
else
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)D/D/D Alfred the Divine Sage King (11852093)
Source: Scripts/c11852093.lua
end
for tc in aux.Next(pg) do
Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
local sg=g:Filter(Card.IsLocation,nil,LOCATION_REMOVED)