Shark02
  • Shark02
  • Advanced Member Topic Starter
2014-02-25T02:45:16Z
I need some help, I decided to add Number C102: Starfallen Seraph Noble Archfiend with a different effect this there


4 Level 5 LIGHT monsters
If this face-up card would be destroyed, you can detach 1 Xyz Material from this card instead. When an Xyz Material(s) is detached from this card from this way: Inflict 1500 damage to your opponent. If this card has "Number 102: Star Seraph Sentry" as an Xyz Material, it gains this effect.
● Once per turn: You can detach 1 Xyz Material from this card, then target 1 face-up monster your opponent controls; its ATK becomes 0, also negate its effects.


here script

--CNo.102 å…‰å •å¤©ä½¿ãƒŽãƒ¼ãƒ–ãƒ«ãƒ»ãƒ‡ãƒ¼ãƒ¢ãƒ³
function c67173574.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_DETACH_EVENT)
--xyz summon
aux.AddXyzProcedure(c,aux.XyzFilterFunctionF(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_LIGHT),5),4)
c:EnableReviveLimit()
--destroy replace
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetCode(EFFECT_DESTROY_REPLACE)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c67173574.reptg)
c:RegisterEffect(e1)
--disable
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1)
e2:SetCondition(c67173574.condition)
e2:SetCost(c67173574.cost)
e2:SetTarget(c67173574.target)
e2:SetOperation(c67173574.operation)
c:RegisterEffect(e2)
end
c67173574.xyz_number=102
function c67173574.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT) end
if Duel.SelectYesNo(tp,aux.Stringid(67173574,0)) then
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_EFFECT)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c67173574.damcon)
e1:SetTarget(c67173574.damtg)
e1:SetOperation(c67173574.damop)
e:GetHandler():RegisterEffect(e1)
return true
else return false end
end
function c67173574.damcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(67173574)~=0
end
function c67173574.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) and e:GetHandler():IsFaceup() end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(1500)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,1-tp,1500)
end
function c67173574.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
function c67173574.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetOverlayGroup():IsExists(Card.IsCode,1,nil,49678559)
end
function c67173574.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c67173574.filter(c)
return c:IsFaceup() and (c:GetAttack()>0 or not c:IsDisabled())
end
function c67173574.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c67173574.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c67173574.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c67173574.filter,tp,0,LOCATION_MZONE,1,1,nil)
end
function c67173574.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE_EFFECT)
e3:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e3)
end
end


is working well pretty much everything is, except part 1500 damage that is activated when he removes a material xyz to prevent their destruction someone know how to solve this?:(
2014-03-01T18:25:25Z
Instead of putting an effect inside an effect, why don't you just inflict the 1500 damage upon detaching the XYZ Material? I mean, by then it's resolution of a continuous effect, nothing can be chained there, and so you don't need to declare an effect at that point to do that.

Just remove all code regarding that effect, and immediately following the detaching of the XYZ Material, put:
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,1-tp,1500)
Similar Topics
Users browsing this topic