AkiraDegawa
2016-05-23T13:51:51Z
I want make effects fro this card

UserPostedImage

But the untargetable by trap+monster effect doesn't work, it still can be targeted~
Can someone help me? [:confu:]

Quote:

Equip only to an "Archer" monster. It cannot be targeted by the effect of your opponent's Trap Cards or Effect Monsters. Once per turn: You can Tribute 1 monster, except the equipped monster; the equipped monster can attack directly this turn.



This is my script for this card
Quote:

--Archer's Cloak
function c50000042.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c50000042.target)
e1:SetOperation(c50000042.operation)
c:RegisterEffect(e1)
--Untargetable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetValue(c50000042.tglimit)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(c50000042.eqlimit)
c:RegisterEffect(e3)
--Direct attack
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1)
e4:SetCost(c50000042.dacost)
e4:SetOperation(c50000042.daop)
c:RegisterEffect(e4)
end
function c50000042.eqlimit(e,c)
return c:IsSetCard(4)
end
function c50000042.tglimit(e,re,rp)
return aux.tgoval(e,re,rp) and re:IsActiveType(TYPE_TRAP+TYPE_MONSTER)
end
function c50000042.filter(c)
return c:IsFaceup() and c:IsSetCard(4)
end
function c50000042.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetLocation()==LOCATION_MZONE and c1644289.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c50000042.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c50000042.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c50000042.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
end
end
function c50000042.dacost(e,tp,eg,ep,ev,re,r,rp,chk)
local eq=e:GetHandler():GetEquipTarget()
if chk==0 then return Duel.CheckReleaseGroup(tp,nil,1,eq) end
local g=Duel.SelectReleaseGroup(tp,nil,1,1,eq)
Duel.Release(g,REASON_COST)
end
function c50000042.daop(e,tp,eg,ep,ev,re,r,rp)
local eq=e:GetHandler():GetEquipTarget()
local c=e:GetHandler()
if eq:IsFaceup() and c:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
eq:RegisterEffect(e1)
end
end



http://www.ygopro.co/For...-MOD?m=150425#post150425 
Users browsing this topic