>>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