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

 CallCodeFunction

View previous topic View next topic Go down 
AuthorMessage
Project Leviamon

avatar


Member Title : Busy with high school sadly
Posts : 320
Join date : 2013-08-03
Age : 18
Location : Digital World

PostSubject: CallCodeFunction   Tue Aug 27, 2013 7:01 pm

i'm scripting a Yugioh anime card Diabound Kernel. i scripted everything else just fine but when Diabound Kernel destroys a monster by battle i get an error that says "CallCodeFunction : Attempt to call an error function

_________________
Not the best at scripting, but will help if I can. Really busy lately tho :/


Youtube Channel

Dark Army vs Elemental Dragons

Planned Archetypes:
-Persona Card
-Dark Army
-Elemental Dragons
-END (tons and tons of cards made in card maker)
-Chained Dragons (lost in a computer meltdown, will redo eventually)
-RWBY (thinking of making these)
Back to top Go down
View user profile http://www.pokecommunity.com/member.php?u=364458
jackmoonward

avatar
Admin
Admin

Posts : 75
Join date : 2013-08-03
Age : 20
Location : Classified

PostSubject: Re: CallCodeFunction   Tue Aug 27, 2013 9:53 pm

What is your current script?

~Jack

_________________
Jackpro! The only YGOPro anime mod with Alchemy Beasts, Armor monsters, Valkyries, and more! Download at www.tehmadhouse.tk

My YouTube: www.youtube.com/user/jackmoonward
Back to top Go down
View user profile http://www.tehmadhouse.tk
Project Leviamon

avatar


Member Title : Busy with high school sadly
Posts : 320
Join date : 2013-08-03
Age : 18
Location : Digital World

PostSubject: Re: CallCodeFunction   Wed Aug 28, 2013 1:54 am

--Diabound Kernel
function c98781564.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(98781564,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c98781564.eqtg)
e1:SetOperation(c98781564.eqop)
c:RegisterEffect(e1)
--unequip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(98781564,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c98781564.uncon)
e2:SetTarget(c98781564.sptg)
e2:SetOperation(c98781564.spop)
c:RegisterEffect(e2)
--atkdown
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(-1800)
e3:SetCondition(c98781564.uncon)
c:RegisterEffect(e3)
--eqlimit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_EQUIP_LIMIT)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetValue(c98781564.eqlimit)
c:RegisterEffect(e4)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(98781564,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(c98781564.decon)
e5:SetTarget(c98781564.detg)
e5:SetOperation(c98781564.deop)
c:RegisterEffect(e5)
--copy
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(88071625,1))
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e6:SetRange(LOCATION_MZONE)
e6:SetCode(EVENT_BATTLE_DESTROYING)
e6:SetTarget(c98781564.copycon)
e6:SetOperation(c98781564.copyop)
c:RegisterEffect(e6)
end
function c98781564.uncon(e)
return e:GetHandler():IsStatus(STATUS_UNION)
end
function c98781564.repval(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
function c98781564.eqlimit(e,c)
return c:IsFaceup()
end
function c98781564.filter(c)
local code=c:GetCode()
return c:IsFaceup()
end
function c98781564.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c98781564.filter(chkc) end
if chk==0 then return e:GetHandler():GetFlagEffect(98781564)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c98781564.filter,tp,1,LOCATION_MZONE,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c98781564.filter,tp,1,LOCATION_MZONE,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
e:GetHandler():RegisterFlagEffect(98781564,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c98781564.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
if not tc:IsRelateToEffect(e) or not c98781564.filter(tc) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
if not Duel.Equip(tp,c,tc,false) then return end
c:SetStatus(STATUS_UNION,true)
end
function c98781564.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(98781564)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():RegisterFlagEffect(98781564,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c98781564.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_ATTACK)
end
end
function c98781564.decon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_LOST_TARGET) and e:GetHandler():GetPreviousEquipTarget():IsReason(REASON_BATTLE)
end
function c98781564.detg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c98781564.deop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function c98781564.copycon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
c:GetOriginalCode()
return c:IsRelateToBattle()
end
function c98781564.copyop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local code=e:GetLabel()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(code)
c:CopyEffect(code,nil,1)
c:RegisterEffect(e1)
end
end

all until e6 works fine

_________________
Not the best at scripting, but will help if I can. Really busy lately tho :/


Youtube Channel

Dark Army vs Elemental Dragons

Planned Archetypes:
-Persona Card
-Dark Army
-Elemental Dragons
-END (tons and tons of cards made in card maker)
-Chained Dragons (lost in a computer meltdown, will redo eventually)
-RWBY (thinking of making these)
Back to top Go down
View user profile http://www.pokecommunity.com/member.php?u=364458
jackmoonward

avatar
Admin
Admin

Posts : 75
Join date : 2013-08-03
Age : 20
Location : Classified

PostSubject: Re: CallCodeFunction   Wed Aug 28, 2013 2:23 am

Your original effect was a bit messy but here ya go:

--Diabound Kernel
function c98781564.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(98781564,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c98781564.eqtg)
e1:SetOperation(c98781564.eqop)
c:RegisterEffect(e1)
--unequip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(98781564,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetTarget(c98781564.sptg)
e2:SetOperation(c98781564.spop)
c:RegisterEffect(e2)
--atkdown
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(-1800)
c:RegisterEffect(e3)
--eqlimit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_EQUIP_LIMIT)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetValue(c98781564.eqlimit)
c:RegisterEffect(e4)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(98781564,1))
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(c98781564.decon)
e5:SetTarget(c98781564.detg)
e5:SetOperation(c98781564.deop)
c:RegisterEffect(e5)
--copy
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(88071625,1))
e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e6:SetRange(LOCATION_MZONE)
e6:SetCode(EVENT_BATTLE_DESTROYING)
e6:SetTarget(c98781564.copycon)
e6:SetOperation(c98781564.copyop)
c:RegisterEffect(e6)
end
function c98781564.repval(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
function c98781564.eqlimit(e,c)
return c:IsFaceup()
end
function c98781564.filter(c)
    return c:IsFaceup()
end
function c98781564.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
    if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c98781564.filter(chkc) end
    if chk==0 then return e:GetHandler():GetFlagEffect(98781564)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
        and Duel.IsExistingTarget(c98781564.filter,tp,0,LOCATION_MZONE,1,e:GetHandler()) end
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
    local g=Duel.SelectTarget(tp,c98781564.filter,tp,0,LOCATION_MZONE,1,1,e:GetHandler())
    Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
    e:GetHandler():RegisterFlagEffect(98781564,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c98781564.eqop(e,tp,eg,ep,ev,re,r,rp)
    local c=e:GetHandler()
    local tc=Duel.GetFirstTarget()
    if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
    if not tc:IsRelateToEffect(e) or not c98781564.filter(tc) then
        Duel.SendtoGrave(c,REASON_EFFECT)
        return
    end
    if not Duel.Equip(tp,c,tc,false) then return end
end
function c98781564.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(98781564)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:GetHandler():RegisterFlagEffect(98781564,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1)
end
function c98781564.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_ATTACK)
end
end
function c98781564.decon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_LOST_TARGET) and e:GetHandler():GetPreviousEquipTarget():IsReason(REASON_BATTLE)
end
function c98781564.detg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c98781564.deop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function c98781564.copycon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsRelateToBattle() and c:IsFaceup()
end
function c98781564.copyop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local code=c:GetBattleTarget():GetOriginalCode()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local reset_flag=RESET_EVENT+0x1fe0000
c:CopyEffect(code, reset_flag, 1)
end
end

_________________
Jackpro! The only YGOPro anime mod with Alchemy Beasts, Armor monsters, Valkyries, and more! Download at www.tehmadhouse.tk

My YouTube: www.youtube.com/user/jackmoonward
Back to top Go down
View user profile http://www.tehmadhouse.tk
Project Leviamon

avatar


Member Title : Busy with high school sadly
Posts : 320
Join date : 2013-08-03
Age : 18
Location : Digital World

PostSubject: Re: CallCodeFunction   Wed Aug 28, 2013 11:48 am

at first id didn't work but removing local reset_flag=RESET_EVENT+0x1fe0000 in your script seemed to work.

thanks jack

and can you look at this, i have been trying to get it to work for a few days now. 

When this card is sent from your deck to the graveyard, target 1 monster on the field, if it is your monster it's attack is doubled, if it is your opponent's monster it's attack is halved until the End Phase.

--stat
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c51244205.con)
e3:SetTarget(c51244205.target)
e3:SetOperation(c51244205.op)
c:RegisterEffect(e3)

function c51244205.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetPreviousLocation()==LOCATION_DECK
end
function c51244205.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE,LOCAITON_MZONE) and chkc:IsFaceup() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c51244205.op(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
if e:GetHandler():IsRelateToEffect(e) and rp~=1-tp then
e1:SetValue(tc:GetAttack()/2)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e1)
if e:GetHandler():IsRelateToEffect(e) and not rp~=tp then
e1:SetValue(tc:GetAttack()*2)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e1)
end
end
end
end

_________________
Not the best at scripting, but will help if I can. Really busy lately tho :/


Youtube Channel

Dark Army vs Elemental Dragons

Planned Archetypes:
-Persona Card
-Dark Army
-Elemental Dragons
-END (tons and tons of cards made in card maker)
-Chained Dragons (lost in a computer meltdown, will redo eventually)
-RWBY (thinking of making these)
Back to top Go down
View user profile http://www.pokecommunity.com/member.php?u=364458
jackmoonward

avatar
Admin
Admin

Posts : 75
Join date : 2013-08-03
Age : 20
Location : Classified

PostSubject: Re: CallCodeFunction   Wed Aug 28, 2013 9:54 pm

I don't understand the card that well. Does it means if you target a card on your side of the field or under your control or ownership? And same with the opponent's monsters.

Also I'll look in to it later.

~Jack

_________________
Jackpro! The only YGOPro anime mod with Alchemy Beasts, Armor monsters, Valkyries, and more! Download at www.tehmadhouse.tk

My YouTube: www.youtube.com/user/jackmoonward
Back to top Go down
View user profile http://www.tehmadhouse.tk
jackmoonward

avatar
Admin
Admin

Posts : 75
Join date : 2013-08-03
Age : 20
Location : Classified

PostSubject: Re: CallCodeFunction   Wed Aug 28, 2013 10:01 pm

Also the reset flag is there so that when it leaves the field and comes back it won't have the effects that is stole. You are gonna run in to issues without it.

~Jack

_________________
Jackpro! The only YGOPro anime mod with Alchemy Beasts, Armor monsters, Valkyries, and more! Download at www.tehmadhouse.tk

My YouTube: www.youtube.com/user/jackmoonward
Back to top Go down
View user profile http://www.tehmadhouse.tk
Project Leviamon

avatar


Member Title : Busy with high school sadly
Posts : 320
Join date : 2013-08-03
Age : 18
Location : Digital World

PostSubject: Re: CallCodeFunction   Wed Aug 28, 2013 10:30 pm

with the reset flag it didn't get the effects at all. and i think Diabound is supposed to keep the effects even when it leaves the field like it did in the anime, but possibly make it reset if sent to hand,deck,graveyard or is banished, so when it equips with it's effect it won't lose them

_________________
Not the best at scripting, but will help if I can. Really busy lately tho :/


Youtube Channel

Dark Army vs Elemental Dragons

Planned Archetypes:
-Persona Card
-Dark Army
-Elemental Dragons
-END (tons and tons of cards made in card maker)
-Chained Dragons (lost in a computer meltdown, will redo eventually)
-RWBY (thinking of making these)
Back to top Go down
View user profile http://www.pokecommunity.com/member.php?u=364458
jackmoonward

avatar
Admin
Admin

Posts : 75
Join date : 2013-08-03
Age : 20
Location : Classified

PostSubject: Re: CallCodeFunction   Thu Aug 29, 2013 12:22 am

It worked perfectly fine with the flag when I tried it and I'm just going off of the logic that Phantom of Chaos follows..

And in the anime it didn't keep the effects for say but as an actual duel spirit it gained the effects like Blue-Eyes White Dragon's "White Lightning attack".

Also your logic is a bit screwy, if it hits the deck or even hand, etc it loses the abilities but when it literally dies and gets sent to it's grave it doesn't forget it's abilities?

~Jack

_________________
Jackpro! The only YGOPro anime mod with Alchemy Beasts, Armor monsters, Valkyries, and more! Download at www.tehmadhouse.tk

My YouTube: www.youtube.com/user/jackmoonward
Back to top Go down
View user profile http://www.tehmadhouse.tk
Project Leviamon

avatar


Member Title : Busy with high school sadly
Posts : 320
Join date : 2013-08-03
Age : 18
Location : Digital World

PostSubject: Re: CallCodeFunction   Thu Aug 29, 2013 2:58 am

no i mean when it's moved to s/t zone and then summoned back it doesn't forget the abilities, but if it is sent anywhere else it loses them if that is possible however

as for the script i posted(and overlooked in the next reply), outlaw showed me a way around it but i got a new problem. the effect is when the card is sent from your deck  to graveyard you can either target 1 monster you control and double it's attack or target 1 monster your opponent controls and halve it's attack (similar to cards that have 2 effects, but only activate one). the problem is i can't get it to get the second target

--stat
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_ATKCHANGE)
e1:SetDescription(aux.Stringid(51244205,0))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c51244205.con)
e3:SetTarget(c51244205.target)
e3:SetOperation(c51244205.op)
c:RegisterEffect(e3)
function c51244205.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetPreviousLocation()==LOCATION_DECK
end
function c51244205.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,51244205)==0 end
local opt=0
local c=e:GetHandler()
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
local b2=c:IsAbleToHand()
if b1 and b2 then
opt=Duel.SelectOption(tp,aux.Stringid(51244205,2),aux.Stringid(51244205,1))+1
elseif b1 then
opt=Duel.SelectOption(tp,aux.Stringid(51244205,2))+1
elseif b2 then
opt=Duel.SelectOption(tp,aux.Stringid(51244205,1))+2
end
e:SetLabel(opt)
if opt==1 then
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCAITON_MZONE,0) and chkc:IsFaceup() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
elseif opt==2 then
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(0,LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
else
e:SetCategory(0)
end
end
function c51244205.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if e:GetLabel()==1 then
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(tc:GetAttack()*2)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e1)
elseif e:GetLabel()==2 then
if c:IsRelateToEffect(e) then
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_ATTACK_FINAL)
e2:SetValue(tc:GetAttack()/2)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e2)
end
end
end
end

_________________
Not the best at scripting, but will help if I can. Really busy lately tho :/


Youtube Channel

Dark Army vs Elemental Dragons

Planned Archetypes:
-Persona Card
-Dark Army
-Elemental Dragons
-END (tons and tons of cards made in card maker)
-Chained Dragons (lost in a computer meltdown, will redo eventually)
-RWBY (thinking of making these)


Last edited by Project Leviamon on Thu Aug 29, 2013 3:00 am; edited 1 time in total (Reason for editing : a random bug auto posted this without the script)
Back to top Go down
View user profile http://www.pokecommunity.com/member.php?u=364458
outlaw1994

avatar
Admin
Admin

Member Title : Red-Eyes Lord
Posts : 797
Join date : 2013-07-09
Age : 23
Location : bundaberg qld australia

PostSubject: Re: CallCodeFunction   Thu Aug 29, 2013 12:03 pm

I will take a look once i get home on iphone atm
Back to top Go down
View user profile http://mackpro.userboard.net
Project Leviamon

avatar


Member Title : Busy with high school sadly
Posts : 320
Join date : 2013-08-03
Age : 18
Location : Digital World

PostSubject: Re: CallCodeFunction   Thu Aug 29, 2013 12:03 pm

ok, tnx

_________________
Not the best at scripting, but will help if I can. Really busy lately tho :/


Youtube Channel

Dark Army vs Elemental Dragons

Planned Archetypes:
-Persona Card
-Dark Army
-Elemental Dragons
-END (tons and tons of cards made in card maker)
-Chained Dragons (lost in a computer meltdown, will redo eventually)
-RWBY (thinking of making these)
Back to top Go down
View user profile http://www.pokecommunity.com/member.php?u=364458
outlaw1994

avatar
Admin
Admin

Member Title : Red-Eyes Lord
Posts : 797
Join date : 2013-07-09
Age : 23
Location : bundaberg qld australia

PostSubject: Re: CallCodeFunction   Thu Aug 29, 2013 1:21 pm

try this i havent tested it yet

--stat
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_ATKCHANGE)
e1:SetDescription(aux.Stringid(51244205,0))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c51244205.con)
e3:SetTarget(c51244205.target)
e3:SetOperation(c51244205.op)
c:RegisterEffect(e3)
function c51244205.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetPreviousLocation()==LOCATION_DECK
end
function c51244205.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local opt=0
local c=e:GetHandler()
local b1=Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil)--check for monster on your field
local b2=Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil)--check for monster on opponents field
if b1 and b2 then--if there is a monster on both side of the field give a choice
opt=Duel.SelectOption(tp,aux.Stringid(51244205,2),aux.Stringid(51244205,1))
elseif b1 then--if only monster on your field set opt to 0
opt=0
elseif b2 then--if only monster on your opponents field set opt to 1
opt=1
end
e:SetLabel(opt)
if opt==0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
elseif opt==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
end
end
end
end
end
function c51244205.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if e:GetLabel()==0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(tc:GetAttack()*2)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e1)
elseif e:GetLabel()==1 then
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_ATTACK_FINAL)
e2:SetValue(tc:GetAttack()/2)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e2)
end
end
end
Back to top Go down
View user profile http://mackpro.userboard.net
Project Leviamon

avatar


Member Title : Busy with high school sadly
Posts : 320
Join date : 2013-08-03
Age : 18
Location : Digital World

PostSubject: Re: CallCodeFunction   Thu Aug 29, 2013 1:30 pm

tnx it works

_________________
Not the best at scripting, but will help if I can. Really busy lately tho :/


Youtube Channel

Dark Army vs Elemental Dragons

Planned Archetypes:
-Persona Card
-Dark Army
-Elemental Dragons
-END (tons and tons of cards made in card maker)
-Chained Dragons (lost in a computer meltdown, will redo eventually)
-RWBY (thinking of making these)
Back to top Go down
View user profile http://www.pokecommunity.com/member.php?u=364458
Sponsored content





PostSubject: Re: CallCodeFunction   

Back to top Go down
 

CallCodeFunction

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

Permissions in this forum:You cannot reply to topics in this forum
Mackpro :: MackPro :: Custom Card Ruling and Bugs-