YGOPRO Forum

Welcome Guest! To enable all features please try to register or login.
Options
Go to last post Go to first unread
Zyrael  
#1 Posted : Sunday, September 10, 2017 3:00:14 PM(UTC)
Zyrael

Rank: Newbie

Joined: 4/29/2015(UTC)
Posts: 26
Philippines

Thanks: 5 times
How do I do this?

"This card can be used to Ritual Summon any Ritual Monster from your hand. You must also Tribute monsters from your hand or field whose total Levels and Ranks exactly equals the Level of the Ritual Monster you Ritual Summon."

I can't get it to work. My guess is that mg=Duel.GetRitualMaterial(tp) skips non-Xyz Monsters.

Need help on this... :(

Edited by user Friday, September 15, 2017 6:26:50 PM(UTC)  | Reason: Inquiry solved

andre060  
#2 Posted : Monday, September 11, 2017 11:21:52 PM(UTC)
andre060

Rank: Advanced Member

Joined: 6/23/2016(UTC)
Posts: 427

Thanks: 53 times
Was thanked: 67 time(s) in 63 post(s)
Originally Posted by: Zyrael Go to Quoted Post
How do I do this?

"This card can be used to Ritual Summon any Ritual Monster from your hand. You must also Tribute monsters from your hand or field whose total Levels and Ranks exactly equals the Level of the Ritual Monster you Ritual Summon."

I can't get it to work. My guess is that mg=Duel.GetRitualMaterial(tp) skips non-Xyz Monsters.

Need help on this... :(

they can still be ritual material trought, so you can get they all, they filter the material in filter and check there.

poi
Tegardee  
#3 Posted : Tuesday, September 12, 2017 1:28:13 AM(UTC)
Tegardee

Rank: Advanced Member

Joined: 11/13/2014(UTC)
Posts: 570

Thanks: 43 times
Was thanked: 67 time(s) in 57 post(s)
You can use the Odd-Eyes Advent as base. You must Tribute Pendulum Monsters.
Zyrael  
#4 Posted : Tuesday, September 12, 2017 9:57:07 AM(UTC)
Zyrael

Rank: Newbie

Joined: 4/29/2015(UTC)
Posts: 26
Philippines

Thanks: 5 times
Originally Posted by: andre060 Go to Quoted Post
Originally Posted by: Zyrael Go to Quoted Post
How do I do this?

"This card can be used to Ritual Summon any Ritual Monster from your hand. You must also Tribute monsters from your hand or field whose total Levels and Ranks exactly equals the Level of the Ritual Monster you Ritual Summon."

I can't get it to work. My guess is that mg=Duel.GetRitualMaterial(tp) skips non-Xyz Monsters.

Need help on this... :(

they can still be ritual material trought, so you can get they all, they filter the material in filter and check there.



How precisely?

Can I get some syntax or logic to use for this suggestion?

Originally Posted by: Tegardee Go to Quoted Post
You can use the Odd-Eyes Advent as base. You must Tribute Pendulum Monsters.


Already did... Nothing from that card is useful for my card's effect that isn't already available in other Ritual Spells.

andre060  
#5 Posted : Tuesday, September 12, 2017 4:53:47 PM(UTC)
andre060

Rank: Advanced Member

Joined: 6/23/2016(UTC)
Posts: 427

Thanks: 53 times
Was thanked: 67 time(s) in 63 post(s)
Originally Posted by: Zyrael Go to Quoted Post
Originally Posted by: andre060 Go to Quoted Post
Originally Posted by: Zyrael Go to Quoted Post
How do I do this?

"This card can be used to Ritual Summon any Ritual Monster from your hand. You must also Tribute monsters from your hand or field whose total Levels and Ranks exactly equals the Level of the Ritual Monster you Ritual Summon."

I can't get it to work. My guess is that mg=Duel.GetRitualMaterial(tp) skips non-Xyz Monsters.

Need help on this... :(

they can still be ritual material trought, so you can get they all, they filter the material in filter and check there.



How precisely?

Can I get some syntax or logic to use for this suggestion?

Originally Posted by: Tegardee Go to Quoted Post
You can use the Odd-Eyes Advent as base. You must Tribute Pendulum Monsters.


Already did... Nothing from that card is useful for my card's effect that isn't already available in other Ritual Spells.


test that (change 2500 to you card id)
Code:

--Zyrael ritual
function c2500.initial_effect(c)
    --Activate
    local e1=Effect.CreateEffect(c)
    e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
    e1:SetType(EFFECT_TYPE_ACTIVATE)
    e1:SetCode(EVENT_FREE_CHAIN)
    e1:SetTarget(c2500.target)
    e1:SetOperation(c2500.operation)
    c:RegisterEffect(e1) 
end
function c2500.rel(c)
    return c:IsReleasable() and c:IsReleasableByEffect()
end
function c2500.mrituallevel(c,rc)
    return c:GetRitualLevel(rc)+c:GetRank()
end
function c2500.filter(c,e,tp,m,ft)
    if not c:IsType(TYPE_RITUAL) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
    local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c)
    if c.mat_filter then
        mg=mg:Filter(c.mat_filter,nil)
    end
    if ft>0 then
        return mg:CheckWithSumEqual(c2500.mrituallevel,c:GetLevel(),1,99,c)
    else
        return mg:IsExists(c2500.mfilterf,1,nil,tp,mg,c)
    end
end
function c2500.mfilterf(c,tp,mg,rc)
    if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) then
        Duel.SetSelectedCard(c)
        return mg:CheckWithSumEqual(c2500.mrituallevel,rc:GetLevel(),1,99,rc)
    else return false end
end
function c2500.target(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then
        local mg=Duel.GetMatchingGroup(c2500.rel,tp,LOCATION_MZONE+LOCATION_HAND,0,nil)
        local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
        return ft>-1 and Duel.IsExistingMatchingCard(c2500.filter,tp,LOCATION_HAND,0,1,nil,e,tp,mg,ft)
    end
    Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c2500.operation(e,tp,eg,ep,ev,re,r,rp)
    local mg=Duel.GetMatchingGroup(c2500.rel,tp,LOCATION_MZONE+LOCATION_HAND,0,nil)
    local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
    local tg=Duel.SelectMatchingCard(tp,c2500.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mg,ft)
    local tc=tg:GetFirst()
    if tc then
        mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
        if tc.mat_filter then
            mg=mg:Filter(tc.mat_filter,nil)
        end
        local mat=nil
        if ft>0 then
            Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
            mat=mg:SelectWithSumEqual(tp,c2500.mrituallevel,tc:GetLevel(),1,99,tc)
        else
            Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
            mat=mg:FilterSelect(tp,c2500.mfilterf,1,1,nil,tp,mg,tc)
            Duel.SetSelectedCard(mat)
            Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
            local mat2=mg:SelectWithSumGreater(tp,c2500.mrituallevel,tc:GetLevel(),tc)
            mat:Merge(mat2)
        end
        tc:SetMaterial(mat)
        Duel.ReleaseRitualMaterial(mat)
        Duel.BreakEffect()
        Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
        tc:CompleteProcedure()
    end
end

ps:
get ritual skip xyz monster because they have no level.

Edited by user Tuesday, September 12, 2017 6:04:23 PM(UTC)  | Reason: Not specified

poi
thanks 1 user thanked andre060 for this useful post.
Zyrael  
#6 Posted : Friday, September 15, 2017 6:24:55 PM(UTC)
Zyrael

Rank: Newbie

Joined: 4/29/2015(UTC)
Posts: 26
Philippines

Thanks: 5 times
Thank you for the code.

It's working perfectly.
I added a bit more conditions to it though to make my card a bit more restricting... :)


Quote:

ps:
get ritual skip xyz monster because they have no level.



I have learned something new... Thank you
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