local g=Duel.GetMatchingGroup(c87910978.filter,tp,0,LOCATION_MZONE,nil)
local tc=g:GetFirst()
while tc do
Duel.GetControl(tc,tp,PHASE_END,1)
tc=g:GetNext()
end
--Xエクシーズ
function c2902.initial_effect(c)
--xyz level
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c2902.xyztg)
e1:SetOperation(c2902.xyzop)
c:RegisterEffect(e1)
end
function c2902.xyzfilter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ)
end
function c2902.xyztg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c2902.xyzfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c2902.xyzfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c2902.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c2902.xyzop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_XYZ_LEVEL)
e1:SetValue(c2902.xyzlv)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
function c2902.xyzlv(e,c,rc)
return c:GetRank()
end
function c2304.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunFunRep(c,c2304.mfilter1,c2304.mfilter2,1,63,true)
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.fuslimit)
c:RegisterEffect(e1)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(2304,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetCondition(c2304.spcon)
e3:SetTarget(c2304.sptg)
e3:SetOperation(c2304.spop)
c:RegisterEffect(e3)
--indes
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetCondition(c2304.indcon)
e4:SetOperation(c2304.indop)
c:RegisterEffect(e4)
end
function c2304.mfilter1(c)
return c:IsFusionSetCard(0xc7) and c:IsType(TYPE_FUSION)
end
function c2304.mfilter2(c)
return c:IsFusionSetCard(0xc7)
end
function c2304.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetReasonPlayer()~=tp and c:IsReason(REASON_EFFECT)
and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP)
end
function c2304.spfilter(c,e,tp,code)
return c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c2304.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and Duel.IsExistingMatchingCard(c2304.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp,75347539)
and Duel.IsExistingMatchingCard(c2304.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp,42901635) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND+LOCATION_DECK)
end
function c2304.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,59822133)
or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g1=Duel.GetMatchingGroup(c2304.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil,e,tp,34079868)
local g2=Duel.GetMatchingGroup(c2304.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,nil,e,tp,98287529)
if g1:GetCount()>0 and g2:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=g1:Select(tp,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg2=g2:Select(tp,1,1,nil)
sg1:Merge(sg2)
Duel.SpecialSummon(sg1,0,tp,tp,true,false,POS_FACEUP)
end
end
function c2304.indcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return bit.band(c:GetSummonType(),SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION and c:GetMaterialCount()>=3
end
function c2304.indop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetDescription(aux.Stringid(2304,0))
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetProperty(EFFECT_FLAG_CLIENT_HINT)
c:RegisterEffect(e2)
end
end
function c2038.zfilter(c)
return c:IsFaceup() and c:IsSetCard(0xb) and c:IsType(TYPE_SYNCHRO) and c:IsLevelAbove(8)
end
function c2038.mfilter(c)
return c:IsSetCard(0xb) and c:IsReleasableByEffect()
end
function c2038.cfilter(c,tp)
return c:GetSummonPlayer()~=tp
end
function c2038.syncon(e,tp,eg,ep,ev,re,r,rp)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c2038.cfilter,1,nil,tp)
and Duel.IsExistingMatchingCard(c2038.zfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c2038.syncost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c2038.mfilter,2,nil) end
local g=Duel.SelectReleaseGroup(tp,c2038.mfilter,2,2,nil)
Duel.Release(g,REASON_COST)
end
function c2038.syntg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2
and e:GetHandler():IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c2038.synop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c and Duel.CheckReleaseGroup(tp,c2038.mfilter,2,nil) then
local g=Duel.SelectReleaseGroup(tp,c2038.mfilter,2,2,nil)
if g:GetCount()>1 then
Duel.Release(g,REASON_EFFECT)
Duel.SpecialSummon(c,SUMMON_TYPE_SYNCHRO,tp,tp,true,true,POS_FACEUP)
c:CompleteProcedure()
end
end
end
c4377.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>=3
and Duel.IsExistingMatchingCard(c4377.spfilter,tp,0x13,0,3,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,3,tp,0x13)
end
function c4377.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<3 then return end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c4377.spfilter),tp,0x13,0,nil,e,tp)
if g:GetCount()>2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,3,3,nil)
Duel.SpecialSummon(sg,0,tp,tp,true,true,POS_FACEUP)-> 3
end
if tc:IsType(TYPE_TRAPMONSTER) then
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e3)
endunction c4377.filter1(c,e,tp)
local rk=c:GetRank()
return c:IsFaceup() and c:IsType(TYPE_XYZ) and rk==4
and Duel.IsExistingMatchingCard(c4377.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,rk+1)
end
function c4377.filter2(c,e,tp,mc,rk)
if c.rum_limit_code and not mc:IsCode(c.rum_limit_code) then return false end
return c:GetRank()==rk and c:IsSetCard(0x1048) and mc:IsCanBeXyzMaterial(c)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
end
function c4377.targets(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c92365601.filter1(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingTarget(c4377.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c4377.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c4377.activates(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<0 then return end
local tc=Duel.GetFirstTarget()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c4377.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+1)
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(tc))
Duel.Overlay(sc,Group.FromCards(tc))
Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
sc:CompleteProcedure()
endfunction c4377.filter(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER)
end
function c4377.targetss(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and c4377.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c4377.filter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(4377,0))
local g=Duel.SelectTarget(tp,c48976825.filter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0)
end
function c4377.activatess(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=tg:Filter(Card.IsRelateToEffect,nil,e)
if sg:GetCount()>0 then
Duel.SendtoGrave(sg,REASON_EFFECT+REASON_RETURN)
end
end
連投失礼しました。
フィールドのモンスターを対象に取らずにX素材として吸収する効果を作ったら、
Xモンスターを吸収した時にそのモンスターのX素材だけフィールドに残ったままになてしまいました。
吸収する側から素材を前もって取り除く効果が必要みたいですが、まったくうまくいきませんでした。
GetOverlayGroupが何とかとエラーが出てしまいます。指摘をおねがいします。以下スプ
function c6511115.mtfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsFaceup() and (c:IsControler(tp) or c:IsAbleToChangeControler()) and not c:IsType(TYPE_TOKEN)
end
function c6511115.mttg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c6511115.mtfilter,tp,0,LOCATION_MZONE,1,nil,e) end
end
function c6511115.mtop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then end
local og=Duel.SelectMatchingCard(tp,c6511115.mtfilter,tp,0,LOCATION_MZONE,1,1,nil,e)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local og=tc:GetOverlayGroup()
if tc:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
Duel.Overlay(c,Group.FromCards(tc))
end
end
フィールドのモンスターを対象を取らずにX素材として吸収する効果を作ったところ、吸収したXモンスターのX素材がフィールドに残ってしまいました。
他のカード効果を参考に吸収される側の素材を取り除く効果を組み込もうとしたら、
大体エラーでGetOverlayGroupと出てきてしまいます。ご指摘をお願いします。
スプ↓
function c6511115.mtfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsFaceup() and (c:IsControler(tp) or c:IsAbleToChangeControler()) and not c:IsType(TYPE_TOKEN)
end
function c6511115.mttg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c6511115.mtfilter,tp,0,LOCATION_MZONE,1,nil,e) end
end
function c6511115.mtop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then end
local og=Duel.SelectMatchingCard(tp,c6511115.mtfilter,tp,0,LOCATION_MZONE,1,1,nil,e)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local og=tc:GetOverlayGroup()
if tc:GetCount()>0 then
Duel.SendtoGrave(og,REASON_RULE)
Duel.Overlay(c,Group.FromCards(tc))
end
end
end
function c2170.etarget(e,c)
return c:IsSetCard(0x999) and not IsCode(2170)
end
function c2170.efilter(e,re)
return re:GetOwnerPlayer()~=e:GetHandlerPlayer()
end
対象取らない吸収の時の者です。
相手の耐性を無視してX素材化する事態が発生することがわかったため
いろいろ錯誤しましたが結局ここに来ちゃいました。
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local og=Duel.SelectMatchingCard(tp,c5.mtfilter,tp,0,LOCATION_MZONE,1,1,nil,e)
if c:IsRelateToEffect(e) and c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e) then
if chk==0 then return og:GetFirst():RemoveOverlayCard(tp,1,REASON_RULE) end
local g=og:GetFirst():GetOverlayGroup()
if og:GetCount()>0 then end
Duel.SendtoGrave(g,REASON_RULE)
end
Duel.Overlay(c,og)
恐らくIsImmuneToEffect(e)で制御するものと思いましたが、うまくいきませんでした
ご指摘をお願いします。
↓真竜皇アグニマズドVの①の効果のスクリプトなのですが、各部分の意味を教えてください
function c96746083.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local loc=LOCATION_MZONE+LOCATION_HAND
if ft<0 then loc=LOCATION_MZONE end
local loc2=0
if Duel.IsPlayerAffectedByEffect(tp,88581108) then loc2=LOCATION_MZONE end
local g=Duel.GetMatchingGroup(c96746083.desfilter,tp,loc,loc2,c)
if g:GetCount()<2 or not g:IsExists(Card.IsAttribute,1,nil,ATTRIBUTE_FIRE) then return end
local g1=nil local g2=nil
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
if ft<1 then
g1=g:FilterSelect(tp,c96746083.locfilter,1,1,nil,tp)
else
g1=g:Select(tp,1,1,nil)
end
g:RemoveCard(g1:GetFirst())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
if g1:GetFirst():IsAttribute(ATTRIBUTE_FIRE) then
g2=g:Select(tp,1,1,nil)
else
g2=g:FilterSelect(tp,Card.IsAttribute,1,1,nil,ATTRIBUTE_FIRE)
end
g1:Merge(g2)
local rm=g1:IsExists(Card.IsAttribute,2,nil,ATTRIBUTE_FIRE)
if Duel.Destroy(g1,REASON_EFFECT)==2 then
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) then
Duel.SendtoGrave(c,REASON_RULE)
return
end
local rg=Duel.GetMatchingGroup(c96746083.rmfilter,tp,0,LOCATION_MZONE+LOCATION_GRAVE,nil,tp)
if rm and rg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(96746083,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local tg=rg:Select(tp,1,1,nil)
Duel.HintSelection(tg)
Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)
end
end
end
ディニクアビスの特殊召喚効果をフリーチェーン化したのですが、自身の効果にチェーンして重複して発動できてしまいます。
どうスクリプトを修正すればいいでしょうか?
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(122446869,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c122446869.spcost)
e1:SetTarget(c122446869.sptg)
e1:SetOperation(c122446869.spop)
c:RegisterEffect(e1)
function c122446869.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c122446869.cfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,c122446869.cfilter,1,1,REASON_COST+REASON_DISCARD,e:GetHandler())
end
function c122446869.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c122446869.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) then
Duel.SendtoGrave(c,REASON_RULE)
end
end
リバイバルゴーレムの
e:SetLabel(opt)
if opt==1 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
elseif opt==2 then
e:SetCategory(CATEGORY_TOHAND)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
else
e:SetCategory(0)
end
の部分にはどういう意味があるんですか?
ちなみにe:GetHandler()は自分自身、つまり発動しているこのカード(リバイバルゴーレム)のこと
これの代わりにtcとか適当な文字を置いて、その前の時点で
local tc=Duel.IsExistingMatchingCard(ここはさっきみたいに決められた数値を入れる)
とかでtcがどういうカードかを定義しておけばいい
>>263
そのデッキ用の効果ってのがちょっと上手くいかないんです
すごく短いので載せます
function c2000000005.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c2000000005.cost)
e1:SetOperation(c2000000005.op)
c:RegisterEffect(e1)
local e2=e1:Clone()
e1:SetRange(0xf7)
c:RegisterEffect(e2)
end
function c2000000005.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
function c2000000005.op(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Draw(tp,2,REASON_EFFECT)
end
これで全部です
手札からもデッキからも発動はできますが、デッキからの発動がシャドーループと全然違うのですっきりしないのです
--special summon
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(122446869,0))
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e6:SetCode(EVENT_TO_GRAVE)
e6:SetTarget(c122446869.target)
e6:SetOperation(c122446869.operation)
c:RegisterEffect(e6)
function c122446869.grfilter(c)
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToHand and LOCATION_GRAVE
end
function c122446869.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local opt=0
local c=e:GetHandler()
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
local b2=c:IsAbleToHand()
if b1 and b2 then
opt=Duel.SelectOption(tp,aux.Stringid(122446869,1),aux.Stringid(122446869,2))+1
elseif b1 then
opt=Duel.SelectOption(tp,aux.Stringid(122446869,1))+1
elseif b2 then
opt=Duel.SelectOption(tp,aux.Stringid(122446869,2))+2
end
e:SetLabel(opt)
if opt==1 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c122446869.grfilter(),1,0,0)
elseif opt==2 then
e:SetCategory(CATEGORY_TOHAND)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,c122446869.grfilter(),1,0,0)
else
e:SetCategory(0)
end
end
function c122446869.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()==1 then
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c122446869.grfilter,0,tp,tp,false,false,POS_FACEUP)
end
elseif e:GetLabel()==2 then
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c122446869.grfilter,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,c)
end
end
end
return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToHand and LOCATION_GRAVE
end
のどこかまでわかってたら、その中身をちょっとずつ削る
エラーログはなぜかデュエル中は全部表示されない(上に同じ奴がいっぱい出る)から、サレンダーしてソリティアの画面に戻ると上の部分が見える
魔力の枷から効果発動にコストを課す所だけ抜き出してみました
function c2000000005.initial_effect(c)
--Activate
〜〜e1は発動なので省略〜〜
--activate cost
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetTarget(c2000000005.actarget)
e2:SetOperation(c2000000005.costop)
c:RegisterEffect(e2)
end
function c2000000005.actarget(e,te,tp)
return te:GetHandler():IsLocation(LOCATION_HAND)
end
function c2000000005.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.PayLPCost(tp,500)
end
どうやらプレイヤーを対象にしているようですが……どこをどう攻めたらいいか全くわかりません
類似効果のカードがあれば参考にもできましょうが
>>280
うーむこういうことでしょうか
local e2=Effect.CreateEffect(c)
〜〜略〜〜
e2:SetRange(LOCATION_DECK)
e2:SetLabelObject(e3)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_ACTIVATE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetOperation(c2000000005.op)
c:RegisterEffect(e3)
end
function c2000000005.actarget(e,te,tp)
return te==e:GetLabelObject()
end
function c2000000005.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.PayLPCost(tp,500)
end
function c2000000005.op(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Draw(tp,2,REASON_EFFECT)
end
local e2=e1:Clone()
e2:SetRange(LOCATION_DECK)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_DECK)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,1)
e3:SetTarget(c2000000005.actarget)
e3:SetOperation(c2000000005.costop)
c:RegisterEffect(e3)
e3:SetLabelObject(e2)
〜〜
function c2000000005.actarget(e,te,tp)
return te==e:GetLabelObject()
end
function c2000000005.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
.filterとかは自分で宣言して作ってる関数だから引数は何でも入れられる
例えば
function cX.filter(c,tc)
return c:GetAttack()==tc:GetAttack()
end
〜〜
cX.filter(sc,e:GetHandler())
とか
function cX.filter(c,e)
return c:GetAttack()==e:GetHandler():GetAttack()
end
〜〜
cX.filter(sc,e)
とか
質問の答えはこれで良いのかな…?
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
ここのcの定義を水属性モンスターに変更するにはどうすればいいでしょうか?
定義のやり方だけでもいいので教えてください…
結局ダイナスターからひっぱてやってみたんですが
素材揃っていても出せず「e2:SetCondition(c300.spcon)」を消したら素材の有無に関係なく出せてしまい素材もリリースされません
function c300.initial_effect(c)
--fusion material
c:EnableReviveLimit()
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c300.splimit)
c:RegisterEffect(e1)
--special summon rule
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(c300.spcon)
e2:SetOperation(c300.spop)
c:RegisterEffect(e2)
end
function c300.splimit(e,se,sp,st)
return e:GetHandler():GetLocation()~=LOCATION_EXTRA
end
function c300.spfilter1(c,tp,fc)
return c:IsFusionSetCard(0xe2) and c:IsType(TYPE_FIELD) and c:IsCanBeFusionMaterial(fc)
and Duel.CheckReleaseGroup(tp,c300.spfilter2,1,c,fc)
end
function c300.spfilter2(c,fc)
return c:IsType(TYPE_FIELD) and c:IsSetCard(0xe2) and c:IsCanBeFusionMaterial(fc)
end
function c300.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_ONFIELD+LOCATION_HAND)>-2
and Duel.CheckReleaseGroup(tp,c300.spfilter1,1,nil,tp,c)
end
function c300.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g1=Duel.SelectReleaseGroup(tp,c300.spfilter1,1,1,nil,tp,c)
local g2=Duel.SelectReleaseGroup(tp,c300.spfilter2,1,1,g1:GetFirst(),c)
g1:Merge(g2)
c:SetMaterial(g1)
Duel.Release(g1,REASON_COST+REASON_FUSION+REASON_MATERIAL)
end
function c300.spfilter(c,e,tp)
return c:IsSetCard(0xe2) and c:IsType(TYPE_FIELD) and c:IsSetCard(0xe2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
自分はこんな感じに落ち着きましたがいかがでしょうか?
function c2129638.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunFunRep(c,c2129638.mfilter1,c2129638.mfilter2,1,true,true)
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c2129638.splimit)
c:RegisterEffect(e1)
--special summon rule
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(c2129638.spcon)
e2:SetOperation(c2129638.spop)
c:RegisterEffect(e2)
end
function c2129638.mfilter1(c)
return c:IsSetCard(0xe2) and c:IsType(TYPE_FIELD)
end
function c2129638.mfilter2(c)
return c:IsSetCard(0xe2) and c:IsType(TYPE_MONSTER)
end
function c2129638.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end
function c2129638.spfilter1(c,fc)
return c:IsSetCard(0xe2) and c:IsType(TYPE_FIELD) and c:IsCanBeFusionMaterial(fc) and c:IsAbleToGraveAsCost()
end
function c2129638.spfilter2(c,fc)
return c:IsSetCard(0xe2) and c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial(fc) and c:IsAbleToGraveAsCost()
end
function c2129638.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_ONFIELD+LOCATION_HAND)>-2
and Duel.IsExistingMatchingCard(c2129638.spfilter1,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil,c)
and Duel.IsExistingMatchingCard(c2129638.spfilter2,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil,c)
end
function c2129638.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,c2129638.spfilter1,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil,c)
local g2=Duel.SelectMatchingCard(tp,c2129638.spfilter2,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil,c)
g1:Merge(g2)
c:SetMaterial(g1)
Duel.SendtoGrave(g1,REASON_COST)
end
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
これのcってどうやって「同名カードを除く水属性モンスター」を定義するように書き換えるんですか?
元は
local c=e:GetHandler()
です。
選択肢を出す奴を作ってみてるのですが以下のエラーが出ます
22:Parameter 2 should be "Effect".
該当行は
function c1500.filter2(c,e,tp)
return c:IsType(TYPE_MONSTER)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
の特殊召喚の下りです
そこを消したらエラーは出ないのですがいろいろと困ります
アドバイスよろしくお願いします
function c3006.filter(c)
return c:IsCode(78785392) and c:IsAbleToHand()
end
function c3006.target (e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c3006.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c3006.target (e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c3006.filter,tp,LOCATION_DECK,0,1,nil) end
local sg=Duel.GetMatchingGroup(c3006.filter,tp,LOCATION_DECK,0,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,sg,sg:GetCount(),0,0)
end
function c3006.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c3006.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.BreakEffect()
local sg=Duel.GetMatchingGroup(c3006.filter,tp,LOCATION_DECK,0,nil)
Duel.Remove(sg,POS_FACEDOWN,REASON_EFFECT)
end
end
function c2261.desfilter(c)
return c:IsFaceup() and c:IsSetCard(0x798)
and Duel.IsExistingTarget(aux.TRUE,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c)
end
function c2261.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c2261.desfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,c2261.desfilter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst())
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,g1:GetCount(),0,0)
end
function c2261.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(g,REASON_EFFECT)
end
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(130000001,0))
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetProperty(EFFECT_FLAG_CHAIN_UNIQUE)
e5:SetHintTiming(0,0x1c0)
e5:SetRange(LOCATION_EXTRA)
e5:SetCondition(c130000001.sprdon)
e5:SetOperation(c130000001.sprdop)
c:RegisterEffect(e5)
function c130000001.sprdon(e,tp,eg,ep,ev,re,r,rp)
if c==nil then return true end
local tp=c:GetControler()
local selfExist = not Duel.IsExistingMatchingCard(c130000001.sprdfilter,tp,LOCATION_ONFIELD,0,1,nil)
--醒めない悪夢からの移植記述1
local selfNotChain = e:GetHandler():GetFlagEffect(130000001)==0
return selfExist and selfNotChain
--醒めない悪夢からの移植記述2(この行でエラー発生)
e:GetHandler():RegisterFlagEffect(130000001,RESET_CHAIN,0,1)
end
function c130000001.sprdfilter(c)
return c:IsCode(130000001) and c:IsFaceup()
end
function c130000001.sprdop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
if Duel.SpecialSummon(e:GetHandler(),SUMMON_TYPE_FUSION,tp,tp,true,false,POS_FACEUP_ATTACK)~=0 then
e:GetHandler():CompleteProcedure()
end
end
end
function c1000.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_REMOVED)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_REMOVE)
e1:SetCondition(c9000.thcon)
e1:SetTarget(c9000.thtg)
e1:SetOperation(c9000.thop)
c:RegisterEffect(e1)
end
function c1000.thfilter(c,e,tp)
return c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp
end
function c1000.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c1000.thfilter,1,nil,e,tp)
end
function c1000.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c1000.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
return x~=0
は「xが真であるならば真を返し、偽であるならば偽を返す」という意味で用いられている可能性が(そのコードを書いた人が常識知らずでなければ)非常に高い。
また、
if x==0 then return false end
は「xが偽であるならば偽を返す。真である場合は以降のコードに進む」という意味合いであろう。
>>384
どっちも書いてる事は同じ(マットの書き方は冗長)
「Aの効果を発動した」かどうかは大体の場合は
① AのCost内でRegisterFlagEffectで自身にフラグを立てる
② GetFlagEffectでAを発動したか判断
という手順
永続罠の効果の発動なんかでも良く見られる書き方だね
if not c99999999.global_check then
c99999999.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SSET)
ge1:SetOperation(c99999999.checkop)
Duel.RegisterEffect(ge1,0)
end
function c99999999.checkop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(Card.IsCode,nil,99999999)
local tc=g:GetFirst()
while tc do
tc:RegisterFlagEffect(99999999,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
tc=g:GetNext()
end
end
function c99999999.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and c:IsCanTurnSet() then
if Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=1 then return end
Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEDOWN,true)
c:SetStatus(STATUS_SET_TURN,true)
Duel.RaiseEvent(c,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(TYPE_TRAP+TYPE_NORMAL)
c:RegisterEffect(e1)
local te=tc:GetActivateEffect()
if te then
local e1=Effect.CreateEffect(c)
e1:SetDescription(te:GetDescription())
e1:SetCategory(te:GetCategory())
e1:SetProperty(te:GetProperty())
e1:SetType(EFFECT_TYPE_QUICK_O+EFFECT_TYPE_ACTIVATE)
e1:SetCode(te:GetCode())
e1:SetRange(LOCATION_SZONE)
if c:GetFlagEffect(99999999)~=0 then
e1:SetCountLimit(1,29762407)
end
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetLabelObject(te)
e1:SetCondition(c99999999.accon)
if te:GetCost() then
e1:SetCost(te:GetCost())
end
e1:SetTarget(c99999999.actg)
e1:SetOperation(c99999999.acop)
c:RegisterEffect(e1)
end
end
end
ADSオリカ作成入門して2週間です。
今、昔のGBC風味の儀式(暗黒騎士ガイアをリリースしてカオス・ソルジャー特殊召喚)
みたいなものを作っているのですが、最後の詰めがうまくいきません。見て頂けないでしょうか?
したいこと:「ブラック・マジシャン」「カオス・ソルジャー」の2体をデッキ・手札・フィールドからリリースしてデッキ・手札から「マジシャン・オブ・ブラックカオス」特殊召喚
今できているところ:デッキ・手札・墓地から「ブラック・マジシャン」「カオス・ソルジャー」2種類のうち2体をリリースすることでデッキ・手札から「マジシャン・オブ・ブラックカオス」特殊召喚
惜しいのですが、これだとブラマジ2体、カオソル2体でもいけてしまうので調整したいです。
functionが鍵になってる、という所までは突き止めたのですがそこからが分かりません。
(一応、海外版の「究極竜の儀式」をモチーフにしてます)
function c76792184.activate(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetRitualMaterial(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c76792184.filter,tp,LOCATION_DECK+LOCATION_HAND,0,1,1,nil,e,tp,mg)
if tg:GetCount()>0 then
local tc=tg:GetFirst()
local mg2=Duel.GetMatchingGroup(c76792184.filter2,tp,LOCATION_DECK+LOCATION_HAND+LOCATION_MZONE,0,nil,tc)
mg:Merge(mg2)
mg:RemoveCard(tc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local mat=mg:FilterSelect(tp,Card.IsCode,2,2,nil,46986414,5405694)
-- and mg:FilterSelect(tp,Card.IsCode,1,1,nil,5405694)
tc:SetMaterial(mat)
local mat1=mat:Filter(Card.IsLocation,nil,LOCATION_DECK+LOCATION_HAND+LOCATION_MZONE)
mat:Sub(mat1)
Duel.ReleaseRitualMaterial(mat)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_RELEASE+REASON_MATERIAL+REASON_RITUAL)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,true,false,POS_FACEUP)
tc:CompleteProcedure()
end
>>451
local mat=mg:FilterSelect(tp,Card.IsCode,2,2,nil,46986414,5405694)
↓
local mat=mg:FilterSelect(tp,Card.IsCode,1,1,nil,46986414)
local mat2=mg:FilterSelect(tp,Card.IsCode,1,1,nil,5405694)
mat:Merge(mat2)
>>479
例えば、あらかじめcXXXXXXXX[0]=0 cXXXXXXXX[1]=0ってしておいて、
フィルターで
cXXXXXXXX.filter(c,tp)
local code=c:GetCode()
for i=1,cXXXXXXXXX[tp] do
if code==cXXXXXXXXX[2*i+tp] then return false end
end
return true
end
選択後は
local n=cXXXXXXXXX[tp]+1
cXXXXXXXX[2*n+tp]=g:GetFirst():GetCode()
cXXXXXXXXX[tp]=n
とかね
たとえば、魔法カードの効果で「捕食植物ダーリング・コブラ」の効果を使用するために
フィルターを↓
function c2156.spfilter(c,e,tp)
return c:IsSetCard(0x10f3) and c:IsCanBeSpecialSummoned(e,4339,tp,false,false)
end
オペレーション箇所を↓
function c2156.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c2156.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,4339,tp,tp,false,false,POS_FACEUP)
end
end
function cカードID.chtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ftg=re:GetTarget()
if chkc then return ftg(e,tp,eg,1-tp,ev,re,r,1-tp,chk,chkc) end
if chk==0 then return not ftg or ftg(e,tp,eg,1-tp,ev,re,r,1-tp,chk) end
e:SetProperty(re:GetProperty())
e:SetCategory(re:GetCategory())
if ftg then
ftg(e,tp,eg,1-tp,ev,re,r,1-tp,chk)
end
end
function cカードID.chop(e,tp,eg,ep,ev,re,r,rp)
local op=re:GetOperation()
if op then op(e,tp,eg,1-tp,ev,re,r,1-tp) end
if e:GetHandler():IsLocation(LOCATION_GRAVE) then
Duel.BreakEffect()
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT)
end
end
因みにバルブの時は「local ftg=re:GetTarget()」、
シルバの時は「if chk==0 then return not ftg or ftg(e,tp,eg,1-tp,ev,re,r,1-tp,chk) end」に問題があると出ました。
スクリプトはこんな感じです↓。
function c1150.atkfilter(c,g)
return c:GetAttack()>=0 and c:IsPosition(POS_FACEUP_DEFENSE)
end
function c1150.atkval(e,c)
local g=Duel.GetMatchingGroup(c1150.atkfilter,c:GetControler(),LOCATION_MZONE,0,c)
return g:GetSum(Card.GetAttack)
end
function c1150.atkfilter(c,g)
return c:GetAttack()>=0 and c:IsPosition(POS_FACEUP_DEFENSE) and g:IsContains(c)
end
function c1150.atkval(e,c)
local lg=c:GetLinkedGroup()
local g=Duel.GetMatchingGroup(c1150.atkfilter,c:GetControler(),LOCATION_MZONE,LOCATION_MZONE,nil,lg)
return g:GetSum(Card.GetAttack)
end
function c001.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,532)
local tc=Duel.GetFirstTarget()
if tc:GetOverlayCount()==0 then return end
tc:RemoveOverlayCard(tp,1,99,REASON_EFFECT)
local ct=Duel.GetOperatedGroup():GetCount()
e:SetLabel(ct)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<0 then return end
local tc=Duel.GetFirstTarget()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local c=e:GetHandler()
local ct=e:GetLabel()
local g=Duel.SelectMatchingCard(tp,c001.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+ct)
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if mg:GetCount()~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(tc))
Duel.Overlay(sc,Group.FromCards(tc))
Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
sc:CompleteProcedure()
end
end
失礼しました。エラーログは出ませんでした。効果の起動を確認するためのスクリプトです。
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_SZONE)
e1:SetCode(EVENT_REMOVE_COUNTER+0x100e)
e1:SetOperation(c37564.winop)
c:RegisterEffect(e1)
function c37564.winop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,37565)
end
「A」細胞培養装置を参考にAカウンター取り除いて試しているのですが何が悪いのでしょうか?
現在スクリプトを作っているものです。今は「レッド・デーモンズ・ドラゴン・タイラント」のスクリプトを作っているのですが[string"./script/c10004.lua]:4:attempt to call field"Tuner"(a nil value)と出てしまいます。ygopro ver.1.34.2では普通に召喚出来るのですがygopro ver1.033.C では召喚出来ませんでした。4行目に欠陥があるのは分かるのですがどうすれば召喚できるのか分かりません。お時間があるときで大丈夫なので知恵を貸していただけると有り難いです。
--レッド・デーモンズ・ドラゴン・タイラント
function c10004.initial_effect(c)
--synchro summon
aux.AddSynchroMixProcedure(c,aux.Tuner(nil),aux.Tuner(nil),nil,aux.NonTuner(nil),1,99)
c:EnableReviveLimit()
--destroy
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetTarget(c10004.destg)
e2:SetOperation(c10004.desop)
c:RegisterEffect(e2)
--negate
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EVENT_CHAINING)
e3:SetCondition(c10004.discon)
e3:SetTarget(c10004.distg)
e3:SetOperation(c10004.disop)
c:RegisterEffect(e3)
--double tuner
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e4:SetCode(21142671)
c:RegisterEffect(e4)
end
function c10004.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c10004.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
if g:GetCount()>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
function c10004.ftarget(e,c)
return e:GetLabel()~=c:GetFieldID()
end
function c10004.discon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsHasType(EFFECT_TYPE_ACTIVATE)
and Duel.IsChainNegatable(ev) and (ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE)
end
function c10004.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c10004.disop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetReset(RESET_EVENT+0x1ff0000)
e1:SetValue(500)
c:RegisterEffect(e1)
end
end
--レッド・ジャイアント
function c10011.initial_effect(c)
--end battle phase
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(10011,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SSET)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c10011.spcon)
e1:SetTarget(c10011.target)
e1:SetOperation(c10011.operation)
c:RegisterEffect(e1)
end
function c10011.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,tp)
end
function c10011.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c10011.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c10011.filter),tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK+POS_FACEUP_DEFENSE)
Duel.ConfirmCards(1-tp,g)
end
local ph=Duel.GetCurrentPhase()
if tp~=Duel.GetTurnPlayer() and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE then
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE,1)
end
end
こうですか?
function c1300.initial_effect(c)
--end battle phase
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(1300,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SSET)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c1300.spcon)
e1:SetTarget(c1300.sptg)
e1:SetOperation(c1300.spop)
c:RegisterEffect(e1)
end
function c1300.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsControler,1,nil,1-tp)
end
function c1300.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c1300.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
local ph=Duel.GetCurrentPhase()
if tp~=Duel.GetTurnPlayer() and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE then
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE,1)
else
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SKIP_BP)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
if Duel.GetTurnPlayer()~=tp and ph>PHASE_MAIN1 and ph<PHASE_MAIN2 then
e1:SetLabel(Duel.GetTurnCount())
e1:SetCondition(c1300.skipcon)
e1:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_OPPO_TURN,2)
else
e1:SetReset(RESET_PHASE+PHASE_BATTLE+RESET_OPPO_TURN,1)
end
Duel.RegisterEffect(e1,tp)
end
end
function c1300.skipcon(e)
return Duel.GetTurnCount()~=e:GetLabel()
end
--ブラック・マジシャン(DM)
function c10020.initial_effect(c)
--Yugioh
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCost(c10020.cost)
e1:SetTarget(c10020.target)
e1:SetOperation(c10020.activate)
e1:SetCountLimit(1,10020)
e1:SetCondition(c10020.condition)
Duel.RegisterEffect(e1,0)
end
function c10020.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function c10020.cfilter(c,tp)
return c:IsType(TYPE_SPELL) and c:IsPreviousLocation(LOCATION_DECK) and c:IsPreviousPosition(POS_FACEUP)
and c:GetPreviousControler()==1-tp and c:GetPreviousSequence()~=5
end
function c10020.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c10020.cfilter,0,nil,tp)
end
function c10020.tgfilter(c)
return c:IsAbleToHand()
end
function c10020.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c10020.tgfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c10020.tgfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=Duel.SelectTarget(tp,c10020.tgfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,sg:GetCount(),0,0)
end
function c10020.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
>>547
発動する効果の場合何処を直せばいいんですかね?
あと[string"./script/c10020.lua"]:24:attempt to index local ’eg’(a nil value)のエラーが出ちゃいました。意味を教えて頂ければ助かります。出来れば解決策も…
SetRangeは見つかりました。ありがとうございます
質問多くてすみません!回答よろしくお願いします!
--Sin トゥルース・ドラゴン
function c3029.initial_effect(c)
c:EnableReviveLimit()
--Cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(3029,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CHAIN_UNIQUE)
e2:SetCode(EVENT_DESTROYED)
e2:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCondition(c3029.spcon)
e1:SetCost(c3029.spcost)
e1:SetTarget(c3029.sptg)
e1:SetOperation(c3029.spop)
c:RegisterEffect(e2)
--self destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_SELF_DESTROY)
e3:SetCondition(c3029.descon2)
c:RegisterEffect(e3)
--Destroy replace
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_DESTROY_REPLACE)
e4:SetTarget(c3029.desreptg)
c:RegisterEffect(e4)
end
function c3029.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
function c3029.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c3029.cfilter,1,nil,tp)
end
function c3029.cfilter(c,tp)
return c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
and c:IsPreviousSetCard(0x23) and c:GetPreviousCodeOnField()~=3029 and not c:IsReason(REASON_RULE)
end
function c3029.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,true) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c3029.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,true,true,POS_FACEUP)~=0 then
c:CompleteProcedure()
elseif Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
and c:IsCanBeSpecialSummoned(e,0,tp,true,true) and c:IsLocation(LOCATION_HAND) then
Duel.SendtoGrave(c,REASON_RULE)
end
end
function c3029.descon2(e)
return not Duel.IsEnvironment(27564031)
end
function c3029.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsReason(REASON_REPLACE)
and Duel.IsExistingMatchingCard(c3029.repfilter,tp,LOCATION_GRAVE,0,1,nil) end
if Duel.SelectYesNo(tp,aux.Stringid(25165047,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c3029.repfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
return true
else return false end
end
>>561
function c3029.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
function c3029.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c3029.cfilter,1,nil,tp)
end
function c3029.cfilter(c,tp)
return c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
and c:IsPreviousSetCard(0x23) and c:GetPreviousCodeOnField()~=3029 and not c:IsReason(REASON_RULE)
end
function c3029.descon2(e)
return not Duel.IsEnvironment(27564031)
end
function c3029.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsReason(REASON_REPLACE)
and Duel.IsExistingMatchingCard(c3029.repfilter,tp,LOCATION_GRAVE,0,1,nil) end
if Duel.SelectYesNo(tp,aux.Stringid(25165047,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c3029.repfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
return true
else return false end
end
function c3029.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,true) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c3029.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.SpecialSummon(c,0,tp,tp,true,true,POS_FACEUP)~=0 then
c:CompleteProcedure()
elseif Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
and c:IsCanBeSpecialSummoned(e,0,tp,true,true) and c:IsLocation(LOCATION_HAND) then
Duel.SendtoGrave(c,REASON_RULE)
end
end
function c3029.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local bc=tc:GetBattleTarget()
return tc:IsRelateToBattle() and tc:IsStatus(STATUS_OPPO_BATTLE) and tc:IsControler(tp) and tc:IsSetCard(0x23)
and bc:IsReason(REASON_BATTLE)
end
function c3029.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,g:GetCount()*800)
end
function c3029.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_MZONE,nil)
local ct=Duel.Destroy(g,REASON_EFFECT)
if ct~=0 then
Duel.BreakEffect()
Duel.Damage(1-tp,ct*800,REASON_EFFECT)
end
end
エラー
[string./script/c3029.lua"]:92:attempt to index local 'eg' (a nil value)
--トリックスター・ハルシネイション
function c10000.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,10000+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c10000.target)
e1:SetOperation(c10000.activate)
c:RegisterEffect(e1)
end
function c10000.filter(c,e,tp)
return c:IsRace(RACE_FAIRY) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c10000.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c10000.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_HAND)
end
function c10000.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c10000.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
local atk=tc:GetAttack()
if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(atk/2)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2,true)
tc:CompleteProcedure()
Duel.SpecialSummonComplete()
end
end
end
function c10000.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
--トリックスター・ハルシネイション
function c10000.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,10000+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c10000.target)
e1:SetOperation(c10000.activate)
c:RegisterEffect(e1)
end
function c10000.filter(c,e,tp)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xfb) and c:IsAbleToHand()
end
function c10000.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c10000.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_HAND)
end
function c10000.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c10000.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
local atk=tc:GetAttack()
if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(atk/2)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE_EFFECT)
e3:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e3,true)
tc:CompleteProcedure()
Duel.SpecialSummonComplete()
end
end
end
--トリックスタールシネイション
function c1001.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,1001+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c1001.target)
e1:SetOperation(c1001.activate)
c:RegisterEffect(e1)
end
--getsu
function c1001.filter(c,e,tp)
return c:IsSetCard(0xfb) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c1001.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c1001.filter,tp,LOCATION_HAND,0,1,nil,e,tp)
and Duel.IsPlayerCanDraw(tp,1) and Duel.IsPlayerCanDraw(1-tp,1) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,1)
end
function c1001.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c1001.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
local atk=tc:GetAttack()
if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(atk/2)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3,true)
Duel.SpecialSummonComplete()
if atk>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
Duel.Draw(1-tp,1,REASON_EFFECT)
end
end
end
end
--森の番人グリーン・バブーン
function c46668237.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(46668237,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_DESTROYED)
e1:SetCondition(c46668237.condition)
e1:SetCost(c46668237.cost)
e1:SetTarget(c46668237.target)
e1:SetOperation(c46668237.operation)
c:RegisterEffect(e1)
end
function c46668237.filter(c,tp)
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsRace(RACE_BEAST) and c:GetPreviousControler()==tp
and c:IsPreviousLocation(LOCATION_MZONE)
end
function c46668237.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c46668237.filter,1,nil,tp)
end
function c46668237.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c46668237.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
function c46668237.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
現在トリックスターギタースイートを弄っているのですが
[Script Error][string"./script/c10004.lua"]:53:`than`expected near`&`
[Script Error]"CallCardFunction"(c10004 initial_effect):attempt to call an error function
[Script Error]"CallCardFunction"(c10004 initial_effect):attempt to call an error function
というエラーが出てしまいます。スクリプトは
>>592
トリックスター・ギタースイート
function c10004.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcMix(c,true,true,c10004.matfilter,aux.FilterBoolFunction(Card.IsFusionSetCard,0xfb))
--aux.FilterBoolFunctionEx(Card.IsSetCard,0xfb)
--avoid damage
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_AVAILABLE_BD)
e1:SetTargetRange(0,1)
e1:SetValue(c10004.damval)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(10004,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_DAMAGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c10004.atkcon)
e2:SetOperation(c10004.atkop)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(10004,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetLabelObject(e2)
e3:SetCondition(c10004.condition)
e3:SetTarget(c10004.target)
e3:SetOperation(c10004.operation)
c:RegisterEffect(e3)
end
c10004.material_setcode={0xfb}
function c10004.matfilter(c,fc,sumtype,tp)
return c:IsType(TYPE_LINK,fc,sumtype,tp) and c:IsFusionSetCard(0xfb)
--c:IsSetCard(0xfb,fc,sumtype,tp)
end
function c10004.ffilter(c,fc,sumtype,tp,sub,mg,sg)
return (not sg or sg:IsExists(c10004.fusfilter,1,nil,fc,sumtype,tp))
end
function c10004.fusfilter(c,fc,sumtype,tp)
return c:IsType(TYPE_LINK,fc,sumtype,tp)
end
>>593
function c10004.matfilter(c,fc,sub,sub2,mg,sg,tp,contact)
return c:IsSetCard(0xfb,fc,SUMMON_TYPE_FUSION,tp)
end
function c10004.damval(e,re,val,r,rp,rc)
if re and r&REASON_EFFECT==REASON_EFFECT and re:GetHandler():IsFaceup()
and re:GetHandler():IsSetCard(0xfb) and re:IsActiveType(TYPE_MONSTER)
and re:GetHandler():GetLinkedGroup():IsContains(e:GetHandler()) then
return val*2
end
return val
end
function c10004.atkcon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and bit.band(r,REASON_EFFECT)~=0 and re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0xfb)
end
function c10004.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetLabelObject(e)
e1:SetValue(ev)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
end
end
function c10004.thfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xfb) and c:IsAbleToHand()
end
function c10004.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetAttackedCount()>0
end
function c10004.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local effs={e:GetHandler():GetCardEffect(EFFECT_UPDATE_ATTACK)}
for _,eff in ipairs(effs) do
if eff:GetLabelObject()==e:GetLabelObject() then
return true
end
end
return false
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE)
end
function c10004.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local chk=false
local effs={c:GetCardEffect(EFFECT_UPDATE_ATTACK)}
for _,eff in ipairs(effs) do
if eff:GetLabelObject()==e:GetLabelObject() then
eff:Reset()
chk=true
end
end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c10004.thfilter),tp,LOCATION_GRAVE,0,nil)
if chk and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(10004,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
end
足りない情報がありましたらできる限りお答えしますのでよろしくお願いします。
[Script Error][string"./script/c10007.lua"]:49:`)`expected near`&`
[Script Error]"CallCardFunction"(c10007 initial_effect):attempt to call an error function
[Script Error]"CallCardFunction"(c10007 initial_effect):attempt to call an error function
[Script Error]"CallCardFunction"(c10007 initial_effect):attempt to call an error function
function c10007.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(c10007.activate)
c:RegisterEffect(e1)
--token
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(10007,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1,10007)
e2:SetTarget(c10007.tktg1)
e2:SetOperation(c10007.tkop1)
c:RegisterEffect(e2)
--token2
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(10007,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_FZONE)
e3:SetCountLimit(1,10007)
e3:SetCondition(c10007.tkcon)
e3:SetTarget(c10007.tktg2)
e3:SetOperation(c10007.tkop2)
c:RegisterEffect(e3)
end
function c10007.thfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xfb) and c:IsAbleToHand()
end
function c10007.activate(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or Duel.GetFlagEffect(tp,10007)>0 then return end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c511600176.thfilter),tp,LOCATION_GRAVE,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(10007,0)) then
Duel.RegisterFlagEffect(tp,10007,RESET_PHASE+PHASE_END,0,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
function c10007.filter(c,e,tp)
return c:IsFaceup() and c:IsType(TYPE_LINK) and c:IsSetCard(0xfb)
and Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,c:GetLinkedZone()&0x1f)>0
end
function c10007.tktg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c10007.filter(chkc,e,tp) and chkc:IsControler(tp) end
if chk==0 then return Duel.IsExistingTarget(c511600176.filter,tp,LOCATION_MZONE,0,1,nil,e,tp)
and Duel.IsPlayerCanSpecialSummonMonster(tp,10007,0xfb,0x4011,0,0,1,RACE_FAIRY,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c10007.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
end
function c10007.tkop1(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
local zones=tc:GetLinkedZone()&0x1f
local token=Duel.CreateToken(tp,10007)
if not tc:IsRelateToEffect(e) or not tc:IsFaceup()
or not token:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,tp,zones) then return end
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE,zones)
end
function c10007.cfilter(c)
return c:IsFacedown() and c:GetSequence()<5
end
function c10007.tkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c10007.cfilter,tp,0,LOCATION_SZONE,1,nil)
end
function c10007.tktg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,10007,0xfb,0x4011,0,0,1,RACE_FAIRY,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
end
function c10007.tkop2(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,10007,0xfb,0x4011,0,0,1,RACE_FAIRY,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE) then return end
local token=Duel.CreateToken(tp,10007)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
毎度毎度すみません。よろしくお願いします。
このエラーが分からず困っています
[Script Error][string"./script/c10007.lua"]:60:attempt to call a nill value(method'IsExtraLinked')
現在作っているスクリプトが
function c10012.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),2)
c:EnableReviveLimit()
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(5821478,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c10012.descon)
e1:SetTarget(c10012.destg)
e1:SetOperation(c10012.desop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(49352945,1))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c10012.descon2)
e2:SetTarget(c10012.destg2)
e2:SetOperation(c10012.desop2)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetCondition(c10012.descon2)
e3:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_LINK))
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c10012.cfilter(c,zone)
local seq=c:GetSequence()
if c:IsControler(1) then seq=seq+16 end
return bit.extract(zone,seq)~=0
end
function c10012.descon(e,tp,eg,ep,ev,re,r,rp)
local zone=Duel.GetLinkedZone(0)+Duel.GetLinkedZone(1)*0x10000
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c10012.cfilter,1,nil,zone)
and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0
end
function c10012.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,LOCATION_HAND,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c10012.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,LOCATION_HAND,nil)
Duel.Destroy(g,REASON_EFFECT)
end
function c10012.descon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsExtraLinked()
end
function c10012.destg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_HAND,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_HAND,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,3000)
end
function c10012.desop2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_HAND,nil)
if Duel.Destroy(g,REASON_EFFECT)~=0 then
Duel.Damage(1-tp,3000,REASON_EFFECT)
end
end
--手札から通常召喚
function c11220.initial_effect(c)
--hand summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c11220.cost)
e1:SetTarget(c11220.target)
e1:SetOperation(c11220.operation)
c:RegisterEffect(e1)
end
function c11220.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SUMMON)==0 end
local e001=Effect.CreateEffect(e:GetHandler())
e001:SetType(EFFECT_TYPE_FIELD)
e001:SetCode(EFFECT_CANNOT_SUMMON)
e001:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e001:SetTargetRange(1,0)
e001:SetTarget(c11220.nslimit)
e001:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e001,tp)
end
function c11220.nslimit(e,c,sump,sumtype,sumpos,targetp,se)
return e:GetHandler()~=se:GetHandler()
end
function c11220.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,e:GetHandler(),1,0,0)
end
function c11220.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.Summon(tp,c,true,nil)
end
end
--手札から通常召喚
function c11220.initial_effect(c)
--hand summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c11220.cost)
e1:SetTarget(c11220.target)
e1:SetOperation(c11220.operation)
c:RegisterEffect(e1)
end
function c11220.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SUMMON)==0 end
local e001=Effect.CreateEffect(e:GetHandler())
e001:SetType(EFFECT_TYPE_FIELD)
e001:SetCode(EFFECT_CANNOT_SUMMON)
e001:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e001:SetTargetRange(1,0)
e001:SetTarget(c11220.nslimit)
e001:SetReset(RESET_PHASE+PHASE_END)
e001:SetLabelObject(e)
Duel.RegisterEffect(e001,tp)
end
function c11220.nslimit(e,c,sump,sumtype,sumpos,targetp,se)
return se~=e:GetLabelObject()
end
function c11220.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,e:GetHandler(),1,0,0)
end
function c11220.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.Summon(tp,c,true,nil)
end
end
local c=e:GetHandler()
return bit.band(c:IsSetCard(0x0173),REASON_EFFECT)==0
こんな感じでしょうか? ただ、これだと以下のようなエラーが出てしまいます……。
どうすれば良いでしょうか。andでそのまま付け足した場合も同様でした。
[string "./script/utility.lua"]:10: attempt to perform bitwise operation on a boolean value (local 'a')
function c2016.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCode2(c,65622692,64500000,true,true)
--spsummon condition
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c2016.splimit)
c:RegisterEffect(e1)
--special summon rule
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(c2016.spcon)
e2:SetOperation(c2016.spop)
c:RegisterEffect(e2)
end
function c2016.splimit(e,se,sp,st)
return not e:GetHandler():IsLocation(LOCATION_EXTRA+LOCATION_GRAVE)
end
function c2016.matfilter(c)
return c:IsFusionCode(65622692,64500000) and c:IsAbleToRemoveAsCost()
end
function c2016.spfilter1(c,tp,g)
return g:IsExists(c2016.spfilter2,1,c,tp,c)
end
function c2016.spfilter2(c,tp,mc)
return (c:IsFusionCode(65622692) and mc:IsFusionCode(64500000)
or c:IsFusionCode(64500000) and mc:IsFusionCode(65622692))
and Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c,mc))>0
end
function c2016.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(c2016.matfilter,tp,LOCATION_ONFIELD,0,nil)
return g:IsExists(c2016.spfilter1,1,nil,tp,g)
end
function c2016.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(c2016.matfilter,tp,LOCATION_ONFIELD,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=g:FilterSelect(tp,c2016.spfilter1,1,1,nil,tp,g)
local mc=g1:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=g:FilterSelect(tp,c2016.spfilter2,1,1,mc,tp,mc)
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
end
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PREDRAW)
ge1:SetOperation(cXXX.sdop)
ge1:SetCountLimit(1,XXX+EFFECT_COUNT_CODE_DUEL)
ge1:SetCondition(cXXX.sdcon)
Duel.RegisterEffect(ge1,0)
end
function cXXX.sdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
if Duel.SelectYesNo(c,aux.Stringid(XXX,0)) then
Duel.SendtoDeck(Duel.CreateToken(0,YYY),tp,tp,REASON_RULE)
end
end
function cXXX.sdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetOwner()==Duel.GetTurnPlayer() and Duel.GetTurnCount()~=1
end
function c27551.initial_effect(c)
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PREDRAW)
ge1:SetOperation(c27551.sdop)
ge1:SetCondition(c27551.sdcon)
Duel.RegisterEffect(ge1,0)
end
function c27551.sdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
if Duel.GetFlagEffect(c,27551)==0 and Duel.SelectYesNo(c,aux.Stringid(27551,0)) then
Duel.SendtoDeck(Duel.CreateToken(0,27551),c,2,REASON_RULE)
end
Duel.RegisterFlagEffect(c,27551,nil,0,1)
end
function c27551.sdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()==1
end
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_BATTLE_DESTROYED)
e4:SetCondition(c220200329.condition)
e4:SetTarget(c220200329.target)
e4:SetOperation(c220200329.activate)
c:RegisterEffect(e4)
function c220200329.cfilter(c,tp)
return c:IsCord(220200347) and c:GetPreviousControler()==tp
end
function c220200329.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c220200329.cfilter,1,nil,tp)
end
function c220200329.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c220200329.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil)
if dg:GetCount()>0 then
if Duel.Destroy(dg,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
end
end
EXからXモンスターをX召喚扱いとして特殊召喚する。その後デッキからモンスターを1枚選びそのモンスターのX素材にできる。
という効果を作りたくて下のスクリプトを作ったのですがX召喚扱いになりません。理由が分からないのですが教えて頂けませんか?
function c10011.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCountFromEx(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c10011.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
local tc=g:GetFirst()
ct=Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
if ct>0 then
local fg=Duel.GetMatchingGroup(c10011.matfilter,tp,LOCATION_DECK,0,nil,e,tp,false,false)
if fg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(10011,3)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,c10011.matfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.Overlay(tc,g)
end
end
end
end
function cyugioh.matfilter(c)
return c:IsLinkType(TYPE_EFFECT) and c:IsLinkAttribute(ATTRIBUTE_FIRE)
end
function cyugioh.filter(c,e,tp)
return c:IsType(TYPE_LINK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp)
end
function cyugioh.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cyugioh.filter(chkc,e,tp) end
if chk==0 then return (Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0)
and Duel.IsExistingTarget(cyugioh.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cyugioh.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function cyugioh.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.SpecialSummonStep(tc,0,tp,1-tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
Duel.SpecialSummonComplete()
end
function cyugioh.damfilter(c,e,tp)
return c:IsFaceup() and c:IsControler(1-tp) and c:IsType(TYPE_LINK) and (not e or c:IsRelateToEffect(e))
end
function cyugioh.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(cyugioh.damfilter,1,nil,nil,tp) end
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,eg,eg:GetCount(),0,0)
end
function cyugioh.operation(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(cyugioh.damfilter,nil,e,tp)
local dam=g:GetSum(Card.GetBaseAttack)
Duel.Damage(1-tp,dam,REASON_EFFECT)
end
function cyugioh.linkfilter(c)
return c:IsCode(yugioh)
end
function cyugioh.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) and c:GetMaterial():IsExists(cyugioh.linkfilter,1,nil)
end
function cyugioh.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function cyugioh.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.Destroy(g,REASON_EFFECT)
end
function cyugioh.bdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLP(tp)>100 end
local lp=Duel.GetLP(tp)
e:SetLabel((lp-100)/1000)
Duel.PayLPCost(tp,lp-100)
end
function cyugioh.bdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,e:GetLabel()) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(e:GetLabel())
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,e:GetLabel())
end
function cyugioh.bdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
local bd=e:GetLabel()
Duel.Draw(tp,bd-1,REASON_RULE)
end
function cyugioh.sdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetOwner()==Duel.GetTurnPlayer() and Duel.GetTurnCount()~=1
end
※以下例文
function cyugioh.bdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
local bd=e:GetLabel()
Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(yugioh,0))
Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(yugioh,1))
Duel.Draw(tp,bd-1,REASON_RULE)
end
function cyugioh.initial_effect(c)
--trickster fraud
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e3:SetCountLimit(1,yugioh+EFFECT_COUNT_CODE_DUEL)
e3:SetCondition(cyugioh.tfcon)
e3:SetTarget(cyugioh.tftg)
e3:SetOperation(cyugioh.tfop)
e3:SetRange(0xff)
c:RegisterEffect(e3)
end
function cyugioh.tfcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function cyugioh.tftg(e,tp,eg,ep,ev,re,r,rp,chk)
local ht=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)
if chk==0 then return (ht<3 and Duel.IsPlayerCanDraw(1-tp,3-ht)) end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,3-ht)
end
function cyugioh.tfop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
local g=Group.CreateGroup()
local ht1=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)
if ht1<3 then
Duel.Draw(1-tp,3-ht1,REASON_RULE)
--Remove
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(0xff)
e1:SetCountLimit(1)
e1:SetTarget(cyugioh.remtg)
e1:SetOperation(cyugioh.remop)
Duel.RegisterEffect(e1,tp)
end
end
function cyugioh.remtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_HAND)
end
function cyugioh.remop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ht2=Duel.GetMatchingGroupCount(Card.IsSetCard,c:GetControler(),LOCATION_GRAVE,0,nil,0xfb)
if ht2==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_HAND,ht2,ht2,nil)
if rg:GetCount()>0 then
Duel.Remove(rg,POS_FACEUP,REASON_RULE)
end
end
function cyugioh.initial_effect(c)
--Storm Access
local e1=Effect.CreateEffect(c)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1,yugioh+EFFECT_COUNT_CODE_DUEL)
e1:SetCondition(cyugioh.sacon)
e1:SetTarget(cyugioh.satg)
e1:SetOperation(cyugioh.saop)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e1:SetRange(0xff)
c:RegisterEffect(e1)
end
function cyugioh.sacon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)<=1000
end
function cyugioh.satg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(tp)
end
function cyugioh.saop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.AnnounceCard(tp,TYPE_LINK)
local token=Duel.CreateToken(tp,tc,nil,nil,nil,nil,nil,nil)
if token then
Duel.SendtoDeck(token,nil,0,REASON_RULE)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
end
end
function cyugioh.initial_effect(c)
--Master Storm Access
local e1=Effect.CreateEffect(c)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCountLimit(1)
e1:SetTarget(cyugioh.msatg)
e1:SetOperation(cyugioh.msaop)
e1:SetRange(0xff)
c:RegisterEffect(e1)
end
function cyugioh.msatg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(tp)
Duel.SetChainLimit(cyugioh.chainlimit)
end
function cyugioh.chainlimit(e,te,rp,tp)
return not e:IsHasType(EFFECT_TYPE_ACTIVATE)
end
function cyugioh.msaop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
cyugioh.announce_filter={RACE_CYBERSE,OPCODE_ISRACE,TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK,OPCODE_ISTYPE,OPCODE_AND}
local tc=Duel.AnnounceCardFilter(tp,table.unpack(cyugioh.announce_filter))
local token=Duel.CreateToken(tp,tc,nil,nil,nil,nil,nil,nil)
if token then
Duel.SendtoDeck(token,nil,0,REASON_RULE)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
end
end
--バレット&カートリッジ
function cYugioh.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTarget(cYugioh.tg)
e1:SetOperation(cYugioh.op)
c:RegisterEffect(e1)
end
function cYugioh.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_DECK,0,4,nil) and Duel.IsPlayerCanDraw(tp,1)
and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=5 end
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,4,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cYugioh.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_DECK,0,4,4,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,4,REASON_EFFECT) end
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
if c:IsRelateToEffect(e) then
Duel.Draw(p,1,REASON_EFFECT)
Duel.BreakEffect()
c:CancelToGrave()
Duel.ShuffleDeck(tp)
Duel.SendtoDeck(c,nil,0,REASON_EFFECT)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_TO_HAND)
e1:SetCondition(cYugioh.descon)
e1:SetTarget(cYugioh.destg)
e1:SetOperation(cYugioh.desop)
e1:SetReset(RESET_EVENT+0x1de0000)
c:RegisterEffect(e1)
end
end
function cYugioh.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DRAW)
end
function cYugioh.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0)
end
function cYugioh.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoGrave(c,REASON_EFFECT)
end
end
イベントコードのEVENT_STARTUPって使えないのでしょうか?下のテキストだとうまく動いてくれるのですが、PREDRAWをSTARTUPにすると動いてくれません。
constantにあるので使えると思うのですが何か条件があるのでしょうか?よろしければ教えてください
function c10022.initial_effect(c)
local e0=Effect.CreateEffect(c)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_PREDRAW)
e0:SetCountLimit(1,10022+EFFECT_COUNT_CODE_DUEL)
e0:SetRange(LOCATION_DECK)
e0:SetOperation(c10022.op)
c:RegisterEffect(e0)
end
function c10022.rfilter(c)
return c:IsCode(10022)
end
function c10022.op(e,tp,eg,ep,ev,re,r,rp,chk)
local dc=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
Duel.ShuffleDeck(tp)
end
①の効果は1ターンに2度までしか使用できない。
①:自分のデッキ・手札・フィールドからチューナー1体とチューナー以外のモンスターを任意の数だけ墓地へ送り、
墓地へ送ったモンスターのレベルの合計と同じレベルを持つSモンスター1体を、エクストラデッキからS召喚扱いで特殊召喚する。
②:このカードが墓地に存在する場合、自分の墓地の「シンクロ・フュージョン」以外のカードを3枚除外して発動できる。
墓地のこのカードを手札に加える。
というカードのスクリプトを作ったのですが、デッキのモンスターのレベル的に特殊召喚できないはずのSモンスターを選択出来て、
その後[Script Error]: [string "./script/c134217715.lua"]:49: attempt to index a nil value とエラーを吐いてしまいます、何処をどうすればいいのか教えてください。
--シンクロ・フュージョン
function c134217715.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCountLimit(2,134217715+EFFECT_COUNT_CODE_OATH)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(c134217715.activate)
c:RegisterEffect(e1)
--salvage
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND)
e2:SetDescription(aux.Stringid(134217715,1))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCost(c134217715.thcost)
e2:SetTarget(c134217715.thtg)
e2:SetOperation(c134217715.thop)
c:RegisterEffect(e2)
end
function c134217715.filter1(c,e,tp)
local lv=c:GetLevel()
return c:IsType(TYPE_SYNCHRO) and lv<13
and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
end
function c134217715.filter2(c,tp,lv)
local rlv=lv-c:GetLevel()
local rg=Duel.GetMatchingGroup(c134217715.filter3,tp,LOCATION_ONFIELD+LOCATION_DECK+LOCATION_HAND,0,c)
return rlv>0 and c:IsType(TYPE_TUNER) and rg:CheckWithSumEqual(Card.GetLevel,rlv,1,63)
end
function c134217715.filter3(c)
return c:GetLevel()>0 and not c:IsType(TYPE_TUNER)
end
function c134217715.activate(e,tp,eg,ep,ev,re,r,rp)
if aux.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_SMATERIAL)
and Duel.IsExistingMatchingCard(c134217715.filter1,tp,LOCATION_EXTRA,0,1,nil,e,tp)
and Duel.SelectYesNo(tp,aux.Stringid(134217715,0)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g1=Duel.SelectMatchingCard(tp,c134217715.filter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
local lv=g1:GetFirst():GetLevel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=Duel.SelectMatchingCard(tp,c134217715.filter2,tp,LOCATION_ONFIELD+LOCATION_DECK+LOCATION_HAND,0,1,1,nil,tp,lv)
local rlv=lv-g2:GetFirst():GetLevel()
local rg=Duel.GetMatchingGroup(c134217715.filter3,tp,LOCATION_ONFIELD+LOCATION_DECK+LOCATION_HAND,0,g2:GetFirst())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g3=rg:SelectWithSumEqual(tp,Card.GetLevel,rlv,1,63)
g2:Merge(g3)
Duel.SendtoGrave(g2,POS_FACEUP,REASON_MATERIAL+REASON_SYNCHRO)
Duel.SpecialSummon(g1,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)
g1:GetFirst():CompleteProcedure()
end
end
function c134217715.thfilter(c)
return c:IsAbleToRemoveAsCost() and not c:IsCode(134217715)
end
function c134217715.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c134217715.thfilter,tp,LOCATION_GRAVE,0,3,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c134217715.thfilter,tp,LOCATION_GRAVE,0,3,3,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c134217715.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c134217715.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,c)
end
end