MVPIII
  • MVPIII
  • Advanced Member Topic Starter
2019-06-03T02:09:35Z
Looking for help with a specific part of an effect. Full effect in spoiler, problem text is highlighted.



Code in the spoiler, relevant code is highlighted (just focusing on the first of the three. If we can figure that out, then the rest should be easy)



Right now, after you successfully negate any mix of conditions twice (so 1 negated summon and 1 negated effect, or 2 negated attacks), it lets you draw a card after every coin flip (of any condition), regardless of whether or not it successfully negates. It should only let you draw once per condition (so 3 max in a turn), and only immediately after the second negation of that condition.

Any help is appreciated, thanks!

Edit: Well I guess I can't highlight in code blocks. The effect is e6, and the functions are drop, discon and disop.
Utso
2019-06-04T07:14:23Z
Try this:
function c60001831.discon(e,tp,eg,ep,ev,re,r,rp)
    return rp~=tp and Duel.IsChainDisablable(ev)
end
function c60001831.disop(e,tp,eg,ep,ev,re,r,rp)
    local c=e:GetHandler()
    local c1,c2=Duel.TossCoin(tp,2)
    if c1+c2==1 or c1+c2==2 then
        if Duel.NegateEffect(ev) then
            c:RegisterFlagEffect(60001831,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)  
            if c:GetFlagEffect(60001831)==2 then
                c60001831.drop(e,tp,eg,ep,ev,re,r,rp)
            end
        end
    end
end
This way, the following should happen whenever you successfully negate (and only then):
  1. Increase the count of flag 60001831 by 1.
  2. If the count of flag 60001831 is exactly 2, draw.

If the negation fails, you don't get a flag or a chance to draw. If you've negated more than twice, the condition for the draw won't apply.
To get rid of draws from mixed conditions, use a different flag ID for each effect (e.g. 60001831, 61001831, 62001831). Just make sure they don't conflict with any IDs elsewhere.

Disclaimer: I haven't tested any of this, hope it works anyway [:tongue:]
MVPIII
  • MVPIII
  • Advanced Member Topic Starter
2019-06-05T04:57:21Z
Thank you so much! How you had it works. [:clap:]
I did as you said for the rest of the effects. The summon one was a little tricky, but I got it to work.

Code for those interested.


Users browsing this topic