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