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 effect

View previous topic View next topic Go down 
AuthorMessage
yugitom




Member Title : A man
Posts : 1
Join date : 2014-12-20

PostSubject: Help with effect   Sat Dec 20, 2014 11:15 pm

I just need help programming the effect of a monster I am trying to make. The effect reads:

Code:
When a level 3 or below Angel-type monster is summoned to your side of the field; Special summon this card in face-up defense position.

I have tried basing the code off Kagetokage and this is what I have so far:

Code:
function c98182297.initial_effect(c)
   c:EnableReviveLimit()
   --spsummon
   local e1=Effect.CreateEffect(c)
   e1:SetDescription(aux.Stringid(98182297,0))
   e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
   e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
   e1:SetRange(LOCATION_HAND)
   e1:SetCode(EVENT_SUMMON_SUCCESS+EVENT_SPSUMMON_SUCCESS+EVENT_FLIP_SUMMON_SUCCESS)
   e1:SetCondition(c98182297.spcon)
   e1:SetTarget(c98182297.sptg)
   e1:SetOperation(c98182297.spop)
   c:RegisterEffect(e1)
end
function c98182297.spcon(e,tp,eg,ep,ev,re,r,rp)
   local ec=eg:GetFirst()
   return ec:IsControler(tp) and ec:GetLevel()==IsLevelBelow(3) and ec:GetRace()==IsRace(RACE_FAIRY)
end
function c98182297.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
   if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
      and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
   Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c98182297.spop(e,tp,eg,ep,ev,re,r,rp)
   local c=e:GetHandler()
   if c:IsRelateToEffect(e) then
      Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)
      c:CompleteProcedure()
   end
end


I am new to programming cards and this is the first I have tried doing so the problem may be blatantly obvious to some but not me. Thank you.
Back to top Go down
View user profile
cane_63106

avatar


Member Title : D.D. Dragon Kaiser
Posts : 454
Join date : 2013-07-23
Location : St. Louis, MO

PostSubject: Re: Help with effect   Sun Dec 21, 2014 5:51 am

is angel the same as fairy or do you have an angel archetype? I'm pretty sure I can just knock this off for you without looking at your script. This card is only being special summoned from the hand when these conditions are met, right?

_________________
Now...you will feel my wrath and know your place! I activate DIMENSIONAL END!!!

Custom Card Duels
Back to top Go down
View user profile http:// https://www.youtube.com/user/cane63106/videos
thatjacksonboy




Member Title : ScrapKing
Posts : 8
Join date : 2014-10-06

PostSubject: Re: Help with effect   Tue Dec 23, 2014 9:56 pm

IF YOUR code for the most part was written correctly then this is how it should look 

function c98182297.initial_effect(c)
   c:EnableReviveLimit()
   --spsummon
   local e1=Effect.CreateEffect(c)
   e1:SetDescription(aux.Stringid(98182297,0))
   e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
   e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
   e1:SetRange(LOCATION_HAND)
   e1:SetCode(EVENT_SUMMON_SUCCESS)
   e1:SetCondition(c98182297.spcon)
   e1:SetTarget(c98182297.sptg)
   e1:SetOperation(c98182297.spop)
   c:RegisterEffect(e1)
   local e2=e1:Clone()
   e2:SetCode(EVENT_SPSUMMON_SUCCESS)
   c:RegisterEffect(e2)
   local e3=e1:Clone()
   e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
   c:RegisterEffect(e3)
end
function c98182297.spcon(e,tp,eg,ep,ev,re,r,rp)
   local ec=eg:GetFirst()
   return ec:IsControler(tp) and ec:GetLevel()==IsLevelBelow(3) and ec:GetRace()==IsRace(RACE_FAIRY)
end
function c98182297.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
   if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
      and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
   Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c98182297.spop(e,tp,eg,ep,ev,re,r,rp)
   local c=e:GetHandler()
   if c:IsRelateToEffect(e) then
      Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_DEFENSE)
      c:CompleteProcedure()
   end
end

Remember when you want it to do stuff on summon events they have to be there own SetCode so u have to make the SetCode in a Clone format 

example 
local e2=e1:Clone
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
Back to top Go down
View user profile
Sponsored content





PostSubject: Re: Help with effect   

Back to top Go down
 

Help with effect

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

 Similar topics

-
» Breeding Bristlenose, What effect to Hormones have?
» Gladiator Beast Effect.
» Pair of pale blue bark effect vases.
» The RB-Effect - the answer to earthquake
» Crackle effect paint without buying extra stuff!

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