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
 

 Stuck again -__-'

View previous topic View next topic Go down 
AuthorMessage
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Stuck again -__-'   Stuck again -__-' Icon_minitimeSun Jun 08, 2014 2:01 pm

I don't know whether I'm too stupid or the card I want to make is to difficult,
but I don't know how I should script the following card:

If this cards is synchro summoned, draw 1 card an perform following effects depending on the card you draw:
*monster: gain lifepoints equal to the atk of the monster you draw
*spell/ trap: destroy 1 card on the field

What I have done so far:
Code:
function c900000004.initial_effect(c)
   --synchro summon
   aux.AddSynchroProcedure(c,c900000004.tfilter,aux.NonTuner(Card.IsSetCard,0x3E8),1)
   c:EnableReviveLimit()
   --synchro summon success
   local e1=Effect.CreateEffect(c)
   e1:SetDescription(aux.Stringid(900000004,0))
   e1:SetCategory(CATEGORY_DRAW)
   e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
   e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
   e1:SetCode(EVENT_SPSUMMON_SUCCESS)
   e1:SetCondition(c900000004.drcon)
   e1:SetTarget(c900000004.drtarg)
   e1:SetOperation(c900000004.drop)
   c:RegisterEffect(e1)
end

function c900000004.tfilter(c)
   return c:IsSetCard(0x3E8)
end
function c900000004.drcon(e,tp,eg,ep,ev,re,r,rp)
   return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c900000004.drtarg(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 c900000004.cfilter(c)
   return c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP)
end
function c900000004.drop(e,tp,eg,ep,ev,re,r,rp)
   local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
   Duel.Draw(p,d,REASON_EFFECT)
   local dg=Duel.GetOperatedGroup()
   local d=dg:FilterCount(c900000004.cfilter,nil)
   if d>0 then
              
              
    else
    
              
    end                                        
end

I tried to fill in the if-else a 2nd effect fo my cards (e2=Effect.CreateEffect(c)), 
but it says that the first parameter of this thing should be 'card' ^^

Hope someone can help me ^^'
Back to top Go down
VB99

VB99


Member Title : Legendary Planet
Posts : 368
Join date : 2013-11-10

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeSun Jun 08, 2014 11:16 pm

Card... maybe you didn't give the effect the right target?
Back to top Go down
http://www.fanfiktion.de/u/VB99
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeMon Jun 09, 2014 11:51 am

It says, that in the line, where I put e2=Effect.CreateEffect(c),
the first parameter should be 'card',
but I don't understand which target I should give the card
besides 'c'which means card ^^'
Back to top Go down
overcold_ice

overcold_ice


Member Title : Overfrost!
Posts : 21
Join date : 2014-06-02

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeMon Jun 09, 2014 7:34 pm

Use 'e:GetHandler()' instead.
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeMon Jun 09, 2014 11:10 pm

Thank you, I will try it after I got me a new pc, because my old one isn't living anymore ;(
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeTue Jun 17, 2014 5:10 pm

Ok, I tested it with 'e:GetHandler()' and the error stopped, thank you^^
My Problem now is, that the destruction effect activates the whole time instead of just once after the card was drawn. And I have no idea, what I should do about the lp effect *.*'
The effect of my monster was:
When this card is synchro summoned, draw 1 card and perform following effects depending on the card you draw:
*monster: Get liefepoints equals to the atk of the monster you draw
*spell/ trap: Destroy one card on the field

My script so far:
Code:
function c900000004.initial_effect(c)
   --synchro summon
   aux.AddSynchroProcedure(c,c900000004.tfilter,aux.NonTuner(Card.IsSetCard,0x3E8),1)
   c:EnableReviveLimit()
   --synchro summon success
   local e1=Effect.CreateEffect(c)
   e1:SetDescription(aux.Stringid(900000004,0))
   e1:SetCategory(CATEGORY_DRAW)
   e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
   e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
   e1:SetCode(EVENT_SPSUMMON_SUCCESS)
   e1:SetCondition(c900000004.drcon)
   e1:SetTarget(c900000004.drtarg)
   e1:SetOperation(c900000004.drop)
   c:RegisterEffect(e1)
end

function c900000004.tfilter(c)
   return c:IsSetCard(0x3E8)
end
function c900000004.drcon(e,tp,eg,ep,ev,re,r,rp)
   return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c900000004.drtarg(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 c900000004.cfilter(c)
   return c:IsType(TYPE_SPELL) or c:IsType(TYPE_TRAP)
end
function c900000004.drop(e,tp,eg,ep,ev,re,r,rp)
   local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
   Duel.Draw(p,d,REASON_EFFECT)
   local dg=Duel.GetOperatedGroup()
   local d=dg:FilterCount(c900000004.cfilter,nil)
   if d>0 then
      local c=e:GetHandler()
      local e1=Effect.CreateEffect(c)
     e1:SetDescription(aux.Stringid(900000004,0))
        e1:SetCategory(CATEGORY_DESTROY)
     e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
     e1:SetType(EFFECT_TYPE_IGNITION)
       e1:SetRange(LOCATION_MZONE)
     e1:SetTarget(c900000004.target)
     e1:SetOperation(c900000004.operation)
     c:RegisterEffect(e1)            
   else
      
    end                                        
end

function c900000004.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
   if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsDestructable() end
   if chk==0 then return Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
   Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
   local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
   Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c900000004.operation(e,tp,eg,ep,ev,re,r,rp)
   local tc=Duel.GetFirstTarget()
   if tc:IsRelateToEffect(e) then
      Duel.Destroy(tc,REASON_EFFECT)
   end
end


Hope someone can help^^'
Back to top Go down
overcold_ice

overcold_ice


Member Title : Overfrost!
Posts : 21
Join date : 2014-06-02

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeThu Jun 19, 2014 3:09 pm

This, perhaps:
Code:
if d>0 then
     local c=e:GetHandler()
     local e1=Effect.CreateEffect(c)
    e1:SetDescription(aux.Stringid(900000004,0))
       e1:SetCategory(CATEGORY_DESTROY)
    e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
    e1:SetType(EFFECT_TYPE_IGNITION)
      e1:SetRange(LOCATION_MZONE)
    e1:SetCountLimit(1) -- add this line
    e1:SetTarget(c900000004.target)
    e1:SetOperation(c900000004.operation)
    c:RegisterEffect(e1)            
  else
     
   end
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeThu Jun 19, 2014 4:05 pm

Thank you, but 'SetCountLimit' only limits how often you can activate the effect per turn.
With that, I coul activate the effect each turn instead of just once after a spell/ trap was drawn^^'
Back to top Go down
TGAP-Trixie

TGAP-Trixie


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

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeThu Jun 19, 2014 11:31 pm

It looks like the destruction is related to the effect but the draw isn't. How to fix that though, idk.
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeFri Jun 20, 2014 10:41 am

looks like it XD
Anyway the effect of the card is a little bit too strong, maybe I change it.^^'
Back to top Go down
dye2556




Member Title : Just a passing man
Posts : 17
Join date : 2014-06-05

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeFri Jun 20, 2014 5:54 pm

Why must you add the new effect? You only want the destroy effect activated immediately after draw step, right?
So try this.

Code:
function c900000004.drop(e,tp,eg,ep,ev,re,r,rp)
   local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
   Duel.Draw(p,d,REASON_EFFECT)
   local dg=Duel.GetOperatedGroup()
   local d=dg:FilterCount(c900000004.cfilter,nil)
   if d>0 then
         local dt=Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
         if dt then
         local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
         local tc=g:GetFirst()
         if tc then
         Duel.Destroy(tc,REASON_EFFECT)
         end
         end
 end
end
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeFri Jun 20, 2014 6:22 pm

Cool it worked, thank you^^
Back to top Go down
dye2556




Member Title : Just a passing man
Posts : 17
Join date : 2014-06-05

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeSat Jun 21, 2014 4:38 am

Spell/Trap draw effect is okay now. Then for the monster draw effect try this.


Code:
function c900000004.drop(e,tp,eg,ep,ev,re,r,rp)
   local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
   Duel.Draw(p,d,REASON_EFFECT)
   local dg=Duel.GetOperatedGroup()
   local d=dg:FilterCount(c900000004.cfilter,nil)
   if d>0 then
         local dt=Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
         if dt then
         local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
         local tc=g:GetFirst()
         if tc then
         Duel.Destroy(tc,REASON_EFFECT)
         end
         end
else lg=dg:Select(tp,1,1,nil)
 local tc2=lg:GetFirst()
 local rec=tc2:GetTextAttack()
Duel.Recover(tp,rec,REASON_EFFECT)
 end
end
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeSat Jun 21, 2014 11:32 am

Thank you very much, it workes^^
Am I allowed to ask, where you learn scripting??
Back to top Go down
dye2556




Member Title : Just a passing man
Posts : 17
Join date : 2014-06-05

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeSat Jun 21, 2014 3:49 pm

AoO wrote:
Thank you very much, it workes^^
Am I allowed to ask, where you learn scripting??

I practiced by myself. First of all, I start with copy and paste method. (Choose card that has similar effects for reference.) Then try to understand what code makes what effect. After some practices (cards I created until today over 100 cards), your skill will be improved.
Also, learning from other people's custom cards helps much. Many of them have unique effects.
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitimeSat Jun 21, 2014 3:53 pm

Thx, guess I have to script some more cards ^^
Back to top Go down
Sponsored content





Stuck again -__-' Empty
PostSubject: Re: Stuck again -__-'   Stuck again -__-' Icon_minitime

Back to top Go down
 

Stuck again -__-'

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

 Similar topics

-
» I'm Stuck!
» Please help me, I'm stuck ^^'

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