YGOPRO Forum

Welcome Guest! To enable all features please try to register or login.
Options
Go to last post Go to first unread
DM999  
#1 Posted : Monday, August 10, 2020 6:34:56 PM(UTC)
DM999

Rank: Newbie

Joined: 12/1/2015(UTC)
Posts: 26

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
I wanted to activate a custom destruction effect for a monster by returning a pendulum monster from my extra deck to my main deck as a cost, but it won't activate. What is wrong in the script? This is what it currently looks like:

Edited by user Monday, August 10, 2020 6:41:15 PM(UTC)  | Reason: Not specified

BananaPhone42  
#2 Posted : Friday, August 14, 2020 12:49:17 PM(UTC)
BananaPhone42

Rank: Advanced Member

Joined: 1/16/2018(UTC)
Posts: 190

Thanks: 13 times
Was thanked: 10 time(s) in 10 post(s)
Originally Posted by: DM999 Go to Quoted Post
I wanted to activate a custom destruction effect for a monster by returning a pendulum monster from my extra deck to my main deck as a cost, but it won't activate. What is wrong in the script? This is what it currently looks like:


Hoo, boy, this took me quite some time to make. Hope it's what you're looking for.
Code:
    local s,id=GetID()
    function s.initial_effect(c)
    --destroy
    local e1=Effect.CreateEffect(c)
    e1:SetCategory(CATEGORY_DESTROY)
    e1:SetType(EFFECT_TYPE_IGNITION)
    e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
    e1:SetRange(LOCATION_MZONE)
    e1:SetCost(s.descost)
    e1:SetTarget(s.destg)
    e1:SetOperation(s.desop)
    c:RegisterEffect(e1)
end
function s.cfilter(c)
    return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsAbleToDeckAsCost()
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_EXTRA,0,1,nil) end
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTODECK)
    local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_EXTRA,0,1,1,nil)
    Duel.SendtoDeck(g,nil,1,REASON_EFFECT)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
    if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end
    if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
    local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
    Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
    local tc=Duel.GetFirstTarget()
    if tc:IsRelateToEffect(e) then
        Duel.Destroy(tc,REASON_EFFECT)
    end
end
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error