YGOPRO Forum

Welcome Guest! To enable all features please try to register or login.
Options
Go to last post Go to first unread
Marc  
#1 Posted : Thursday, March 04, 2021 7:48:14 PM(UTC)
Marc

Rank: Advanced Member

Joined: 1/6/2013(UTC)
Posts: 192

Thanks: 12 times
Was thanked: 1 time(s) in 1 post(s)
Tried using Rescue Rabbit as base but not sure what to keep & what to delete etc....

If you control a Beast-Warrior you can special summon this card from your hand. You can banish this face-up card you control; Special Summon 1 Level 4 or lower Beast-Warrior from your Deck.

Quote:
--Werewolf - Omega
local s,id=GetID()
function s.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCost(aux.bfgcost)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
function s.cfilter(c)
return c:IsFaceup() and c:IsRace(RACE_BEASTWARRIOR)
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.filter(c,e,tp)
return c:IsRace(RACE_BEASTWARRIOR)) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.filter2(c,g)
return g:IsExists(Card.IsCode,1,c,c:GetCode())
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if e:GetHandler():GetSequence()<5 then ft=ft+1 end
if chk==0 then
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,e,tp)
return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and ft>1 and g:IsExists(s.filter2,1,nil,g)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,e,tp)
local dg=g:Filter(s.filter2,nil,g)
if #dg>=1 then
local fid=e:GetHandler():GetFieldID()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=dg:Select(tp,1,1,nil)
local tc1=sg:GetFirst()
dg:RemoveCard(tc1)
local tc2=dg:Filter(Card.IsCode,nil,tc1:GetCode()):GetFirst()
Duel.SpecialSummonStep(tc1,0,tp,tp,false,false,POS_FACEUP)
Duel.SpecialSummonStep(tc2,0,tp,tp,false,false,POS_FACEUP)
tc1:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1,fid)
tc2:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1,fid)
Duel.SpecialSummonComplete()
sg:AddCard(tc2)
sg:KeepAlive()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(sg)
e1:SetCondition(s.descon)
e1:SetOperation(s.desop)
Duel.RegisterEffect(e1,tp)
end
end
function s.desfilter(c,fid)
return c:GetFlagEffectLabel(id)==fid
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if not g:IsExists(s.desfilter,1,nil,e:GetLabel()) then
g:DeleteGroup()
e:Reset()
return false
else return true end
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local tg=g:Filter(s.desfilter,nil,e:GetLabel())
Duel.Destroy(tg,REASON_EFFECT)
end
MVPIII  
#2 Posted : Friday, March 05, 2021 2:54:30 AM(UTC)
MVPIII

Rank: Advanced Member

Joined: 2/7/2014(UTC)
Posts: 271

Thanks: 27 times
Was thanked: 24 time(s) in 22 post(s)
Delete s.filter2 if you're only summoning 1.

Remove "return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and ft>1 and g:IsExists(s.filter2,1,nil,g)
end" from the TG function. This is checking if you can summon 2 monsters at once and if you have a 2nd copy of the first monster you chose in your deck, respectively.

Remove "Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or" from the op function, and the get locationcount can be changed to 1 instead of 2.

Remove "local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,e,tp)
local dg=g:Filter(s.filter2,nil,g)
if #dg>=1 then
local fid=e:GetHandler():GetFieldID()" in the op function. Again, you're only summoning 1, so the 2nd filter is not needed.

Then remove everything after "Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)" in the op function.

After that, you could use something like the following

local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if #g~=0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end

If you're frankensteining cards like this, you don't have to copy everything. You can copy just the cost, or just the TG and OP functions, etc.

Say you just want to use the "discard 1 card" cost, you can just copy only that from Spyral quik-fix for example, or any other card that has that cost. And then let's say the actual effect of your card is "add 1 level 4 or lower "(archetype)" monster from your deck to your hand" you can use, say, Gladiator proving ground for the TG and OP functions. Then just change the setcard to whatever hex id your archetype is.
Marc  
#3 Posted : Friday, March 05, 2021 8:11:06 PM(UTC)
Marc

Rank: Advanced Member

Joined: 1/6/2013(UTC)
Posts: 192

Thanks: 12 times
Was thanked: 1 time(s) in 1 post(s)
Not sure if I made the changes correctly but it is giving me an error that I need to close the function at line 33.

Quote:
--Werewolf - Omega
local s,id=GetID()
function s.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCost(aux.bfgcost)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
function s.cfilter(c)
return c:IsFaceup() and c:IsRace(RACE_BEASTWARRIOR)
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.filter(c,e,tp)
return c:IsRace(RACE_BEASTWARRIOR)) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if e:GetHandler():GetSequence()<5 then ft=ft+1 end
if chk==0 then
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,e,tp)
return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and ft>1 and g:IsExists(s.filter2,1,nil,g)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if #g~=0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
Marc  
#4 Posted : Sunday, March 07, 2021 2:59:21 PM(UTC)
Marc

Rank: Advanced Member

Joined: 1/6/2013(UTC)
Posts: 192

Thanks: 12 times
Was thanked: 1 time(s) in 1 post(s)
I found another source code to work with that seems simpler. The second effect isn't working but at least I'm not getting an error message this time. It think the problem is with the cost of tributing.

If you control a Beast-Warrior you can special summon this card from your hand. You can tribute this face-up card you control; Special Summon 1 Level 4 or lower Beast-Warrior from your Deck.

Quote:
--Werewolf - Omega
local s,id=GetID()
function s.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(s.cost)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
end
function s.cfilter(c)
return c:IsFaceup() and c:IsRace(RACE_BEASTWARRIOR)
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function s.filter(c,e,tp)
return c:IsRace(RACE_BEASTWARRIOR) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_DECK) and s.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end


Marc  
#5 Posted : Saturday, March 27, 2021 12:12:11 PM(UTC)
Marc

Rank: Advanced Member

Joined: 1/6/2013(UTC)
Posts: 192

Thanks: 12 times
Was thanked: 1 time(s) in 1 post(s)
Can anyone help with this card? See message above.

Thanks!
Hippocampus1901  
#6 Posted : Monday, March 29, 2021 12:40:51 AM(UTC)
Hippocampus1901

Rank: Advanced Member

Joined: 12/29/2015(UTC)
Posts: 180

Thanks: 13 times
Was thanked: 42 time(s) in 42 post(s)
Hi Marc,

On the contrary, your cost seems to be correct; it's the operation and target functions that are wonky. Your card's effect doesn't target a monster, right? Here's something I got from mixing Lava Dragon with Giant Pairfish. I haven't tested it, though, so let me know if it works!
Code:
--Werewolf - Omega
function s.initial_effect(c)
	--special summon
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_SPSUMMON_PROC)
	e1:SetRange(LOCATION_HAND)
	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
	e1:SetCondition(s.spcon)
	c:RegisterEffect(e1)
	--special summon
	local e2=Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(s,0))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_IGNITION)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCost(s.cost)
	e2:SetTarget(s.target)
	e2:SetOperation(s.operation)
	c:RegisterEffect(e2)
end
function s.cfilter(c)
	return c:IsFaceup() and c:IsRace(RACE_BEASTWARRIOR)
end
function s.spcon(e,c)
	if c==nil then return true end
	local tp=c:GetControler()
	return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
		and	Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return e:GetHandler():IsReleasable() end
	Duel.Release(e:GetHandler(),REASON_COST)
end
function s.filter(c,e,tp)
	return c:IsLevelBelow(4) and c:IsRace(RACE_BEASTWARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function s.operation(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_DECK,0,1,1,nil,e,tp)
	if g:GetCount()>0 then
		Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
	end
end
Marc  
#7 Posted : Monday, March 29, 2021 7:03:57 PM(UTC)
Marc

Rank: Advanced Member

Joined: 1/6/2013(UTC)
Posts: 192

Thanks: 12 times
Was thanked: 1 time(s) in 1 post(s)
Hi Hippo,

Nope! That didn't work. I got a global index error & the special summon from the hand while I control a Beast-Warrior isn't working anymore either.
Hippocampus1901  
#8 Posted : Monday, April 05, 2021 1:50:23 AM(UTC)
Hippocampus1901

Rank: Advanced Member

Joined: 12/29/2015(UTC)
Posts: 180

Thanks: 13 times
Was thanked: 42 time(s) in 42 post(s)
...Really? Because today I tested the script I made above, and I got both effects to work perfectly. Maybe try deleting the line "e2:SetDescription(aux.Stringid(s,0))"; if it still doesn't work after that, there must be something else wrong on your end.

Can someone else weigh in on this one?
Marc  
#9 Posted : Monday, April 05, 2021 1:44:38 PM(UTC)
Marc

Rank: Advanced Member

Joined: 1/6/2013(UTC)
Posts: 192

Thanks: 12 times
Was thanked: 1 time(s) in 1 post(s)
That worked!

I also needed to add local s,id=GetID() at the top to make the first effect work.

Thanks!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Notification

Icon
Error