Jump to content

New to coding and can't quite get things to work...


NobodySovereign

Recommended Posts

I need help getting these stupid things to work... I thought I could get this done just by watching all the tutorial videos, but I've hit dead end after dead end, so I'm just going to put these here and hope someone can tell me what I'm doing wrong.

 

 

[spoiler= Ryusei Arariel]

 

Intended Effect: When this card is Normal Summoned: Excavate the top 5 cards of your Deck, then you can Special Summon 1 excavated "Ryusei" monster, also shuffle the rest back into your Deck. Once per turn: You can draw a card, and if you do, this card cannot attack during your Battle Phase this turn.

 

Lua Code:

 

Ryusei Arariel

function c77766601.initial_effect©
--When Summoned, Excavate 5 Cards and Special Summon a Ryusei
local e1=Effect.CreateEffect©
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(c77766601.operation)
c:RegisterEffect(e1)
end
function c62161698.filter(c,e,tp)
return c:IsSetCard(0x2CD) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c77766601.operation(e,c)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 then return end
Duel.ConfirmDecktop(tp,5)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local g=Duel.GetDecktopGroup(tp,5):Filter(c77766601.filter,nil,e,tp)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(77766601,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
Duel.ShuffleDeck(tp)
end
 
==
 
I gave up on this one before I got to its second effect. I tried to take the effect from "Illusion Balloons" and tweak it to work properly, but nothing I've done has gotten it to work.
 

 
[spoiler=Ryusei Ferrum]
 
Intended Effect: You can discard this card: Add 1 "Ryusei" Spell/Trap Card from your Deck to your Hand. You can only use this effect of "Ryusei Ferrum" once per turn. While this Special Summoned card is face-up on the field: "Ryusei" monsters you control cannot be destroyed by battle.
 
Lua Code:
 
Ryusei Ferrum
function c77766603.initial_effect©
--battle indestructable
local e1=Effect.CreateEffect©
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x2CD))
e1:SetCondition(c77766603.tgcon)
e1:SetValue(aux.tgval)
c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect©
e2:SetDescription(aux.Stringid(77766603,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCountLimit(1,77766603)
e2:SetCost(c77766603.thcost)
e2:SetTarget(c77766603.thtg)
e2:SetOperation(c77766603.thop)
c:RegisterEffect(e2)
end
function c77766603.tgcon(e)
return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL
end
function c77766603.thfilter©
return c:IsSetCard(0x2CD) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function c77766603.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsDiscardable() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function c77766603.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c77766603.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c77766603.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c77766603.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
 
==
 
I quite literally took the two effects I needed (Melodious Aria for the indestructibility and Nekroz of Clausolus for the Spell/Trap pull) and pasted them in, renaming the numbers and sets to what they should be. I have no idea why they aren't working.
 

 
[spoiler=Ryusei Roar]
 
Intended Effect: Archetype Specific version of "Void Seer"
 
Lua Code:
 
Ryusei Roar
function c77766614.initial_effect©
--Activate
local e1=Effect.CreateEffect©
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c77766614.target)
e1:SetOperation(c77766614.activate)
c:RegisterEffect(e1)
--destroy replace
local e2=Effect.CreateEffect©
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetRange(LOCATION_GRAVE)
e2:SetTarget(c77766614.reptg)
e2:SetValue(c77766614.repval)
c:RegisterEffect(e2)
end
function c77766614.filter©
return c:IsFaceup() and c:IsSetCard(0x2CD)
end
function c77766614.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c77766614.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c77766614.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c77766614.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c77766614.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then
local e1=Effect.CreateEffect©
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(c77766614.efilter)
e1:SetOwnerPlayer(tp)
tc:RegisterEffect(e1)
end
end
function c77766614.efilter(e,re)
return e:GetOwnerPlayer()~=re:GetOwnerPlayer()
end
function c77766614.repfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
and c:IsSetCard(0x2CD) and c:IsReason(REASON_EFFECT)
end
function c77766614.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(c77766614.repfilter,1,nil,tp) end
if Duel.SelectYesNo(tp,aux.Stringid(77766614,0)) then
local g=eg:Filter(c77766614.repfilter,nil,tp)
if g:GetCount()==1 then
e:SetLabelObject(g:GetFirst())
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE)
local cg=g:Select(tp,1,1,nil)
e:SetLabelObject(cg:GetFirst())
end
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT)
return true
else return false end
end
function c77766614.repval(e,c)
return c==e:GetLabelObject()
end
 
==
 
AGAIN, a simple copy-pasta job and it won't work. Is it something I'm doing wrong...? I've got the right software (at least I should, it's what the threads told me to get!) and nothing nothing NOTHING.
 

 
I am so super desperate that I stayed up 7 hours past when I initially planned on going to bed trying to figure out what I was doing wrong and I'm STILL nowhere closer to my goal. So any help at all would be dearly appreciate.
Link to comment
Share on other sites

As for the first card use Sylvans as reference since they do some crazy sh't with excavation, i think Shroom is the name of the one who will do the trick. As for the draw effect use "Worm Zero"s third effect. And then just slap the "cannot attack thing".

 

For second card use "Thunder Dragon" + "Madolche Messengelato" just be sure to use the right parts. And you have to change the archetype code to your own instead of Madolches one, since you dont want to add Madolche cards, you want yours right?

 

And for Void Seer version be sure to use your own Arch codes, like for the first ones. Dunno which you picked. But thats the key when you do the arch of your own.

 

Keep up my brother and dont give up.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...