andre060
  • andre060
  • Advanced Member Topic Starter
2016-06-23T03:16:17Z
i want to make a card with effect that when you have 2000 or more lifepoints the card destroy itself, i dont know how to do, im tried many ways but im still couldn't make the effect work right.
I would be grateful if someone help [:smile:]
poi
MaxAngelo149
2016-06-23T04:15:29Z
Really simple effect.



Haven't tested it, but it should work.
andre060
  • andre060
  • Advanced Member Topic Starter
2016-06-23T18:43:37Z
[:confu:] for some reason still does not work, look the script of card (actually, i want that the self destroy effect happen at end phase)
code wrote:

--card
function c99999999.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--cant atack lv
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ATTACK)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(c99999999.atktarget1)
c:RegisterEffect(e2)
--cant atack rank
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ATTACK)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(c99999999.atktarget2)
c:RegisterEffect(e3)
--Self destroy
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DESTROY)
e4:SetDescription(aux.Stringid(99999999,1))
e4:SetType(EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_PHASE)
e4:SetRange(LOCATION_SZONE)
e4:SetCondition(c99999999.descon)
e4:SetTarget(c99999999.destrg)
e4:SetOperation(c99999999.desop)
c:RegisterEffect(e4)
end
function c99999999.atktarget1(e,c)
return c:GetLevel()>=4
end
function c99999999.atktarget2(e,c)
return c:GetRank()>=1
end
function c99999999.descon(e,tp,eg,ep,ev,re,r,rp,chk)
local lp=Duel.GetLP(tp)
return lp>=2000
end
function c99999999.destrg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsDestructable() and c:IsFaceup() end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,c,1,0,0)
end
function c99999999.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
Duel.Destroy(c,REASON_EFFECT)
end
end


what i am doing wrong?
poi
[YOL]Edo9300
2016-06-23T22:57:04Z
try:
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SELF_DESTROY)
e1:SetCondition(c99999999.sdcon)
c:RegisterEffect(e1)
end
function c99999999.sdcon(e)
return Duel.GetLP(e:GetHandlerPlayer())>=2000
end
MaxAngelo149
2016-06-24T01:07:57Z
Originally Posted by: andre060 

[:confu:] for some reason still does not work, look the script of card (actually, i want that the self destroy effect happen at end phase)
...
what i am doing wrong?



Well, it would of been more helpful if you made it clear that you wanted the destruction to happen at End Phase in your first post. And your effect is fine for the most part. I think you got it right with "TRIGGER" instead of "QUICK", but you code needs the phase you want the effect to happen...



So, I added "PHASE_END" to your SetCode. And just for good measures, I added "EFFECT_TYPE_FIELD" to your SetType, based off another card script that has an effect that happens at the End Phase.
andre060
  • andre060
  • Advanced Member Topic Starter
2016-06-24T02:26:58Z
finally worked, thank you both for the help [:smile:]

poi