| | |
Author | Message |
---|
KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Problem with scripting Thu Oct 30, 2014 6:51 pm | |
| Well, I'm starting to script my cards, but I can't just get this one working. The effect of the card is: "2 Level 4 Mystical monsters Once per turn: You can detach 1 Xyz Material from this card to target 1 face-up Spell/Trap card on the field; destroy it. In addition, if 'Mystical Star Night' is face-up on the field: target 1 "Mystical" monster in your Graveyard; shuffle it into your Main Deck." And here is the script: - Spoiler:
--Irkex the Mystical Lost Son function c999900009.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,aux.XyzFilterFunctionF(c,aux.FilterBoolFunction(Card.IsSetCard,0x22b),4),2) c:EnableReviveLimit() --destroy s/t local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(c999900009.cost) e1:SetTarget(c999900009.target) e1:SetOperation(c999900009.operation) c:RegisterEffect(e1) --back to deck local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCondition(c999900009.condition) e2:SetTarget(c999900009.dtarget) e2:SetOperation(c999900009.doperation) c:RegisterEffect(e2) end function c999900009.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 c999900009.filter(c) return c:IsFaceup() and c:IsDestructable() and c:IsType(TYPE_SPELL+TYPE_TRAP) end function c999900009.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c999900009.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c999900009.filter,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c999900009.filter,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c999900009.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function c999900009.filter1(c) return c:IsSetCard(0x22b) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() end function c999900009.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsEnvironment(999900019) end function c999900009.dtarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c999900009.filter1(chkc) end if chk==0 then return Duel.IsExistingTarget(c999900009.filter1,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,c999900009.filter1,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function c999900009.doperation(e,tp,eg,ep,ev,re,r,rp) local ex,g=Duel.GetOperationInfo(0,CATEGORY_TODECK) if g:IsRelateToEffect(e) then Duel.SendtoDeck(g,nil,2,REASON_EFFECT) Duel.ShuffleDeck(tp) end
But I get three consecutive messages when a duel begins: "'CallCardFunction'(c999900009.initial_effect): attempt to call an error function" Where is the script error? |
| | | AoO
Member Title : Noob4ever Posts : 241 Join date : 2014-04-25 Location : I only know that it is dark :/
| Subject: Re: Problem with scripting Thu Oct 30, 2014 7:41 pm | |
| The script itself looks fine... Are you sure, that your card has the ID 999900009?? If your ID, that you have in your database for that card is different from the ID in the Script for the same card you get such an error. |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Fri Oct 31, 2014 4:56 am | |
| - AoO wrote:
- The script itself looks fine...
Are you sure, that your card has the ID 999900009?? If your ID, that you have in your database for that card is different from the ID in the Script for the same card you get such an error. Yes I do. My cards' Id are 9999000xx, so I can find them easier on pics, script and database. But I can't get that card working... |
| | | StormWing0
Member Title : Over Creative Card Ideas Posts : 451 Join date : 2013-07-14 Age : 32 Location : Tacoma, WA
| Subject: Re: Problem with scripting Fri Oct 31, 2014 5:19 am | |
| You sure nothing else took that ID? |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Fri Oct 31, 2014 5:45 pm | |
| - StormWing0 wrote:
- You sure nothing else took that ID?
No. And I found the problem. There was missing an "end" in one of the last functions... ^^ |
| | | AoO
Member Title : Noob4ever Posts : 241 Join date : 2014-04-25 Location : I only know that it is dark :/
| Subject: Re: Problem with scripting Fri Oct 31, 2014 6:00 pm | |
| °.° oh sorry, didn't see that... |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Fri Oct 31, 2014 8:00 pm | |
| Now I got another problem, guys. With this effect: "Discard 2 cards. Target 2 cards in your Graveyard; shuffle the first target into the Deck. Place the second target on the top of your Deck." And here is the script: - Spoiler:
--Shine of Opposite Auroras function c999900025.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c999900025.cost) e1:SetTarget(c999900025.target) e1:SetOperation(c999900025.operation) c:RegisterEffect(e1) end function c999900025.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,2,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,2,2,REASON_COST+REASON_DISCARD) end function c999900025.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,nil,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g2=Duel.SelectTarget(tp,nil,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,g2,1,0,0) end function c999900025.operation(e,tp,eg,ep,ev,re,r,rp) local ex,g1=Duel.GetOperationInfo(0,CATEGORY_TODECK) local ex,g2=Duel.GetOperationInfo(0,CATEGORY_TODECK) if g1:GetFirst():IsRelateToEffect(e) then Duel.SendtoDeck(g1,nil,2,REASON_EFFECT) end local tc=g2:GetFirst() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(g2,nil,0,REASON_EFFECT) end end
What happen is: when I select both targets, only one of them return to Deck, and not both. I think the one that returns is the second I select. Damn... scripting cards is so complicated T^T |
| | | AoO
Member Title : Noob4ever Posts : 241 Join date : 2014-04-25 Location : I only know that it is dark :/
| Subject: Re: Problem with scripting Fri Oct 31, 2014 10:47 pm | |
| - Quote :
Damn... scripting cards is so complicated T^T Not really, if you know what you are able to tipe in and especially when. If I would know that too if would able to script much faster and better^^' The only practice for now is, to look into scripts, try to experiment with them and see, what each parameter does. It also helps to know other programming languages so that constructions like "if -then" or "while-do" or the whole thing with the functions are more easily to understand. For your Script: Your mistake was, that you used 'GetFirst()' twice, so basically you taget one card (g1) twice and let the other one (g2) as it is. Sorry, but I took the right to change a little bit. You first select a target and shuffle it into your deck and then target another card and place it at the top. With that you won't be able to target one card and after that and that card again, if you are able to choose for the 2nd time. - Code:
-
--Shine of Opposite Auroras function c999900025.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c999900025.cost) e1:SetTarget(c999900025.target) e1:SetOperation(c999900025.operation) c:RegisterEffect(e1) end function c999900025.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,2,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,2,2,REASON_COST+REASON_DISCARD) end function c999900025.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,nil,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,1,0,0) end function c999900025.operation(e,tp,eg,ep,ev,re,r,rp) local ex,g1=Duel.GetOperationInfo(0,CATEGORY_TODECK) local ex,g2=Duel.GetOperationInfo(0,CATEGORY_TODECK) if g1:GetFirst():IsRelateToEffect(e) then Duel.SendtoDeck(g1,nil,0,REASON_EFFECT) end Duel.ShuffleDeck(tp) local g2=Duel.SelectTarget(tp,nil,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g2,1,0,0) if g2 then Duel.SendtoDeck(g2,nil,0,REASON_EFFECT) end end Oh and can you please post the picture for the card. I would like to use that card too, because it's pretty good. ^^ |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Sat Nov 01, 2014 5:01 am | |
| Thank you so much, AoO! Yes, I'm handling these stuff. I know what functions do, and even what their numbers do. Like in Duel.SendtoDeck(g2,nil,0,REASON_EFFECT) <- The number 0 place it at the top, and number 2 shuffle into the Deck. My main problem is connecting all effects. I got another one that I just can't make the second effect working. I remade its script 3 times and that heck doesn't work. I seriously need a tutor. Here is the card image. I remade the effect adding "if you do" like the other cards... Btw, I have an archetype and I'm scripting it. It contains 32 cards. It's one of the most famous posts at Yugiohcardmaker.net... If you want to help... I'd be grateful for life. |
| | | TGAP-Trixie
Member Title : Trixie does not even... Posts : 273 Join date : 2014-04-17
| Subject: Re: Problem with scripting Sat Nov 01, 2014 6:46 am | |
| AoO I didn't know that about the g2 thing. I usually just copy stuff. That should help for me to bother ppl less on the forums . Kito try the requests forum And as for a tutor, well for now I recommend at least checking out the constant.lua file in scripts (This latest release, they added some vague descriptions and hex codes which helps a little bit I guess. You won't memorize them all, but hopefully the more basic ones are the ones you'll reuse) |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Sat Nov 01, 2014 4:44 pm | |
| Thanks for the tips, Trixie. I'll see it right there. |
| | | AoO
Member Title : Noob4ever Posts : 241 Join date : 2014-04-25 Location : I only know that it is dark :/
| Subject: Re: Problem with scripting Sun Nov 02, 2014 7:18 pm | |
| - KitoMP wrote:
- Thank you so much, AoO!
Yes, I'm handling these stuff. I know what functions do, and even what their numbers do. Like in Duel.SendtoDeck(g2,nil,0,REASON_EFFECT) <- The number 0 place it at the top, and number 2 shuffle into the Deck.
My main problem is connecting all effects. I got another one that I just can't make the second effect working. I remade its script 3 times and that heck doesn't work. I seriously need a tutor.
Here is the card image. I remade the effect adding "if you do" like the other cards... Btw, I have an archetype and I'm scripting it. It contains 32 cards. It's one of the most famous posts at Yugiohcardmaker.net... If you want to help... I'd be grateful for life.
Np and thanks for the pic^^ It is also a problem for me to connect all these stuff to a script that work (yours took me nearly a hour) which is why trial and error is still necessary for me to script my cards. I'm not really sure whether I would be a big help for scripting an archetype, but when you have a problem, you can post it here^^ |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Tue Nov 11, 2014 3:58 pm | |
| Guys, can you help me with this effect? I get the error saying that "35: attempt to index global 'e5' (a nil value)" The effect is: "Cannot be Normal Summoned/Set. Must be Special Summoned from your hand by Tributing 3 "Mystical" Monsters you control and cannot be Special Summoned by other ways. If you don't control 1 face-up "Mystical Star Night", destroy this card. When Summoned: Until the End Phase your opponent cannot activate Spell or Trap Cards. Once per turn: You can target 1 "Mystical" Monster in your Graveyard; shuffle it into your Main Deck and inflict 400 damage to your opponent." And my script is: - Spoiler:
--ekrix the spirit of the mystical king function c999900007.initial_effect(c) --special proc local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c999900007.spcon) e1:SetOperation(c999900007.spop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e2) --selfdestroy local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_SZONE) e3:SetCode(EFFECT_SELF_DESTROY) e3:SetCondition(c999900007.descon) c:RegisterEffect(e3) --restrict spell local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e4:SetCode(EVENT_SUMMON_SUCCESS) e4:SetCondition(c999900007.regcon) e4:SetOperation(c999900007.regop) c:RegisterEffect(e4) --shuffling e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetCountLimit(1) e5:SetRange(LOCATION_MZONE) e5:SetTarget(c999900007.target) e5:SetOperation(c999900007.operation) c:RegisterEffect(e5) end function c999900007.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>-3 and Duel.CheckReleaseGroup(c:GetControler(),Card.IsSetCard,3,nil,0x22b) end function c999900007.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(c:GetControler(),Card.IsSetCard,3,3,nil,0x22b) Duel.Release(g,REASON_COST) end function c999900007.desfilter(c) return c:IsFaceup() and c:IsCode(999900019) end function c999900007.descon(e) return not Duel.IsExistingMatchingCard(c999900007.desfilter,e:GetHandler():GetControler(),LOCATION_SZONE,0,1,nil) end function c999900007.regcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_ADVANCE)==SUMMON_TYPE_ADVANCE and e:GetLabelObject():GetLabel()~=0 end function c999900007.regop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(0,1) e1:SetValue(c999900007.aclimit) e1:SetReset(RESET_PHASE+PHASE_END) e:GetHandler():RegisterEffect(e1) end function c999900007.aclimit(e,re,tp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) end function c999900007.filter(c) return c:IsSetCard(0x22b) end function c999900007.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsType(TYPE_MONSTER) end if chk==0 then return Duel.IsExistingTarget(c999900007.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,c999900007.filter,tp,LOCATION_GRAVE,0,1,1,nil) end
|
| | | AoO
Member Title : Noob4ever Posts : 241 Join date : 2014-04-25 Location : I only know that it is dark :/
| Subject: Re: Problem with scripting Tue Nov 11, 2014 4:05 pm | |
| You forgot to put 'local e5.Effect.CreateEffect(c)' ahead of your declaration. |
| | | TGAP-Trixie
Member Title : Trixie does not even... Posts : 273 Join date : 2014-04-17
| Subject: Re: Problem with scripting Wed Nov 12, 2014 4:55 am | |
| ^Yup Also c:EnableReviveLimit() apparently makes it so it can't be normal summoned... didn't see it in your script though. |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Fri Nov 14, 2014 6:19 pm | |
| Okay guys. Almost everything working on this card, except for the effect of "When Summoned: your opponent cannot activate Spell or Traps until the End Phase." I test it with an opponent setting mirror force, draining shields, negate attacks... and when this card attacks in the same turn that is Summoned, the opponent activate those traps. Updated script: - Spoiler:
--ekrix the spirit of the mystical king function c999900007.initial_effect(c) --limit summon c:EnableReviveLimit() --special proc local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c999900007.spcon) e1:SetOperation(c999900007.spop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e2) --selfdestroy local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_SELF_DESTROY) e3:SetCondition(c999900007.descon) c:RegisterEffect(e3) --restrict spell local e4=Effect.CreateEffect(c) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_SUMMON_SUCCESS) e4:SetOperation(c999900007.actlimit) c:RegisterEffect(e4) --shuffling local e5=Effect.CreateEffect(c) e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetCountLimit(1) e5:SetRange(LOCATION_MZONE) e5:SetTarget(c999900007.target) e5:SetOperation(c999900007.operation) c:RegisterEffect(e5) end function c999900007.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>-3 and Duel.CheckReleaseGroup(c:GetControler(),Card.IsSetCard,3,nil,0x22b) end function c999900007.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(c:GetControler(),Card.IsSetCard,3,3,nil,0x22b) Duel.Release(g,REASON_COST) end function c999900007.desfilter(c) return c:IsFaceup() and c:IsCode(999900019) end function c999900007.descon(e) return not Duel.IsExistingMatchingCard(c999900007.desfilter,e:GetHandler():GetControler(),LOCATION_SZONE,0,1,nil) end function c999900007.actlimit(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,1) e1:SetValue(c999900007.elimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function c999900007.elimit(e,re,tp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) end function c999900007.filter(c) return c:IsSetCard(0x22b) end function c999900007.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsType(TYPE_MONSTER) end if chk==0 then return Duel.IsExistingTarget(c999900007.filter,tp,LOCATION_GRAVE,0,1,nil) end local g=Duel.SelectTarget(tp,nil,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function c999900007.operation(e,tp,eg,ep,ev,re,r,rp) local ex,g=Duel.GetOperationInfo(0,CATEGORY_TODECK) if g:GetFirst():IsRelateToEffect(e) then Duel.SendtoDeck(g,nil,2,REASON_EFFECT) Duel.Damage(1-tp,400,REASON_EFFECT) end end
And I made this one today, but I only did its' first effect, and it's not working. The effect: "If this card is sent to the Graveyard as a Synchro Material Monster: you can Special Summon 1 DARK Monster from your Deck and pay its Level x 400 LP, then, if 'Mystical Star Night' is face-up on the field: You can pay 500 LP to shuffle this card into your Main Deck." Script: - Spoiler:
--Mellania function c999900013.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCondition(c999900013.condition) e1:SetTarget(c999900013.target) e1:SetOperation(c999900013.operation) c:RegisterEffect(e1) end function c999900013.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO end function c999900013.filter(c,e,tp) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c999900013.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c999900013.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c999900013.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c999900013.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) Duel.Damage(tp,g:GetLevel()*400,REASON_EFFECT) end end
|
| | | TGAP-Trixie
Member Title : Trixie does not even... Posts : 273 Join date : 2014-04-17
| Subject: Re: Problem with scripting Sat Nov 15, 2014 2:49 am | |
| Try the effect of blizzard princess for the first one (just clone for flip and SS success) |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Sat Nov 15, 2014 4:47 am | |
| Thank you very much, Trixie. And the other one, any idea or hint??? |
| | | cane_63106
Member Title : D.D. Dragon Kaiser Posts : 454 Join date : 2013-07-23 Location : St. Louis, MO
| Subject: Re: Problem with scripting Sun Nov 16, 2014 7:23 am | |
| for the special summoning part:
maybe just copy a monster that special summons an "x" monster, have that card's location to be grave, have the condition to be the same, then change "x" to DARK. that's the first combo i could think of off the top of my head. |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Sun Nov 16, 2014 9:23 pm | |
| Okay, now I got three different cards here. One of them I got so many error and changed it so many times that I gave up. The other I made it right now but it's not working properly. And the other one, I have no idea of how to do it... First card: "Cannot be Special Summoned. You can Tribute 2 monsters to Tribute Summon this card. If you do, activate 1 of the following effects: ● Add 2 "Mystical" Monsters from your Deck or Graveyard to your hand. ● Target 1 Monster Card and 1 Spell/Trap Card your opponent controls; destroy them." Script: - Spoiler:
--wanda function c999900032.initial_effect(c) --Summon Proc local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(c999900032.ttcon) e1:SetOperation(c999900032.ttop) e1:SetValue(SUMMON_TYPE_ADVANCE+1) c:RegisterEffect(e1) --effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetCondition(c999900032.condition) e2:SetTarget(c999900032.target) e2:SetOperation(c999900032.operation) c:RegisterEffect(e2) end function c999900032.ttcon(e,c) if c==nil then return true end return Duel.GetTributeCount(c)>=1 end function c999900032.ttop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g=Duel.SelectTribute(tp,c,3,3) c:SetMaterial(g) Duel.Release(g, REASON_SUMMON+REASON_MATERIAL) end function c999900032.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_ADVANCE+1 end function c999900032.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local opt=Duel.SelectOption(tp,aux.Stringid(999900032,1),aux.Stringid(999900032,2)) e:SetLabel(opt) end function c999900032.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end if e:GetLabel()==0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c999900032.target1) e1:SetOperation(c999900032.operation1) c:RegisterEffect(e1) else local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c999900032.tg2) e1:SetOperation(c999900032.op2) c:RegisterEffect(e1) end end function c999900032.filter(c) return c:IsSetCard(0x22b) and c:IsAbleToHand() and c:IsType(TYPE_MONSTER) end function c999900032.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c999900032.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,2,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK+LOCATION_GRAVE) end function c999900032.operation(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(c999900032.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,nil) if sg:GetCount()<2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=sg:Select(tp,2,2,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end function c999900032.filter1(c) return c:IsDestructable() and Duel.IsExistingTarget(c999900032.filter2,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end function c999900032.filter2(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable() end function c999900032.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c999900032.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,c999900032.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,c999900032.filter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst()) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0) end function c999900032.desop(e) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local dg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.Destroy(dg,REASON_EFFECT) end
I forgot the "Cannot be Special Summoned" functions. What happens? When I start to summon her, it appears two options: "Normal Summon" and "???". If "Normal Summon" is selected, I tribute 1 monster and she is Summoned. If I select "???", it asks for 3 tributes and then she is summoned and her effect activated. It should appear an option window, but it doesn't appear. The first is activated directly. Second card: "Target 5 "Mystical" Monsters in your Graveyard; shuffle all 5 into the Deck. Then shuffle all cards from your hand into the Deck; draw the same number of cards." Script: - Spoiler:
--mystical aura of renovation function c999900015.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c999900015.target) e1:SetOperation(c999900015.activate) c:RegisterEffect(e1) end function c999900015.filter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x22b) and c:IsAbleToDeck() end function c999900015.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c67169062.filter(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,2) and Duel.IsExistingTarget(c999900015.filter,tp,LOCATION_GRAVE,0,5,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,c999900015.filter,tp,LOCATION_GRAVE,0,5,5,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) end function c999900015.activate(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=5 then return end Duel.SendtoDeck(tg,nil,0,REASON_EFFECT) local g=Duel.GetOperatedGroup() local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA) if ct==5 then Duel.ShuffleDeck(tp) end if g:IsRelateToEffect(e) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetTarget(c999900015.targ2) e2:SetOperation(c999900015.act2) c:RegisterEffect(e2) end end function c999900015.targ2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp) and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c999900015.act2(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local g=Duel.GetFieldGroup(p,LOCATION_HAND,0) if g:GetCount()==0 then return end Duel.SendtoDeck(g,nil,2,REASON_EFFECT) Duel.ShuffleDeck(p) Duel.BreakEffect() Duel.Draw(p,g:GetCount(),REASON_EFFECT) end
What happens? A lot of errors has appeared until now. But when I activate that card, I can select all 5 targets at the Graveyard. Then they are shuffled into the Deck and it stops by any error. Third card: "Only "Mystical" Monsters can be equipped with this card. The equipped monster gains 400 ATK. If the equipped monster attacks your opponent directly: Both players discard 1 card, shuffle 1 card from Graveyard into the Deck and draw 1 card." I have no idea of how to make the highlighted effect. What I have for now is: - Spoiler:
--mystical sword function c999900031.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(c999900031.target) e1:SetOperation(c999900031.operation) c:RegisterEffect(e1) --Atk up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(400) 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(c999900031.eqlimit) c:RegisterEffect(e3) --discard, todeck, draw end function c999900031.eqlimit(e,c) return c:IsSetCard(0x22b) end function c999900031.filter(c) return c:IsFaceup() and c:IsSetCard(0x22b) end function c999900031.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c999900031.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c999900031.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,c999900031.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function c999900031.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,e:GetHandler(),tc) end end
AoO, Trixie, anyone... save my cards!!!
Last edited by KitoMP on Fri Nov 21, 2014 5:42 pm; edited 1 time in total |
| | | TGAP-Trixie
Member Title : Trixie does not even... Posts : 273 Join date : 2014-04-17
| Subject: Re: Problem with scripting Tue Nov 18, 2014 5:24 am | |
| Again I'm not sure how to do "then" effects unless it exists in another script.
ttop function asks for 3, or you set it to 3 rather. And I'm guessing it's level 5-6 so normal summoning with 1 tribute is normal?
For ??? you can set a description and edit it in sqlite, by adding in texts in the strings (for example, and I'm a little rusty, haven't coded anything for almost a week cause ygopro is having some compatibility issues and it's too slow to play to test, but e1:SetDescription(999900032,0). When you edit it in sqlite (edit string 1 or whatever you set the description to +1), if you put "Tribute summon using 2 monsters?" or something of the like, it should show up.
And FYI if you're copying an effect and it has a description, if it's not totally necessary, you can just delete that line if it bothers you. But if it has like 2 effects that you can activate from the field once per turn, you definitely need them.
And idk much, so if summon_type_whatever_+1 is a thing, then it should work. Still, check out beast king barbaros I'd say, he gets an effect that checks if he was summoned by tributing 3 monsters, otherwise no effect.
The shuffle one, you have to be more specific as to what the errors say |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Tue Nov 18, 2014 6:17 pm | |
| - TGAP-Trixie wrote:
- Again I'm not sure how to do "then" effects unless it exists in another script.
ttop function asks for 3, or you set it to 3 rather. And I'm guessing it's level 5-6 so normal summoning with 1 tribute is normal?
For ??? you can set a description and edit it in sqlite, by adding in texts in the strings (for example, and I'm a little rusty, haven't coded anything for almost a week cause ygopro is having some compatibility issues and it's too slow to play to test, but e1:SetDescription(999900032,0). When you edit it in sqlite (edit string 1 or whatever you set the description to +1), if you put "Tribute summon using 2 monsters?" or something of the like, it should show up.
And FYI if you're copying an effect and it has a description, if it's not totally necessary, you can just delete that line if it bothers you. But if it has like 2 effects that you can activate from the field once per turn, you definitely need them.
And idk much, so if summon_type_whatever_+1 is a thing, then it should work. Still, check out beast king barbaros I'd say, he gets an effect that checks if he was summoned by tributing 3 monsters, otherwise no effect.
The shuffle one, you have to be more specific as to what the errors say Thanks, Trixie. Somethings worked up. The tribute summon is now asking for 2, as expected. But I added the texts in the strings of cards database, added the functions of description, but the option window still show "Normal Summon" and "???". And still her first effect is activated, and the window to choose the first or the second still doesn't appear. Here is the script updated: - Spoiler:
--wanda function c999900032.initial_effect(c) --Summon Proc local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(999900032,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(c999900032.ttcon) e1:SetOperation(c999900032.ttop) e1:SetValue(SUMMON_TYPE_ADVANCE+1) c:RegisterEffect(e1) --effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetCondition(c999900032.condition) e2:SetTarget(c999900032.target) e2:SetOperation(c999900032.operation) c:RegisterEffect(e2) end function c999900032.ttcon(e,c) if c==nil then return true end return Duel.GetTributeCount(c)>=1 end function c999900032.ttop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g=Duel.SelectTribute(tp,c,2,2) c:SetMaterial(g) Duel.Release(g, REASON_SUMMON+REASON_MATERIAL) end function c999900032.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_ADVANCE+1 end function c999900032.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local opt=Duel.SelectOption(tp,aux.Stringid(999900032,1),aux.Stringid(999900032,2))+1 e:SetLabel(opt) end function c999900032.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end if e:GetLabel()==1 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c999900032.target1) e1:SetOperation(c999900032.operation1) c:RegisterEffect(e1) else if e:GetLabel()==2 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c999900032.tg2) e1:SetOperation(c999900032.op2) c:RegisterEffect(e1) end end end function c999900032.filter(c) return c:IsSetCard(0x22b) and c:IsAbleToHand() and c:IsType(TYPE_MONSTER) end function c999900032.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c999900032.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,2,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK+LOCATION_GRAVE) end function c999900032.operation(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(c999900032.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,nil) if sg:GetCount()<2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=sg:Select(tp,2,2,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end function c999900032.filter1(c) return c:IsDestructable() and Duel.IsExistingTarget(c999900032.filter2,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end function c999900032.filter2(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable() end function c999900032.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c999900032.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,c999900032.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,c999900032.filter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst()) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0) end function c999900032.desop(e) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local dg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.Destroy(dg,REASON_EFFECT) end
|
| | | TGAP-Trixie
Member Title : Trixie does not even... Posts : 273 Join date : 2014-04-17
| Subject: Re: Problem with scripting Wed Nov 19, 2014 3:15 am | |
| e1:SetDescription(aux.Stringid(999900032,0)) is what it was. I think that's how it knows to check the strings |
| | | KitoMP
Member Title : Ilune Warrior Posts : 20 Join date : 2014-10-26
| Subject: Re: Problem with scripting Mon Dec 08, 2014 8:27 pm | |
| I got three cards with their effects not working properly. "Spior the Mystical Warrior" ID:999900027 Effect: "This card is sent to the Graveyard during the End Phase it was Summoned. During your next Standby Phase after this card's activation, shuffle this card from your Graveyard into your Deck and draw 1 card." Script: - Spoiler:
--spior function c999900027.initial_effect(c) --to grave local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_SUMMON) e1:SetOperation(c999900027.desop) c:RegisterEffect(e1) --to deck local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_GRAVE) e2:SetCode(EVENT_PHASE+PHASE_STANDBY) e2:SetCountLimit(1) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,2) e2:SetTarget(c999900027.gravetg) e2:SetOperation(c999900027.graveop) e2:SetLabel(0) c:RegisterEffect(e2) end function c999900027.desop(e,tp,eg,ep,ev,re,r,rp,c) --to grave local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetTarget(c999900027.tgtg) e1:SetOperation(c999900027.tgop) e1:SetReset(RESET_EVENT+0xc6e0000) c:RegisterEffect(e1) end function c999900027.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0) end function c999900027.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.SendtoGrave(c,REASON_EFFECT) end end function c999900027.gravetg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0) end function c999900027.graveop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoDeck(c,REASON_EFFECT) Duel.Draw(tp,1,REASON_EFFECT) end end
What happens? The effect is not working. When it's Summoned, nothing happens. Second card: "Tessalia the Mystical Sorceress" ID:999900028 Effect: "This card can attack your opponent directly. When this card successfully attacks directly, activate 1 of the following effects: ● Negate the attack; target 1 face-up monster on the field; destroy it. ● Tribute 1 monster and inflict double damage calculated." Script: - Spoiler:
--Tessalia the Mystical Sorceress function c999900028.initial_effect(c) --direct attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(999900028,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_DAMAGE) e2:SetCondition(c999900028.condition) e2:SetTarget(c999900028.target) e2:SetOperation(c999900028.operation) c:RegisterEffect(e2) end function c999900028.condition(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and r==REASON_BATTLE and Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget()==nil end function c999900028.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(Card.IsDestructable,1-tp,0,LOCATION_MZONE,1,nil) or Duel.CheckReleaseGroup(tp,nil,1,e:GetHandler()) end local op=0 Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(999900028,0)) if Duel.IsExistingTarget(nil,tp,0,LOCATION_aMZONE,1,nil) then op=Duel.SelectOption(tp,aux.Stringid(999900028,1),aux.Stringid(999900028,2)) end e:SetLabel(op) if op==0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsDestructable,1-tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tp,1,0,0) e:SetProperty(EFFECT_FLAG_CARD_TARGET) else Duel.SetOperationInfo(0,CATEGORY_NEGATE,0,0,g,1) e:SetProperty(0) end end function c999900028.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.SelectReleaseGroup(tp,nil,1,1,e:GetHandler()) if e:GetLabel()==0 then local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,nil,0,REASON_EFFECT) end else Duel.Release(g,REASON_COST) Duel.ChangeBattleDamage(ep,ev*2) end end
What happens? There are some missing things, but her effect is not working. The direct attack works, but the effect caused by the direct attack doesn't works. Third card: "Skar the Mystical Blue Dragon" ID:999900026 Effect: "You can Ritual Summon this card with "Dragon Horn of Mysticism". When Ritual Summoned: Your opponent discards all Spell and Trap Cards." Script: - Spoiler:
--Skar the Mystical Blue Dragon function c999900026.initial_effect(c) c:EnableReviveLimit() --discard local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c999900026.condition) e1:SetOperation(c999900026.operation) c:RegisterEffect(e1) end function c999900026.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_RITUAL and ep==tp end function c999900026.filter(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) end function c999900026.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(c999900026.filter,0,LOCATION_HAND) if g:GetCount()>0 then Duel.SendtoGrave(g,REASON_DISCARD+REASON_EFFECT) end end
What happens? I don't know when this is triggered, but sometimes, I'M THE ONE WHO DISCARDS. It shouldn't be me, but the opponent. And another thing. When the player discards, it discards everything, not only Spell and Traps as it should. |
| | | TGAP-Trixie
Member Title : Trixie does not even... Posts : 273 Join date : 2014-04-17
| Subject: Re: Problem with scripting Tue Dec 09, 2014 1:48 am | |
| For the 3rd one try this
function cxxxxxxxx.initial_effect(c) c:EnableReviveLimit() --handdes local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_HANDDES+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(cxxxxxxxx.condition) e1:SetTarget(cxxxxxxxx.target) e1:SetOperation(cxxxxxxxx.operation) c:RegisterEffect(e1) end function cxxxxxxxx.condition(e,tp,eg,ep,ev,re,r,rp) return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL end function cxxxxxxxx.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_HAND) end function cxxxxxxxx.operation(e,tp,eg,ep,ev,re,r,rp) local g1=Duel.GetFieldGroup(tp,0,LOCATION_HAND) Duel.ConfirmCards(1-tp,g1) local dg1=g1:Filter(Card.IsType,nil,TYPE_SPELL+TYPE_TRAP) if dg1:GetCount()>0 then Duel.SendtoGrave(dg1,REASON_EFFECT+REASON_DISCARD) end Duel.ShuffleHand(1-tp) end
I haven't tried it, idk if it works |
| | | Sponsored content
| Subject: Re: Problem with scripting | |
| |
| | | |
Similar topics | |
|
| Permissions in this forum: | You cannot reply to topics in this forum
| |
| |
| Who is online? | In total there are 2 users online :: 0 Registered, 0 Hidden and 2 Guests None Most users ever online was 270 on Sun Apr 11, 2021 4:35 pm |
Latest topics | » Goodbye allMon Aug 08, 2016 7:53 pm by Zenas» [PLEASE READ] [VERY IMPORTANT] MACKPRO REVIVALMon Aug 08, 2016 7:47 pm by Zenas» D.D. Dragons vs KozmosSun Jul 10, 2016 11:02 pm by cane_63106» Where's everyone?!Sat May 28, 2016 2:58 am by cane_63106» Mech Archetype (crappy it be, maybe you guys would like it)Sun May 15, 2016 1:11 pm by barti02» My Assassin ArchetypeSun May 15, 2016 1:10 pm by barti02» SO I have a "NEW ARCHETYPE THE "WolfPack"Sun May 15, 2016 12:35 pm by barti02» Fusion monster doesn't appear in extra deck? Sat Apr 30, 2016 9:02 pm by Marc1» Mackpro update 10/6/2015Sat Apr 02, 2016 6:36 pm by Hulkty» Bionicle Cards AKA Japanese Children's Cardgames on Swedish Toy RobotsSun Mar 06, 2016 9:37 am by Utso |
|