To create a Lua script for your custom card in EDOPro, you need to define the effects and link summoning conditions as per your card's description. Here's a complete Lua script that accomplishes this:
--Custom Card Script
--Card Name: (Your Card Name)
--Card ID: 99999
function c99999.initial_effect(c)
--Enable Link Summon
c:EnableReviveLimit()
--Custom Link Procedure: 2+ Dragon monsters, including at least 1 "Hieratic" Monster
aux.AddLinkProcedure(c,c99999.matfilter,2,99,c99999.lcheck)
--Effect 1: Special Summon when Link Summoned
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(99999,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(c99999.spcon)
e1:SetTarget(c99999.sptg)
e1:SetOperation(c99999.spop)
c:RegisterEffect(e1)
--Effect 2: Negate opponent's card or effect activation
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(99999,1))
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c99999.negcon)
e2:SetCost(c99999.negcost)
e2:SetTarget(c99999.negtg)
e2:SetOperation(c99999.negop)
c:RegisterEffect(e2)
--Effect 3: Special Summon "Hieratic" Xyz Monster when destroyed
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(99999,2))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(c99999.spcon2)
e3:SetTarget(c99999.sptg2)
e3:SetOperation(c99999.spop2)
c:RegisterEffect(e3)
end
--Link Material Filter: Dragon monsters
function c99999.matfilter(c)
return c:IsRace(RACE_DRAGON)
end
--Link Material Group Check: At least 1 "Hieratic" monster
function c99999.lcheck(g,lc)
return g:IsExists(Card.IsSetCard,1,nil,0x69)
end
--Effect 1 Condition: When Link Summoned
function c99999.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
--Effect 1 Target: Special Summon target from hand, Deck, or GY
function c99999.spfilter(c,e,tp)
return (c:IsSetCard(0x69) or (c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL)))
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c99999.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c99999.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
--Effect 1 Operation: Special Summon the selected monster and negate its effects
function c99999.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c99999.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then
local tc=g:GetFirst()
--Negate effects
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
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)
end
end
end
--Effect 2 Condition: When opponent activates a card or effect
function c99999.negcon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and re:IsActiveType(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP) and Duel.IsChainNegatable(ev)
end
--Effect 2 Cost: Tribute 1 "Hieratic" monster or 1 Normal Dragon monster from hand or field
function c99999.costfilter(c)
return (c:IsSetCard(0x69) or (c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL))) and c:IsReleasable()
end
function c99999.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c99999.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,c99999.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
Duel.Release(g,REASON_COST)
end
--Effect 2 Target
function c99999.negtg(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():IsRelateToEffect(re) and re:GetHandler():IsAbleToRemove() then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
--Effect 2 Operation: Negate activation and banish the card
function c99999.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
end
end
--Effect 3 Condition: Destroyed by opponent's card
function c99999.spcon2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp) and c:GetPreviousLocation()==LOCATION_MZONE
and ((rp==1-tp and c:IsReason(REASON_EFFECT)) or (c:IsReason(REASON_BATTLE) and c:GetReasonPlayer()==1-tp))
end
--Effect 3 Target: Special Summon "Hieratic" Xyz Monster from Extra Deck
function c99999.spfilter2(c,e,tp)
return c:IsSetCard(0x69) and c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
end
function c99999.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCountFromEx(tp)>0
and Duel.IsExistingMatchingCard(c99999.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
--Effect 3 Operation: Special Summon and attach this card as material
function c99999.spop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCountFromEx(tp)<=0 then return end
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,c99999.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
if tc then
tc:SetMaterial(nil)
Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
if c:IsRelateToEffect(e) and c:IsCanOverlay() then
Duel.Overlay(tc,Group.FromCards(c))
end
tc:CompleteProcedure()
end
end
Explanation:
- Link Summoning Condition: The card requires 2 or more Dragon-type monsters as link materials, including at least one "Hieratic" monster. This is enforced by
matfilter and lcheck functions.
- Effect 1: When this card is Link Summoned, it allows you to Special Summon a "Hieratic" monster or a Normal Dragon monster from your hand, Deck, or GY in Defense Position with its effects negated. This is handled by
spcon, sptg, and spop functions.
- Effect 2: Once per turn, as a Quick Effect, when your opponent activates a card or effect, you can Tribute a "Hieratic" monster or a Normal Dragon monster from your hand or field to negate the activation and banish that card. This is implemented through
negcon, negcost, negtg, and negop functions.
- Effect 3: If this card is destroyed by your opponent's card (by battle or card effect), you can Special Summon a "Hieratic" Xyz Monster from your Extra Deck, ignoring its Summoning conditions, and attach this card as Xyz Material. This is managed by
spcon2, sptg2, and spop2 functions.
Usage:
- Save this script as
c99999.lua in your EDOPro's script folder.
- Ensure that you have defined your card in the card database (
cards.cdb) with the ID 99999 and the correct attributes, including the Link Arrows and other properties.
- The
aux.Stringid(99999,0) functions are placeholders for effect descriptions. You can define these strings in your card database or adjust them as needed.
This script should work within EDOPro and provide the custom functionality you've described for your card.