Heinken111
2015-08-15T18:34:19Z
Im taking up scripting again and I have a question, I want to make a script that everytime a monster is brought back from the grave to the field you get to draw one card (Working on a Exodia/zombie deck).

However I've never really done a continuous spell.

Can someone help with some pointers.
Heinken111
2015-08-18T21:49:02Z
majig12346
2015-08-18T23:54:06Z
...
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_SPSUMMON)

--event free activation of continuous (trap?), hints on special summon

e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
[condition that says from grave]
e2:SetRange(LOCATION_SZONE)
e2:SetOperation(c00000[INSERT NUMBER].op)

--forced trigger on special summon from grave

...
end
function c00000.op(e,tp,eg,ep,ev,re,r,rp)
local n=Duel.GetFlagEffect(tp,00000)
Duel.Draw(tp,n,REASON_EFFECT)
end
Kri420S
2015-08-19T11:24:17Z
The effect should look like something similar to this:
function c[NUMBER].initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c[NUMBER].con)
e2:SetTarget(c[NUMBER].tg)
e2:SetOperation(c[NUMBER].op)
c:RegisterEffect(e2)
end
function c[NUMBER].con(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c[NUMBER].filter,1,nil,tp) or eg:IsExists(c[NUMBER].filter,1,nil,nil,1-tp)
end
function c[NUMBER].filter(c,tp)
return c:IsPreviousLocation(LOCATION_GRAVE)
end
function c[NUMBER].tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c[NUMBER].op(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end