a place for all your custom card needs you can post scripts pics and request for card to be made also please donate to the funding for a new server made for custom card duels
 
HomePortalCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | .
 

 Help with Destroy + Special Summon effect

View previous topic View next topic Go down 
AuthorMessage
ShikaShika




Member Title : Card newbie
Posts : 11
Join date : 2014-07-12

PostSubject: Help with Destroy + Special Summon effect   Wed Oct 01, 2014 10:46 pm

Hey, all. I've been trying to script the following effect, but I can't get it to work:


Quote:
Continuous Spell
Once per turn, you can target any number of "XX" monsters you control; destroy them and Special Summon from your Deck a "XX" monster(s) with a combined Level equal to or lower than the destroyed monster(s).


As a base, I've been working with http://yugioh.wikia.com/wiki/Worm_Queen (c81254059) and http://yugioh.wikia.com/wiki/Circle_of_the_Fire_Kings (c59388357), but I can't get it to work at all.

If anyone can help with this script, I'd greatly appreciate it.
Back to top Go down
View user profile
StormWing0




Member Title : Over Creative Card Ideas
Posts : 451
Join date : 2013-07-14
Age : 25
Location : Tacoma, WA

PostSubject: Re: Help with Destroy + Special Summon effect   Thu Oct 02, 2014 2:33 am

Looks like you need to change the Archetype target but I can't remember how to make a new one in the DB so it can be used. >.>

_________________
Own Archetypes being worked on: RoseHarpie, OrbLit, Crystal Elemental (No cards yet on the last one).

Current Hamachi Room that isn't full:
Name: StormWing120V3
Pass: 1234

Discord Channel: Instant Invite Let me know if this fails to work right.  If it fully works it'll replace the Hamachi above.

Keep in mind these below are just estimates and even if it says 100% it only means what is needed for the main dueling deck is done
RoseHarpie 50% finished but no code or images
OrbLit 80% finished some images but no code
Crystal Elemental 0% finished
Back to top Go down
View user profile
TGAP-Trixie

avatar


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

PostSubject: Re: Help with Destroy + Special Summon effect   Thu Oct 02, 2014 2:47 am

You'd just need to type a random number from 514 to... I forget the max for the archetype number in the DB.

And for the script you'd have to get its hexidecimal number to reference the archetype in the script itself.

Anyways, if not that, what was the exact problem?
Back to top Go down
View user profile
ShikaShika




Member Title : Card newbie
Posts : 11
Join date : 2014-07-12

PostSubject: Re: Help with Destroy + Special Summon effect   Thu Oct 02, 2014 3:12 am

The particular archetype I'm trying to work with is Yang Zings, and the set code is 0x9e. The problems I'm running into are the following:

Worm Queen lets you tribute 1 monster to special summon 1 monster. Firstly, I don't want to tribute but rather to destroy 1, because I want to proc Yang Zing effects when they are destroyed. I figured I could use Circle of the Fire Kings to replicate this, by changing Worm Queen's cost to a target and changing the location from LOCATION_GRAVE to LOCATION_DECK. The second problem is that I want to be able to destroy and special summon more than 1 monster, but I don't know how to do this.

Anyway, when I combine Worm Queen and Circle of the Fire Kings to destroy rather than tribute, I find that I can no longer activate the effect. For what it's worth, here is my code:

function c6000200.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--Destroy then special summon
local e17=Effect.CreateEffect(c)
e17:SetProperty(EFFECT_FLAG_CARD_TARGET)
e17:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e17:SetType(EFFECT_TYPE_IGNITION)
e17:SetRange(LOCATION_SZONE)
e17:SetCode(EVENT_FREE_CHAIN)
e17:SetCountLimit(1)
e17:SetTarget(c6000200.dsstg)
e17:SetOperation(c6000200.dssop)
c:RegisterEffect(e17)
end
function c6000200.dsscostfilter(c)
return c:IsDestructable() and c:IsSetCard(0x9e) and c:IsType(TYPE_MONSTER) and Duel.IsExistingMatchingCard(c6000200.dsspfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetLevel())
end
function c6000200.dsstg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>=0
and Duel.IsExistingTarget(c6000200.dsscostfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingTarget(c6000200.dsspfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,c6000200.dsscostfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local lv=g1:GetLevel()
local g2=Duel.SelectTarget(tp,c6000200.dsspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g2,1,0,0)
e:SetLabelObject(g1:GetFirst())
end
function c6000200.dsspfilter(c,e,tp,lv)
return c:IsSetCard(0x9e) and c:GetLevel()<=lv and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c6000200.dssop(e,tp,eg,ep,ev,re,r,rp)
local tc1,tc2=Duel.GetFirstTarget()
if tc1~=e:GetLabelObject() then tc1,tc2=tc2,tc1 end
if tc1:IsControler(tp) and tc1:IsRelateToEffect(e) and Duel.Destroy(tc1,REASON_EFFECT)>0 and tc2:IsRelateToEffect(e) then
Duel.SpecialSummon(tc2,0,tp,tp,false,false,POS_FACEUP)
end
end

The jump in effect numbers is just because I've omitted other, unrelated effects.
Back to top Go down
View user profile
TGAP-Trixie

avatar


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

PostSubject: Re: Help with Destroy + Special Summon effect   Thu Oct 02, 2014 4:01 am

Try just copying the circle of the fire kings cost. That dsscostfilter looks like you're trying to destroy the monster that you would special summon as a cost from the deck (and well, it wouldn't be in the deck anymore to summon).

That SHOULD be the only thing you need to do...

function c6000200.dsscostfilter(c)
return c:IsFaceup() and c:IsSetCard(0x9e) and c:IsDestructable()
Back to top Go down
View user profile
ShikaShika




Member Title : Card newbie
Posts : 11
Join date : 2014-07-12

PostSubject: Re: Help with Destroy + Special Summon effect   Thu Oct 02, 2014 4:32 am

Alright, I did that. And now there is an issue with the following segment:

function c6000200.dsspfilter(c,e,tp,lv)
return c:IsSetCard(0x9e) and c:GetLevel()<=lv and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end

Undoubtedly it's the "c:GetLevel()<=lv", as it says it's trying to make a comparison with a non-existent number, but I don't know how to set lv aside from what I've already included.
Back to top Go down
View user profile
outlaw1994

avatar
Admin
Admin

Member Title : Red-Eyes Lord
Posts : 797
Join date : 2013-07-09
Age : 22
Location : bundaberg qld australia

PostSubject: Re: Help with Destroy + Special Summon effect   Thu Oct 02, 2014 9:36 am

in this line add

local g2=Duel.SelectTarget(tp,c6000200.dsspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)


,lv at the end so it would be like this


local g2=Duel.SelectTarget(tp,c6000200.dsspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,lv)


any variable you declare in the filter has to also be declared in the variable that uses the filter so the lv at the end of local g2 has to be the number you want to use in your filter as lv in this case the level hope this helps
Back to top Go down
View user profile http://mackpro.userboard.net
ShikaShika




Member Title : Card newbie
Posts : 11
Join date : 2014-07-12

PostSubject: Re: Help with Destroy + Special Summon effect   Thu Oct 02, 2014 10:02 am

Alright, I did that, but I'm still getting an error from the same line, and the error reads:


Code:
attempt to compare number with nil

This is how the updated script looks:

Quote :
function c6000200.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--Destroy then special summon
local e17=Effect.CreateEffect(c)
e17:SetProperty(EFFECT_FLAG_CARD_TARGET)
e17:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e17:SetType(EFFECT_TYPE_IGNITION)
e17:SetRange(LOCATION_SZONE)
e17:SetCode(EVENT_FREE_CHAIN)
e17:SetCountLimit(1)
e17:SetTarget(c6000200.dsstg)
e17:SetOperation(c6000200.dssop)
c:RegisterEffect(e17)
end
function c6000200.dsscostfilter(c)
return c:IsDestructable() and c:IsSetCard(0x9e) and c:IsFaceup()
end
function c6000200.dsstg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>=0
and Duel.IsExistingTarget(c6000200.dsscostfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingTarget(c6000200.dsspfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,c6000200.dsscostfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local lv=g1:GetLevel()
local g2=Duel.SelectTarget(tp,c6000200.dsspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g2,1,0,0)
e:SetLabelObject(g1:GetFirst())
end
function c6000200.dsspfilter(c,e,tp,lv)
return c:IsSetCard(0x9e) and c:GetLevel()<=lv and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c6000200.dssop(e,tp,eg,ep,ev,re,r,rp)
local tc1,tc2=Duel.GetFirstTarget()
if tc1~=e:GetLabelObject() then tc1,tc2=tc2,tc1 end
if tc1:IsControler(tp) and tc1:IsRelateToEffect(e) and Duel.Destroy(tc1,REASON_EFFECT)>0 and tc2:IsRelateToEffect(e) then
Duel.SpecialSummon(tc2,0,tp,tp,false,false,POS_FACEUP)
end
end
Back to top Go down
View user profile
ShikaShika




Member Title : Card newbie
Posts : 11
Join date : 2014-07-12

PostSubject: Re: Help with Destroy + Special Summon effect   Fri Oct 03, 2014 1:35 pm

I managed to figure it out. The script, for anyone who is interested:


Quote :
function c6000200.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--Destroy then special summon
local e17=Effect.CreateEffect(c)
e17:SetProperty(EFFECT_FLAG_CARD_TARGET)
e17:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e17:SetType(EFFECT_TYPE_IGNITION)
e17:SetRange(LOCATION_SZONE)
e17:SetCode(EVENT_FREE_CHAIN)
e17:SetCountLimit(1)
e17:SetTarget(c6000200.dsstg)
e17:SetOperation(c6000200.dssop)
c:RegisterEffect(e17)
end
function c6000200.dsscostfilter(c,e,tp)
return c:IsSetCard(0x9e) and c:IsFaceup() and c:IsDestructable()
and Duel.IsExistingMatchingCard(c6000200.dsspfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetLevel())
end
function c6000200.dsstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c6000200.dsscostfilter,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
local sg=Duel.SelectReleaseGroup(tp,c6000200.dsscostfilter,1,5,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,1,0,0)
local tlv=0
local bc=sg:GetFirst()
while bc do
local clv=bc:GetLevel()
tlv=tlv+clv
bc=sg:GetNext()
end
e:SetLabel(tlv)
end
function c6000200.dsspfilter(c,e,tp,lv)
return c:IsSetCard(0x9e) and c:GetLevel()<=lv
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c6000200.dsspfilter2(c,e,tp)
return c:IsSetCard(0x9e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c6000200.dssop(e,tp,eg,ep,ev,re,r,rp)
local ex,sg=Duel.GetOperationInfo(0,CATEGORY_DESTROY)
Duel.Destroy(sg,REASON_EFFECT)
if not e:GetHandler():IsRelateToEffect(e) then return end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
local c=e:GetHandler()
local slv=e:GetLabel()
local sg=Duel.GetMatchingGroup(c6000200.dsspfilter2,tp,LOCATION_DECK,0,nil,e,tp)
sg:Remove(Card.IsLevelAbove,nil,slv+1)
if sg:GetCount()==0 then return end
local cg=Group.CreateGroup()
repeat
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=sg:Select(tp,1,1,nil):GetFirst()
sg:RemoveCard(tc)
slv=slv-tc:GetLevel()
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
sg:Remove(Card.IsLevelAbove,nil,slv+1)
ft=ft-1
until ft<=0 or sg:GetCount()==0 or not Duel.SelectYesNo(tp,aux.Stringid(6000200,0))
Duel.SpecialSummonComplete()
Duel.ConfirmCards(1-tp,cg)
end
Back to top Go down
View user profile
Sponsored content





PostSubject: Re: Help with Destroy + Special Summon effect   

Back to top Go down
 

Help with Destroy + Special Summon effect

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» Archlord Zerato
» Lesson 15: Special Summon-Only
» Greed Quasar and monsters like this one
» Guide to Elemental Heroes
» is there a deck that stops special summons?(nid help)

Permissions in this forum:You cannot reply to topics in this forum
Mackpro :: MackPro :: Requests-