Jump to content


Important Announcement!

Welcome to Tdoane's Official Forum!

Server Status:Online


Photo

Scripting Tutorial Card scripts


  • Please log in to reply
5 replies to this topic

#1 DarckMagiicianGirl

DarckMagiicianGirl

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationBosna and Hercegovina

Posted 17 December 2016 - 07:26 PM

Ok. I noticed a lot of people want to make their custom cards but a lot of them were unsuccessful. What I do is still the same as I started, by copy-pasting but I learned how to make the overall easier.

Let's start with the basics.
First, follow the first few instructions to add your card into the game.

 

 

NOTE: This Tutorial above is extremely outdated with the setcodes/ archetypes/ card type and doesn't contain about Categories.
Basically, I also use SQLite since it's kind of easier for me rather than using a Card Packer.

 

And due to the difficulty for adding an effective expansions format, I decided to include the template here for the ease of reusability. Basically, this includes the .cdb and .zip when extracted. The .cdb is the empty database while the .zip contains pics and scripts folders where the .jpg, .png and .lua files will be placed. For first timers, these files are to be placed in your expansions folder and rename them to anything to avoid accidental overwriting of files. Remember as well that in order to overwrite their contents or to apply changes, YGoPro must be closed. Plus, even if you update the official YGoPro game, you won't lose your Custom Cards.
Empty Expansions Template

 

And I'll only explain some of the things in the data in SQLite since text is easy to understand.
First of all, the concept in SQLite uses 2 number types. Decimal and Hexadecimal. Decimal is 0-9 which is the one we use and Hexadecimal is 0-F (A-F are equivalent to 10-15). SQLite can only read Decimal but its values are solely based on their Hexadecimal counterpart. By opening your Calculator (in Windows, a scientific calculator also works but I think the one in my laptop is easier), go to View and change it to Programmer (Alt+3 in my laptop, Windows 8). Now you see the Dec and Hex at the left side? That's where you gonna use the whole time.
In order to convert a hex value to decimal, simply copy-paste the sum (if any) of the hex values, then click on dec, now copy-paste that into your SQLite. --we'll use this the entire time!

First in my list is the setcode. The setcode is the archetype of your cards. Jackmoonward has explained this in his tutorial but it's all outdated. I cannot give you the complete list of archetype but I'll reshow you how it works and to check each setcode that exists.
How exactly (and basically) these setcodes work. --Like I said, it all starts with the hex.

{All cards are cut off by 4 hex digits. XXXX XXXX (spaces don't exist when scripting or in the calculator, just to show you.)
0 obviously when converted to decimal is also 0 --This means it has no setcode, or in short, no archetype.
Each archetype is 3 digits. But the fourth one (from the right) is the extension archetype.
If ever the setcode has less than 4 hex digits, like in decimal, the 0s from the left are removed.
Extension Setcodes have a rule. To create a new setcode extension ONLY, it has to be in the multiple of 1-2-4-8. So basically, a maximum of 4 setcode extensions. Always remember that these are in hex so if you want to combine extension setcodes such as 8+4=12 => C => Cxxx wherein xxx is your base setcode number.
Example:
roid uses 0x0016 --0s will be cut off.
Vehicroid uses 0x1016 --0 will not be cut off since it's in the middle.
Speedroid uses 0x2016
Now just take the numbers, roid use 16, Vehicroid use 1016, Speed Roid use 2016 and convert them to dec from hex.
Now they will become 22, 4118 and 8214 respectively. And if you want to make a Custom Roid, you can use any of these or make a new extension, using 4016 or another number.
If you want to combine these extension setcode such as a Vehicroid + Speedroid. Add the 2 numbers 1+2=3 => 3016.}

 

How to check if a specific setcode exists:

{So you have thought of your setcode number, better if it's in hex since everything's basis will be here.
If it's decimal, convert it first to hex to ensure it's not an Extension archetype.
Convert your number in decimal and type it into the search filter at the top at setcode.
If there are results, it means your archetype is taken and you may want to check YGoPro who uses it.
Copy the id of that card and search it in the database. Now you'll see which cards use it. "Chronomaly", "Ally of Justice", etc.
Repeat until you find one which no one uses. Although if the archetype is by an Anime Card BUT NOT using the card number 51100XXXX, 51200XXXX, 810000XXX, 800000XXX, 888000XXX, then it's fine to use since those setcodes are wrongly made and shouldn't have been there.
NOTE: you can open the main database or expansions database, usually you'll only find my given numbers at the expansions folder.}

 

How to make a card of an existing archetype OR make an extension of an existing archetype.

{FIrst, it would be better if the card you search has exactly 1 archetype. Searching for Number 39: Utopia, but you only want Number? This is a bad choice, you better search for a different card like Number 85: Crazy Box
Now take its card number in YGoPro, beside its name on the right under its picture. The card should show up as soon as you type in its whole card number. If it didn't show up, and it's an official non-Anime card, search the number online.
Now copy this whole card number and paste it in the search filter in SQLite in id.
Check this setcode, convert it to decimal to check if it's an extension archetype (If ever you want it to be a part only of the main archetype and not the specific one).
To make an extension, just convert it to hex, add 0s so it becomes 4 digits and change the 4th number, from the right, to another number.
If you can't find a specific card, it's probably in expansions folder. If you can't find the SINGLE setcode, try dividing the hex-ed setcode to 4 digits. Check each combination (convert to dec and check the search) on which it corresponds to. And the one left with probably no results, then that's probably the one you're looking for.
Example:
Number C1000: Numerronius --this is in expansions folder btw.
So you can find Number C but you will never find Numerronius, just cut the setcode into parts and you should find Numerronius.}

 

Type --card type, just beside setcode
Now the card numbers, Jackmoonward missed the Pendulum Era and I'm going to explain how it works in hex format. Just add the values and convert them to Decimal to make your card's type.
This is more likely explained in Categories just a few steps below this so you may want to check it out if you didn't understand my explanation. Oh yeah and remember, disregard the "0x"

{Monster 0x1
Spell 0x2 --Normal Spells plainly use this, no need to use the "Normal" for monsters.
Trap 0x4 --Same goes for Normal traps
Normal 0x10
Effect 0x20 --Don't forget this because your card may be immune to Skill Drain but we have to be fair for everyone unless it's really a unique card.
Fusion 0x40
Ritual 0x80 --This is both for the Monster and the Spell
Spirit 0x200
Union 0x400
Gemini 0x800
Tuner 0x1000
Synchro 0x2000
Flip 0x200000
Toon 0x400000
Xyz 0x800000
Pendulum 0x1000000
Quick-Play 0x10000
Continuous 0x20000 --Same goes here, both Spell and Traps use this.
Equip 0x40000
Field 0x80000 }

 

Level --More likely because of the Pendulums
Now, for any level (or Rank) (even above 12), just type in the number, simple as that.
As for Pendulum Scales:

{ As usual, SQLite goes back to hex. And it's the same with setcodes, use 4 digits. With Pendulum Scales, you will have 8 digits. Use hex (meaning A-F for 10-15 or even higher).
XX XX XXXX --this will be your format for Pendulums.
Left Scale, Right Scale and Level.
Example:
Pendulum Scale 1, 12, Level 10
01 0C 000A => 10C000A => convert to decimal => 17563658 --now this is your level
Yes, it's possible to make cards with different Left and Right Scales. }

 

Categories are used when searching a card in the game. So the categories are used let's say. I want a card that destroys monsters, then you see the "Effect" at the right side full of checkboxes.
--Don't be lazy guys, please add this when you make a card.
And here's quoted by SGJin who knew how it works:
--P.S. The numbers below have 0x before the values, disregard those, just copy the numbers after it.

Well if you are going to use SQLite, then I hope you are familiar with Hexadecimal.
Each category is assigned a Hexadecimal value.

 

To assign a category to a card in SQlite, you need to take the Hexadecimal value of the category and convert it into Decimal. Then place the Decimal value of the category into SQLite.

Basic Example 1:
-Compulsory Evacuation Device has the category "Send Back to Deck".
-The Hex value of the "Send Back to Deck" category is 0x20.
-0x20 in Hexadecimal is the value 32 in Decimal.
-Place the value 32 into the Category cell in SQLite.
-Compulsory Evacuation Device now has the "Send Back to Deck" category assigned.

For cards with multiple categories, you have to add the Hexadecimal values together.

Advanced Example: Relinquished
-Relinquished is assigned the categories, "Control, Change ATK/DEF, Damage LP, and Destroy".
The Hex values for the catagories are:
0x1000(Control)
0x2000(Change ATK/DEF)
0x400000(Damage LP)
0x1000000(Destroy)

Adding them all together gives you a Hex value of "0x1403000" Which converts to the Decimal value "20983808" in the database.

 

The scripts should have the same card number as your card.
The file should be named cXXXX.lua wherein XXXX is the card number.
A lot of things in the script ends up with the keyword end.
Your script starts off with function cXXXX.initial_effect©
and you close it with end
Here's an empty script with no unnecessary codes.

{function cXXXX.initial_effect©
end }

 

IMPORTANT: when making variables, make sure you check where you place them.
Here's an example when making locals in the function:

function cXXXX.op(e,tp,eg,ep,ev,re,r,rp) --these variables will be taught later
if condition then
local ex=5 --made a variable inside
end --some kind of cutoff, you cannot use the local variables inside.
ex=ex+1 --you cannot access the "ex" variable above since it's inside and this is outside it.
end

 

Variable making - you can use any other name for an effect, group of cards, number, etc.
Just make sure you don't use the predefined variables.
function cXXXX.op(e,tp,eg,ep,ev,re,r,rp) --highlighted are the predefined variables.
In the initial effect, there's only 1 variable which is c which means itself.
In effects, you don't need to use e1, e2, e3, e0, etc. But sometimes, it's easier just to use this to prevent confusion.
Not sure if it also applies to lua but in other coding, it's a must that you cannot start with a number and numbers should always go last.
So far, here are the possible codes that tested legal:

effec --I meant to remove the t. It might be a keyword, I haven't tried.
uu1572
another_name --yes you can use underscores but it's unconfirmed if you can use other symbols

All the Card Codes and Duel Codes are here but of course, explanation and parameters are not included. I will explain them when I'm finished with all the basics.
Card/Duel Codes - interpreter.cpp

Now we get to the parts of the effects.
Remember, there are a huge amount of effects in the game, chain effects, continuous effects, effect that is applied like "cannot be destroyed by battle".
Remember that in the effect itself, the named effect, like e1 from the main function, is now the current "e" in the effect itself.
e1:SetDescription(aux.Stringid(XXXX,n)) - when activating more than 1 of the same timing of effect, this would show up.

e1:SetDescription(aux.Stringid(XXXX,n)) --I had to repeat a lot of things to ensure you guys understood.
--e1 is the effect as usual, underlined
--the one in bold is the important part here. When you activate an effect, it will ask you which effect to activate.
--Highlighted is which string is used. These strings can be checked in SQLite or any Card Manager. Strings are just phrases to help you out within effects.
--just add a +1 (from the script) to see which string is used in the Card Manager.

 

e1:SetCountLimit(Number) - used to know how many times you can use an effect.
There are also a few so I'll include my explanation here. All the count limit formats are explained within the spoiler.

e1:SetCountLimit(Number) --I had to repeat a lot of things to ensure you guys understood. (yeah this is copy-pasted.) msp_lol.gif
--e1 is the effect as usual, underlined
--Highlighted part is the number(s).

Examples:
e1:SetCountLimit(3) --You can activate each card's effect up to thrice per turn. Volcanic Slicer is a good example, but only activatable once per turn, per card while in the proper LOCATION
e1:SetCountLimit(2,82114013) --Same with above except this applies that this card number can only be used that number of times for each turn. Gimmick Puppet Twilight Joker is a good example here. This effect can only be used once per turn.
e1:SetCountLimit(1,917796+EFFECT_COUNT_CODE_OATH) --Now this time, it's used for Spell/Trap Activations. Gagagatag is the used example here.
e1:SetCountLimit(1,14785765+EFFECT_COUNT_CODE_DUEL) --This works as "number" times per duel but I haven't tested this on Spell/Trap plain Activations

 

Tenx for Watching Tis


  • Josephinho, Herowolf and Hanabi Tsunami like this

#2 Josephinho

Josephinho

    Advanced Member

  • Members
  • PipPipPip
  • 376 posts
  • LocationNew Domino City

Posted 18 December 2016 - 01:15 PM

Darckness is here!

 

What im curious about is would you be able to fix speed world 2 spell card (so that we can have some riding duels!) ?



#3 DarckMagiicianGirl

DarckMagiicianGirl

    Member

  • Members
  • PipPip
  • 26 posts
  • LocationBosna and Hercegovina

Posted 18 December 2016 - 06:11 PM

Darckness is here!

 

What im curious about is would you be able to fix speed world 2 spell card (so that we can have some riding duels!) ?

if we allow kaiba



#4 Baby Dragon

Baby Dragon

    Duelist of The Caribbean

  • Members
  • PipPipPip
  • 1,713 posts
  • LocationTrinidad (Think what u want it's a real place!)

Posted 20 January 2017 - 04:38 PM

OMG! I fear only two things... 1) Giant Cakes 2) long text, WOW that is long!



#5 zapzap979

zapzap979

    #1 Phantom Knights User

  • Moderators
  • 244 posts

Posted 14 May 2017 - 05:09 PM

lol but damn that is long



#6 Baby Dragon

Baby Dragon

    Duelist of The Caribbean

  • Members
  • PipPipPip
  • 1,713 posts
  • LocationTrinidad (Think what u want it's a real place!)

Posted 29 June 2017 - 01:24 PM

Once again, Dam that's long






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

IPB Skin By Virteq