wuggy007
2015-03-02T17:30:55Z
[img]null[/img][img]null[/img]spell card i know this is totally unbalanced but I'm trying to learn to script...I've created the Ultimate God Summon card :Description:This card requires "Obelisk the Tormentor", "Slifer the Sky Dragon" and "The Winged Dragon of Ra" to be in your Deck and cannot be destroyed by trap or spell. Now I want it to Special summon those cards from my deck and protect them for one turn.Now I need help scripting it..This is what I've got


--Ultimate God Summon
function c1000000000.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1.SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE+TIMING_EQUIP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c1000000000.target)
e1:SetOperation(c1000000000.activate)
c:RegisterEffect(e1)
end

function c1000000000.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c1000000000.filter(c,e,tp)
return c:GetCode()==10000000 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) or c:GetCode()==10000010 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) or c:GetCode()==10000020 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end

function c1000000000.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,c1000000000.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
else
local cg=Duel.GetFieldGroup(tp,LOCATION_DECK,0)
Duel.ConfirmCards(1-tp,cg)
Duel.ShuffleDeck(tp)
end
end