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
 
HomePortalLatest imagesSearchRegisterLog 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

Help with effect Empty
PostSubject: Help with effect   Help with effect Icon_minitimeSat 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
cane_63106

cane_63106


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

Help with effect Empty
PostSubject: Re: Help with effect   Help with effect Icon_minitimeSun 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?
Back to top Go down
http:// https://www.youtube.com/user/cane63106/videos
thatjacksonboy




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

Help with effect Empty
PostSubject: Re: Help with effect   Help with effect Icon_minitimeTue 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
Sponsored content





Help with effect Empty
PostSubject: Re: Help with effect   Help with effect Icon_minitime

Back to top Go down
 

Help with effect

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

 Similar topics

-
» Magical Hats (Anime) Effect + Dark Sage (Anime) Effect [Help Please]
» Help with this effect?!
» each monster you control gain this effect
» Help with a card effect
» Random Damage by effect?

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