ntutbolt
2016-12-12T13:07:21Z
So i am trying to make an XYZ monster to be used as a Synchro Material. However i couldn't figure out how to do it. Can anyone help me with this problem? Here is what i got so far:
function c46715503.initial_effect(c)
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x97),4,2)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SYNCHRO_LEVEL)
e1:SetValue(c46715503.xyzlv)
c:RegisterEffect(e1)
end
function c46715503.xyzlv(e,c,rc)
return c:GetRank()
end
Shad3Light
2016-12-12T14:06:49Z
There's a thing here... an Xyz Monster is explicitly unable to be used as a Synchro Material, in the core code.
Michael Lawrence Dee
2016-12-12T14:46:16Z
See Xiangke Magician Anime and the 419 Token.
Now this is how I play:
ntutbolt
2016-12-12T15:22:15Z
Originally Posted by: Michael Lawrence Dee 

See Xiangke Magician Anime and the 419 Token.



Thank you very much, I got it to work now.
ntutbolt
2017-04-02T17:45:00Z
Hello again, I'm sorry for bringing this topic again but i wanted to start actually finishing my custom deck again to share with everyone. However when i came back, the code that i used for using XYZ monsters as synchro material have stopped working most likely because of some update. I was wondering if anyone can help me fix this issue.
Code:
function c46715503.initial_effect(c)
function aux.AddSynchroProcedure(c,f1,f2,ct)
local code=c:GetOriginalCode()
local mt=_G["c" .. code]
if f1 then
mt.tuner_filter=function(mc) return mc and f1(mc) end
else
mt.tuner_filter=function(mc) return true end
end
if f2 then
mt.nontuner_filter=function(mc) return mc and f2(mc) end
else
mt.nontuner_filter=function(mc) return true end
end
mt.minntct=ct
mt.maxntct=99
mt.sync=true
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynCondition(f1,f2,ct,99))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,ct,99))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,ct,99))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end
--Synchro monster, 1 tuner + 1 monster
function Auxiliary.AddSynchroProcedure2(c,f1,f2)
local code=c:GetOriginalCode()
local mt=_G["c" .. code]
if f1 then
mt.tuner_filter=function(mc) return mc and f1(mc) end
else
mt.tuner_filter=function(mc) return true end
end
if f2 then
mt.nontuner_filter=function(mc) return mc and f2(mc) end
else
mt.nontuner_filter=function(mc) return true end
end
mt.minntct=1
mt.maxntct=1
mt.sync=true
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(Auxiliary.SynCondition(f1,f2,1,1))
e1:SetTarget(Auxiliary.SynTarget(f1,f2,1,1))
e1:SetOperation(Auxiliary.SynOperation(f1,f2,1,1))
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
end


aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x97),4,2)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SYNCHRO_LEVEL)
e1:SetValue(c46715503.xyzlv)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CHANGE_LEVEL_FINAL)
e2:SetValue(c46715503.xyzlv)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(46715503)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(511000538)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e5:SetValue(c46715503.synlimit)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e6:SetDescription(aux.Stringid(46715503,0))
e6:SetType(EFFECT_TYPE_IGNITION)
e6:SetCountLimit(1,46715503)
e6:SetRange(LOCATION_MZONE)
e6:SetCost(c46715503.cost)
e6:SetTarget(c46715503.target)
e6:SetOperation(c46715503.operation)
c:RegisterEffect(e6)
if not c46715503.global_check then
c46715503.global_check=true
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_ADJUST)
ge2:SetCountLimit(1)
ge2:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
ge2:SetOperation(c46715503.synchk)
Duel.RegisterEffect(ge2,0)
end
end
function c46715503.synchk(e,tp,eg,ep,ev,re,r,rp)
Duel.CreateToken(tp,419)
Duel.CreateToken(1-tp,419)
end
function c46715503.xyzlv(e,c,rc)
return c:GetRank()
end
function c46715503.synlimit(e,c)
if not c then return false end
return not c:IsSetCard(0x97)
end
function c46715503.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c46715503.filter(c)
return c:IsSetCard(0x97) and c:IsType(TYPE_TUNER) and c:IsAbleToHand()
end
function c46715503.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,2)
and Duel.IsExistingMatchingCard(c46715503.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c46715503.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c46715503.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleDeck(tp)
Duel.BreakEffect()
Duel.DiscardDeck(tp,2,REASON_EFFECT)
end
end