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
 
HomePortalLatest imagesSearchRegisterLog in

Share
 

 Problem with scripting

View previous topic View next topic Go down 
Go to page : 1, 2  Next
AuthorMessage
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Problem with scripting   Problem with scripting Icon_minitimeThu 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:

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?
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeThu 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. 
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeFri 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... Sad
Back to top Go down
StormWing0




Member Title : Over Creative Card Ideas
Posts : 451
Join date : 2013-07-14
Age : 32
Location : Tacoma, WA

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeFri Oct 31, 2014 5:19 am

You sure nothing else took that ID?
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeFri 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... ^^
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeFri Oct 31, 2014 6:00 pm

°.° oh sorry, didn't see that...
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeFri 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:

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
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeFri 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. Wink

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. ^^
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSat 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.

Problem with scripting PFQrp7Y
Back to top Go down
TGAP-Trixie

TGAP-Trixie


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSat 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 Razz.

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)
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSat Nov 01, 2014 4:44 pm

Thanks for the tips, Trixie. I'll see it right there.
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSun 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^^
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeTue 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:
Back to top Go down
AoO

AoO


Member Title : Noob4ever
Posts : 241
Join date : 2014-04-25
Location : I only know that it is dark :/

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeTue Nov 11, 2014 4:05 pm

You forgot to put 'local e5.Effect.CreateEffect(c)' ahead of your declaration.
Back to top Go down
TGAP-Trixie

TGAP-Trixie


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeWed 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.
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeFri 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:

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:
Back to top Go down
TGAP-Trixie

TGAP-Trixie


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSat Nov 15, 2014 2:49 am

Try the effect of blizzard princess for the first one (just clone for flip and SS success)
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSat Nov 15, 2014 4:47 am

Thank you very much, Trixie. And the other one, any idea or hint???
Back to top Go down
cane_63106

cane_63106


Member Title : D.D. Dragon Kaiser
Posts : 454
Join date : 2013-07-23
Location : St. Louis, MO

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSun 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.
Back to top Go down
http:// https://www.youtube.com/user/cane63106/videos
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeSun 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:

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:

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:


AoO, Trixie, anyone... save my cards!!! Crying or Very sad


Last edited by KitoMP on Fri Nov 21, 2014 5:42 pm; edited 1 time in total
Back to top Go down
TGAP-Trixie

TGAP-Trixie


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeTue 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
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeTue 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:
Back to top Go down
TGAP-Trixie

TGAP-Trixie


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeWed 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
Back to top Go down
KitoMP




Member Title : Ilune Warrior
Posts : 20
Join date : 2014-10-26

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeMon 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:

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:

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:

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.
Back to top Go down
TGAP-Trixie

TGAP-Trixie


Member Title : Trixie does not even...
Posts : 273
Join date : 2014-04-17

Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitimeTue 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
Back to top Go down
Sponsored content





Problem with scripting Empty
PostSubject: Re: Problem with scripting   Problem with scripting Icon_minitime

Back to top Go down
 

Problem with scripting

View previous topic View next topic Back to top 
Page 1 of 2Go to page : 1, 2  Next

 Similar topics

-
» Facing a little custom card problem
» New problem
» I have a problem with Mackpro
» I need help scripting .
» I need help scripting 4 cards .

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