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 | .
 

 You can only activate the effect of "x" once per chain, and only once that chain.

View previous topic View next topic Go down 
AuthorMessage
OneShot




Member Title : OneShot
Posts : 2
Join date : 2014-09-24

PostSubject: You can only activate the effect of "x" once per chain, and only once that chain.   Tue Jan 06, 2015 2:59 am

I've been trying to make a card that activates when a monster is returned to the hand from the field, and gains life points equal to that monsters attack. But i don't want multiple copies going off at the same time. I want it so only one activates, and the others don't. The problem is, that i don't have any reference to go off for this restriction. So help would be great. 

While this card is in the graveyard; if a monster is returned to the hand by a card effect, gain lifepoints equal to that monsters original attack.

The code is as follows.

Code:
local e2=Effect.CreateEffect(c)
   e2:SetCategory(CATEGORY_RECOVER)
   e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
   e2:SetRange(LOCATION_GRAVE)
   e2:SetCode(EVENT_TO_HAND)
   e2:SetCondition(c26372137.thcon)
   e2:SetTarget(c26372137.thtg)
   e2:SetOperation(c26372137.thop)
   c:RegisterEffect(e2)
end
function c26372137.cfilter(c,tp)
   return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP)
      and not c:IsLocation(LOCATION_EXTRA)
end
function c26372137.thcon(e,tp,eg,ep,ev,re,r,rp)
   return bit.band(r,REASON_EFFECT)~=0 and eg:IsExists(c26372137.cfilter,1,nil,tp)
end
function c26372137.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
   if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
   local rc=eg:GetFirst()
   local dam=rc:GetAttack()
   Duel.SetTargetPlayer(tp)
   Duel.SetTargetParam(dam)
   Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,dam)
end
function c26372137.thop(e,tp,eg,ep,ev,re,r,rp)
   local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
   Duel.Recover(p,d,REASON_EFFECT)
end

I've tried having the target line set a flag, which gets removed after the chain, and the condition requiring the lack of said flag, but it didn't do anything.
Back to top Go down
View user profile
 

You can only activate the effect of "x" once per chain, and only once that chain.

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

 Similar topics

-
» What did this guy just say about that summon!?
» Atlanteans and Mermails
» Supervise and Gigaplant Ruling
» Maiden with eyes of blue.
» Effect Veiler V Yubel

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