PapaPhueph
2016-08-02T08:03:47Z
Ok. So I am trying to create a Blue-Eyes Zombie Dragon for the fun of it. I found a cool card online and decided to see if i could add it to the game. However, I'm running into some issues with the coding... The card's effects are:

"You can Special Summon this card in face-up Attack Position by Tributing 2 Zombie-Type monsters. When this card destroys a Zombie-Type monster by battle and sends it to the Graveyard: You can Special Summon that monster to your side of the field. This card gains 300 ATK for each Zombie-Type monster in your Graveyard. Once per turn, you can discard 1 card to target 1 monster in the Graveyard(s); Special Summon that target.

Due to my lack of experience with coding, i thought i could just use the coding of cards with similar effects that i needed and then edit it to fit the card. So far only one effect works lol [:wall:]. The only effects that work are the summoning a zombie monster after it is destroyed by battle and the summoning cost but it is a normal summon and not a special summon. This is what i have so far for my coding:

function c66933045.initial_effect(c)
--summon with 2 tributes
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66933045,1))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c66933045.otcon)
e1:SetOperation(c66933045.otop)
e1:SetValue(SUMMON_TYPE_ADVANCE)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66933045,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetCode(EVENT_BATTLE_DESTROYING)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCondition(c66933045.spcon)
e2:SetTarget(c66933045.sptg)
e2:SetOperation(c66933045.spop)
c:RegisterEffect(e2)
end
function c66933045.otfilter(c,tp)
return c:IsRace(RACE_ZOMBIE) and (c:IsControler(tp) or c:IsFaceup())
end
function c66933045.otcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(c66933045.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
return c:GetLevel()>6 and Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.GetTributeCount(c,mg)>0
end
function c66933045.otop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(c66933045.otfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp)
local sg=Duel.SelectTribute(tp,c,1,1,mg)
c:SetMaterial(sg)
Duel.Release(sg, REASON_SUMMON+REASON_MATERIAL)
end
function c66933045.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetAttacker()
if c==tc then tc=Duel.GetAttackTarget() end
e:SetLabelObject(tc)
if not c:IsRelateToBattle() or c:IsFacedown() then return false end
return tc:GetLocation()==LOCATION_GRAVE and tc:IsRace(RACE_ZOMBIE)
end
function c66933045.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=e:GetLabelObject()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) end
tc:CreateEffectRelation(e)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tc,1,0,LOCATION_GRAVE)
end
function c66933045.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:IsRelateToEffect(e) and tc:IsRace(RACE_ZOMBIE) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
function c66933045.val(e,c)
return Duel.GetMatchingGroupCount(Card.IsRace,c:GetControler(),LOCATION_GRAVE,0,nil,RACE_ZOMBIE)*300
end
function c66933045.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c66933045.filter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c66933045.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c66933045.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c66933045.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c66933045.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
end

If it helps, the card effect codes i used were from these cards: Red-Eyes Zombie Dragon: summoning effects, Red-Eyes Darkness Dragon: Attack Boost, Fossil Excavation: for the discard and special summon effect. If anyone could help sort this mess out it would be much appreciated! I am also curious about pendulum effect coding but that is for a later date when i get a better grasp on how to code in general.
maulana0711
2016-08-04T03:22:38Z
For summon procedure
--summon with 2 tributes
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66933045,1))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c66933045.otcon)
e1:SetOperation(c66933045.otop)
e1:SetValue(SUMMON_TYPE_ADVANCE)
c:RegisterEffect(e1)

change to

--summon with 2 tributes
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66933045,1))
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetCondition(c66933045.otcon)
e1:SetOperation(c66933045.otop)
c:RegisterEffect(e1)

This is for another effect [:lol:]
--atkup
	local e3=Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_SINGLE)
	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e3:SetCode(EFFECT_UPDATE_ATTACK)
	e3:SetRange(LOCATION_MZONE)
	e3:SetValue(c66933045.val)
	c:RegisterEffect(e3)
	--special summon
	e4:SetDescription(aux.Stringid(66933045,0))
	e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e4:SetType(EFFECT_TYPE_IGNITION)
	e4:SetCountLimit(1)
	e4:SetRange(LOCATION_MZONE)
	e4:SetCost(c66933045.cost)
	e4:SetTarget(c66933045.tg)
	e4:SetOperation(c66933045.op)
	c:RegisterEffect(e4)
end
function c66933045.val(e,c)
	return Duel.GetMatchingGroupCount(Card.IsRace,c:GetControler(),LOCATION_GRAVE,0,nil,RACE_ZOMBIE)*300
end
function c66933045.cost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
	Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c66933045.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
	if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) end
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
		and Duel.IsExistingTarget(c:IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
	local g=Duel.SelectTarget(tp,c:IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c66933045.op(e,tp,eg,ep,ev,re,r,rp,chk)
	local tc=Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
	end
end
Users browsing this topic