Neither of this card effect are working. What did I do wrong? Thanks!
When this card is normal summoned: You can special summon 1 Level 4 Dark Warrior from your hand.
When this card is sent to the GY: Select 1 of your opponent’s empty Spell/Trap or Main Monster Zones. The selected zone cannot be used as long as this card is in the GY.
--Hejjin of the Vicious Scythe
local s,id=GetID()
function s.initial_effect(c)
--summon success
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetTarget(s.sumtg)
e2:SetOperation(s.sumop)
c:RegisterEffect(e2)
--target
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c10060000.tg)
e1:SetOperation(c10060000.op)
c:RegisterEffect(e1)
end
function c10060000.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)+Duel.GetLocationCount(1-tp,LOCATION_MZONE)
+Duel.GetLocationCount(tp,LOCATION_SZONE)+Duel.GetLocationCount(1-tp,LOCATION_SZONE)>0 end
local dis=Duel.SelectDisableField(tp,1,0,LOCATION_ONFIELD,LOCATION_ONFIELD,0)
e:SetLabel(dis)
--disable zone
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_GRAVE)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetOperation(c10060000.disop)
e1:SetLabel(e:GetLabel())
e1:SetReset(RESET_EVENT+0x1fe0000)
e:GetHandler():RegisterEffect(e1)
end
function c10060000.disop(e,tp)
return e:GetLabel()
end
function s.filter(c,e,tp)
return c:GetLevel()==4 and c:IsRace(RACE_WARRIOR)and c:IsAttribute(ATTRIBUTE_DARK)(e,0,tp,false,false)
end
function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function s.sumop(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,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end