WarheadXX
2017-03-18T14:02:43Z
I'm trying to create my own version of Link Summoning where it doesn't completely destroy all the other summoning techniques that came before it. I pretty much got everything down, the only thing that I need help with is programming the Link destinations. I understand the sequencing of how a zone relates to the card, I just don't know how to use them so that way they work.

local tc=Duel.GetFieldCard(1-tp,LOCATION_MZONE,4-e:GetHandler():GetSequence()) UP MIDDLE LINK
local tc=Duel.GetFieldCard(1-tp,LOCATION_MZONE,3-e:GetHandler():GetSequence()) UP RIGHT LINK
local tc=Duel.GetFieldCard(1-tp,LOCATION_MZONE,5-e:GetHandler():GetSequence()) UP LEFT LINK
local tc=Duel.GetFieldCard(tp,LOCATION_SZONE,3-e:GetHandler():GetSequence()) DOWN LEFT LINK
local tc=Duel.GetFieldCard(tp,LOCATION_SZONE,5-e:GetHandler():GetSequence()) DOWN RIGHT LINK
local tc=Duel.GetFieldCard(tp,LOCATION_SZONE,4-e:GetHandler():GetSequence()) DOWN MIDDLE LINK
local tc=Duel.GetFieldCard(tp,LOCATION_MZONE,5-e:GetHandler():GetSequence()) RIGHT LINK
local tc=Duel.GetFieldCard(tp,LOCATION_MZONE,3-e:GetHandler():GetSequence()) LEFT LINK

I figured out that this is probably the way to get a link zone from the location of the card, but I could be wrong, I basically took it off of an Anime card and how it relates to adjacent card placing. I did some testing and it worked with the whole "destroy this card from this location". But that brings me to my problem.

As you may know Honeybot, a new card, has the effect where it protects monsters located in the right and left of the card's placing. So in essence it would be:

local tc=Duel.GetFieldCard(tp,LOCATION_MZONE,5-e:GetHandler():GetSequence()) RIGHT LINK
local tc=Duel.GetFieldCard(tp,LOCATION_MZONE,3-e:GetHandler():GetSequence()) LEFT LINK

But when I put that as a target location for an effect that would protect monsters from being destroyed by battle it won't register for some reason. I was using the Melodious Lock centerpiece card, which name escapes me right now as the main script to trying to get this to work.

--indestructable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(c32129317.target)
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
c:RegisterEffect(e2)
end

function c32129317.target(e,c,tp)
return Duel.GetFieldCard(tp,LOCATION_MZONE,5-e:GetHandler():GetSequence()) or Duel.GetFieldCard(tp,LOCATION_MZONE,3-e:GetHandler():GetSequence())
end

[:wall:] [:wall:] [:wall:] So if somebody could help with this, it would be immensely appreciated.
Freddx
2017-03-22T14:47:12Z
Try with:


function c32129317.target(e,c,tp)
        return Duel.GetFieldCard(tp,LOCATION_MZONE,e:GetHandler():GetSequence()+1) 
        or Duel.GetFieldCard(tp,LOCATION_MZONE,e:GetHandler():GetSequence()-1)
end
WarheadXX
2017-03-23T11:56:11Z
It's funny you posted this, I figured out Honeybot and Decode Talker with the exact same code basically. I just recently had a lot of trouble with Firewall Dragon, whose code I think is unscriptable as of right now - due to the fact that the game can't recognize a previous location to where a card was when it was destroyed in relation to another card (2nd effect), i.e the above script or c:GetPreviousSequence(). I also find it impossible to collect the number of cards that are within Firewall Dragons sequence (link) perimeter, so I had to errata it to this effect to get it to work in someway:

"During either player's turn, if you have a monster in a Mutual Link to this card: You can target monsters on the field and/or in the Graveyards, up to the number of other Link Monsters on the field (max.3), return them to the hand. This effect can only be used once while this card is face-up on the field. While a card(s) is linked to this card; if a monster you control is destroyed by battle or sent to the Graveyard: You can Special Summon 1 monster from your hand.
(War's Errata)"

Which for better of for worse is basically what Firewall Dragon does anyways, but if you or somebody can find a way to make it like his original effect - i.e. read the number of mutually linked cards to trigger his first effect or find the previous sequenced link in a condition to trigger his second that would be amazing. So far I have this and it works perfect for the errata'd effect:

-- Bounce to Hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(39188539,1))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET+EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c51387292.thcon)
e1:SetTarget(c51387292.thtg)
e1:SetOperation(c51387292.thop)
c:RegisterEffect(e1)
--Special Summon from hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(51387292,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DESTROYED)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c51387292.spcon)
e2:SetTarget(c51387292.sptg)
e2:SetOperation(c51387292.spop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c51387292.spcon2)
c:RegisterEffect(e3)
end

function c51387292.ctfilter(c,e)
return c:IsCode(51387292) or c:IsCode(32129317) or c:IsCode(52894680)
end
function c51387292.ctfilter2(c,e)
return c:IsType(TYPE_MONSTER)
end
function c51387292.cfilter(c,seq)
return c:IsFaceup() and (c:IsCode(32129317) or c:IsCode(51387292))and c:GetSequence()==seq
end
function c51387292.cfilter2(c,seq)
return c:IsCode(52894680) and c:GetSequence()==seq
end
function c51387292.thcon(e)
local p=1-e:GetHandlerPlayer()
return (Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_MZONE,0,1,nil,e:GetHandler():GetSequence()+1) or Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_MZONE,0,1,nil,e:GetHandler():GetSequence()-1)
or Duel.IsExistingMatchingCard(c51387292.cfilter2,p,LOCATION_MZONE,0,1,nil,4-e:GetHandler():GetSequence()))
end
function c51387292.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE+LOCATION_GRAVE,1,nil) end
local ct=Duel.GetMatchingGroupCount(c51387292.ctfilter,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
if ct>3 then
local g=Duel.SelectTarget(tp,c51387292.ctfilter2,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE+LOCATION_GRAVE,1,3,nil) end
if ct<4 then
local g=Duel.SelectTarget(tp,c51387292.ctfilter2,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE+LOCATION_GRAVE,1,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
end
function c51387292.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
end
function c51387292.filter(c,tp)
return c:IsReason(REASON_BATTLE) and c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp
end
function c51387292.filter2(c,tp)
return c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp
end
function c51387292.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c51387292.filter,1,nil,tp) and (Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_MZONE,0,1,nil,e:GetHandler():GetSequence()+1) or Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_MZONE,0,1,nil,e:GetHandler():GetSequence()-1)
or Duel.IsExistingMatchingCard(c51387292.cfilter2,p,0,LOCATION_MZONE,1,nil,4-e:GetHandler():GetSequence()) or Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_SZONE,0,1,nil,e:GetHandler():GetSequence()))
end
function c51387292.spcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c51387292.filter2,1,nil,tp) and (Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_MZONE,0,1,nil,e:GetHandler():GetSequence()+1) or Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_MZONE,0,1,nil,e:GetHandler():GetSequence()-1)
or Duel.IsExistingMatchingCard(c51387292.cfilter2,p,0,LOCATION_MZONE,1,nil,4-e:GetHandler():GetSequence()) or Duel.IsExistingMatchingCard(c51387292.cfilter,tp,LOCATION_SZONE,0,1,nil,e:GetHandler():GetSequence()))
end
function c51387292.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c51387292.spfil,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c51387292.spfil(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c51387292.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c51387292.spfil,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end

c:IsCode(32129317) = Honeybot
c:IsCode(52894680) = Decode Talker

If there are any ways to improve this to be more like the original effect I would like to know, otherwise I'm going to get started on "Link Spider", "Gaia the Video Knight" and "Missus Radiant", then work on some cool fan-made link monsters if I can. Lmao I'm going to have to change a lot of them now that I think about it.

Anyways thank you for helping!



Users browsing this topic