Skip to content
TheChatArchiveThe Chat Archive
o1-preview-2024-09-12· OpenAIAi2 WildChat-4.8M (AI2)

create a lua script for this monster card in edopro : ""2+ Dragon monsters, including at…

  1. User

    create a lua script for this monster card in edopro : ""2+ Dragon monsters, including at least 1 "Hieratic" Monster When this card is Link Summoned: You can Special Summon 1 "Hieratic" Monster or 1 Normal Dragon Monster from your hand, Deck, or GY in Defense Position, but its effects are negated (if any). Once per turn, when your opponent activates a card or effect (Quick Effect): You can Tribute 1 "Hieratic" monster or 1 Normal Dragon monster from your hand or field; negate the activation, and if you do, banish that card. If this card is destroyed by your opponent's card (by battle or card effect): You can Special Summon 1 "Hieratic" Xyz Monster from your Extra Deck, ignoring its Summoning conditions, and attach this monster as an xyz material" its ID is "99999"

  2. Assistant

    Certainly! Here's a Lua script for your custom card in EDOPro with the card ID 99999. This script implements all three effects you described:

    --Custom Hieratic Link Monster
    local s,id=GetID()
    function s.initial_effect(c)
        --Link Summon
        c:EnableReviveLimit()
        Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON),2,nil,s.lcheck)
    
        --Effect 1: When this card is Link Summoned
        local e1=Effect.CreateEffect(c)
        e1:SetDescription(aux.Stringid(id,0)) -- Description index 0
        e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
        e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
        e1:SetProperty(EFFECT_FLAG_DELAY)
        e1:SetCode(EVENT_SPSUMMON_SUCCESS)
        e1:SetCondition(s.spcon)
        e1:SetTarget(s.sptg)
        e1:SetOperation(s.spop)
        c:RegisterEffect(e1)
    
        --Effect 2: Negate opponent's card or effect activation
        local e2=Effect.CreateEffect(c)
        e2:SetDescription(aux.Stringid(id,1)) -- Description index 1
        e2:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE)
        e2:SetType(EFFECT_TYPE_QUICK_O)
        e2:SetCode(EVENT_CHAINING)
        e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
        e2:SetRange(LOCATION_MZONE)
        e2:SetCountLimit(1)
        e2:SetCondition(s.negcon)
        e2:SetCost(s.negcost)
        e2:SetTarget(s.negtg)
        e2:SetOperation(s.negop)
        c:RegisterEffect(e2)
    
        --Effect 3: Special Summon Hieratic Xyz Monster when destroyed
        local e3=Effect.CreateEffect(c)
        e3:SetDescription(aux.Stringid(id,2)) -- Description index 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(s.spcon2)
        e3:SetTarget(s.sptg2)
        e3:SetOperation(s.spop2)
        c:RegisterEffect(e3)
    end
    
    --Link Summon requirement: 2+ Dragon monsters including at least 1 "Hieratic" monster
    function s.lcheck(g,lc,sumtype,tp)
        return g:IsExists(Card.IsSetCard,1,nil,0x69) -- 0x69 is the set code for "Hieratic" cards
    end
    
    --Effect 1: Special Summon Hieratic or Normal Dragon monster
    function s.spcon(e,tp,eg,ep,ev,re,r,rp)
        return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
    end
    function s.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 s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then
            return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 
                and Duel.IsExistingMatchingCard(s.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
    function s.spop(e,tp,eg,ep,ev,re,r,rp)
        if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
        local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,nil,e,tp)
        if #g>0 then
            Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
            local sg=g:Select(tp,1,1,nil)
            if Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then
                local tc=sg:GetFirst()
                --Negate its effects
                local e1=Effect.CreateEffect(e:GetHandler())
                e1:SetType(EFFECT_TYPE_SINGLE)
                e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
                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:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
                e2:SetCode(EFFECT_DISABLE_EFFECT)
                e2:SetValue(RESET_TURN_SET)
                e2:SetReset(RESET_EVENT+RESETS_STANDARD)
                tc:RegisterEffect(e2)
            end
        end
    end
    
    --Effect 2: Negate activation and banish
    function s.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
    function s.costfilter(c)
        return (c:IsSetCard(0x69) or (c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL))) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup())
    end
    function s.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then 
            return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil)
        end
        Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
        local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
        local tc=g:GetFirst()
        if tc:IsLocation(LOCATION_HAND) then
            Duel.SendtoGrave(tc,REASON_COST+REASON_RELEASE)
        else
            Duel.Release(tc,REASON_COST)
        end
    end
    function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then return true end
        Duel.SetChainLimit(aux.FALSE)
        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
    function s.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: Special Summon Hieratic Xyz Monster
    function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
        local c=e:GetHandler()
        return c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp) and c:GetReasonPlayer()==1-tp
            and (r&REASON_EFFECT+REASON_BATTLE)~=0
    end
    function s.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 s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
        if chk==0 then
            return Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_XYZ)>0 
                and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp)
        end
        Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
    end
    function s.spop2(e,tp,eg,ep,ev,re,r,rp)
        if Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_XYZ)<=0 then return end
        local c=e:GetHandler()
        Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
        local g=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
        local sc=g:GetFirst()
        if sc then
            --Allow summoning ignoring conditions
            local e1=Effect.CreateEffect(c)
            e1:SetType(EFFECT_TYPE_SINGLE)
            e1:SetCode(EFFECT_SPSUMMON_CONDITION)
            e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
            e1:SetValue(aux.FALSE)
            e1:SetReset(RESET_EVENT+RESETS_STANDARD)
            sc:RegisterEffect(e1)
            if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)~=0 then
                --Attach this card as material
                Duel.Overlay(sc,Group.FromCards(c))
                sc:CompleteProcedure()
            end
        end
    end
    

    Explanation:

    • Link Summon Requirement: The Link.AddProcedure function ensures that the Link Summon requires 2 or more Dragon monsters, including at least one "Hieratic" monster (s.lcheck function checks for "Hieratic" monsters).

    • 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 Graveyard, in Defense Position with its effects negated. This is handled by e1 with s.spcon, s.sptg, and s.spop functions.

    • Effect 2: Once per turn, when your opponent activates a card or effect, you can Tribute a "Hieratic" monster or Normal Dragon monster from your hand or field to negate the activation and banish that card. This is implemented by e2 with s.negcon, s.negcost, s.negtg, and s.negop.

    • Effect 3: If this card is destroyed by your opponent, 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 handled by e3 with s.spcon2, s.sptg2, and s.spop2.

    Remember to replace the placeholder descriptions (aux.Stringid(id,0), etc.) with the actual descriptions in your card's string file if necessary.

    Note: This script assumes that the set code for "Hieratic" cards is 0x69. If it's different, you'll need to update the set code accordingly.

    Please save this script in your EDOPro script folder as c99999.lua to match the card ID.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.