Jump to content

YGOPro Basic Tutorial


Flash Flyer - Sakura

Recommended Posts

This guide is meant to help you learn how to add your cards to YGOPro.
 
First half of this guide (the post you are reading now) deals with SQL, which is programming the basic information into the game.
 
THIS IS THE EASIER HALF OF THIS TUTORIAL
 
Second half (next post down) deals with coding in Lua, which card data is scripted in,
 
Please note that it is advisable that you use an online converter (or one that is installed on your computer) for hexadecimal/decimal conversions, to make it less tedious on you.
 
I have included a step-by-step at the bottom of this guide if you wish/need to do it manually.
 
[divider1]
 
BASIC INFORMATION
 
All of your card's basic information goes into an SQLite file (which stays in the "expansions" folder). The SQL program should be free to download.
 
I advise using one of YGOHack's SQL files and editing it to fit your own needs. They are easier to edit due to their size. Make sure you change the name of the file though.
 
Do NOT add your cards to the one in main folder (marked as cards.cdb).
 
You will notice that files are divided into two parts; DATAS and TEXTS.
I will divide this part of the tutorial as such.
 
[divider1]
 
SQL BASICS
 
To add a new card, click the “New Row” button (first button on your left).
To delete a card, click the “Remove Row” button (to its right)
 
To save any changes you have made to it, click the “Commit Transaction” button (4th from the left).
 
[divider1]
 
HEXADECIMAL <=> DECIMAL CONVERSION
 
Before starting, I should give you the conversion guide between hexadecimal and decimal.
 
As mentioned in the intro, it's a lot easier to use a converter, especially with bigger numbers, but you should know how to do it by hand.
 
Below is a chart to convert stuff.
 
CONVERSION
 
Hexadecimal uses base 16 format, and decimal uses a base 10 format.
 
0 - 9 are themselves, whereas 10-15 are A - F respectively.
(10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F)
 
DECIMAL TO HEXADECIMAL
 
1. Divide number by 16. Make sure you have a remainder; no need for decimals. In other words, just do 4th/5th grade long division.
 
2. Write down remainder in hex notation.
 
3. Take the integer part from (1) and divide it further by 16.
 
4. Repeat step 3 (whatever integer you get) until you get a quotient less than 16.
ALWAYS write remainders in hex format, and keep track of the order you get them in.
 
5. Arrange the remainders from left to right in order of receiving (including the final integer quotient you get [which is last]) + read right to left (like in manga)
 
EXAMPLE (2000)
 
2000/16 = 125 R0 => 0
125/16 = 7 R13 => D
7/16 = 0 R7 => 7
 
Read from last to first, you have 7D0.
(To check if you did it correctly, undo the process as shown below)
 
HEXADECIMAL TO DECIMAL
 
1. Get decimal equivalent from above.
 
2. Multiply digits by 16 raised to the power of digit location starting from the right and moving to the left. The location starts at 0 and increments by 1 as you move left to each higher place.
 
(7D0 → 7 is location 2; D is location 1; 0 is location 0)
 
3. Sum all multipliers.
 
Using the example above:
0 x 16^0 = 0 * 1 = 0
D x 16^1 = 13*16 = 208
7 x 16^2 = 7 * 256 = 1792
 
You should get 2000 as your final answer.
 
[divider1]
 
DATAS
 
This part deals with the following: ID, OT, Alias, Archetype/SetCode, ATK/DEF, Level, Type/Race, Attribute and category.
 
If your card is a Spell/Trap Card, set the ATK/DEF, Level, Race and Attribute to 0.
 
ID/Passcode
 
Self-explanatory; this is the ID of your card.
All existing cards in the real game have 8-digit numbers.
 
Keep in mind that you do not type any leading zeroes into this box.
So, if my card number is 00002468, then I'd write 2468.
 
Some anime cards are given 9-digit numbers somewhere in the 140/510 million ranges.
 
Make sure that your card IDs do not overlap, because the latest cards with this number will show up in the game + push out others. SQL will not check this. Usually somewhere in the 90-million range is fine, but if you want to do 9-digit passcodes, that works too. (Anything in from 200-400 million, and past 600 should be good)
 
OT
 
This is basically the format that cards belong to.

 

- 1 is TCG

- 2 is OCG

- 3 is TCG/OCG

- 4 is Anime/Manga

 

Just set 0 for your stuff.
 
Alias
 
Used for alternate cards OR if a card effect ALWAYS treats this card as having another name.
If your card doesn't do this, leave it as 0.
 
(See Harpie Lady 1, 2 and 3 and Cyber Harpie for examples)
 
Archetype/SetCode
 
Does this card belong to an Archetype?
If it does, use the below list. If not, type 0.
 
Keep in mind that the following list of Archetypes is incomplete. You may wish to reference the SQL files that either YGOHack or YGOPro have, and check the set codes for things that are currently not up here (or rip apart the official set files when updated).
 
[spoiler=Archetype]
1: Ally of Justice 0x1
2: Genex 0x2
4: Amazoness 0x4
5: Arcana 0x5
6: Dark World 0x6
7: Ancient Gear 0x7
8: HERO 0x8
9: Neos 0x9
10: Evilswarm 0xA
11: Infernity 0xB
12: Alien 0xC
13: Saber 0xD
14: Watt 0xE
15: Ojama 0xF
16: Gusto 0x10
17: Karakuri 0x11
18: Frog 0x12
19: Meklord 0x13
21: B.E.S. 0x15
22: roid 0x16
23: Synchron 0x17
24: Cloudian 0x18
25: Gladiator Beast 0x19
26: Dark Scorpion 0x1A
27: Phantom Beast 0x1B
29: Koa'ki 0x1D
30: Chrysalis 0x1E
31: Neo-Spacian 0x1F
32: Shien 0x20
33: Earthbound Immortal 0x21
34: Jurrac 0x22
35: Malefic 0x23
36: Scrap 0x24
37: Iron Chain 0x25
38: Morphtronic 0x26
39: T.G. 0x27
40: Batteryman 0x28
41: Dragunity 0x29
42: Naturia 0x2A
43: Ninja 0x2B
44: Flamvell 0x2C
46: Gravekeeper 0x2E
47: Ice Barrier 0x2F
48: Vylon 0x30
49: Fortune Lady 0x31
50: Volcanic 0x32
51: Blackwing 0x33
52: Crystal Beast 0x34
53: Fabled 0x35
54: Machina 0x36
55: Mist Valley 0x37
56: Lightsworn 0x38
57: Laval 0x39
58: Ghiski 0x3A
59: Red-Eyes 0x3B
60: Reptilliane 0x3C
61: Six Samurai 0x3D
62: Worm 0x3E
63: Majestic 0x3F
64: Forbidden 0x40
65: LV 0x41
66: Nordic 0x42
67: Junk 0x43
68: Agent 0x44
69: Archfiend 0x45
70: Fusion 0x46
71: Gem- 0x47
72: Number 0x48
73: Skyblaster 0x49
74: Timelord 0x4A
75: Aesir 0x4B
76: Trap Hole 0x4C
78: Evol 0x4E
79: Assault 0x4F
80: Venom 0x50
81: Gadget 0x51
82: Guardian 0x52
83: Constellar 0x53
84: Gagaga 0x54
85: Photon 0x55
86: Inzektor 0x56
87: Resonator 0x57
88: Wind-up 0x58
89: Gogogo 0x59
90: Penguins 0x5A
91: Inmato 0x5B
92: Sphinx 0x5C
96: Bamboo Sword 0x60
97: Ninjitsu Art 0x61
98: Toon 0x62
99: Reactor 0x63
100: Harpie 0x64
101: Infestation 0x65
102: Symphonic 0x66
103: Iron 0x67
104: Tin 0x68
105: Hieratic 0x69
106: Butterspy 0x6A
107: Bounzer 0x6B
108: Lightray 0x6C
109: Majin 0x6D
110: Prophecy 0x6E
111: Heroic 0x6F
112: Chronomaly 0x70
113: Madolche 0x71
114: Geargia 0x72
115: Xyz 0x73
117: Abyss 0x75
118: Heraldic 0x76
119: Atlantean 0x77
120: Nimble 0x78
122: Noble Knight 0x7A
123: Galaxy 0x7B
132: Chronomaly Technology 0x84
144: Meklord Pieces 0x90
145: Dark Tuner/Synchro 0x91
146: Fortune Fairy 0x92
147: Puppet 0x93
148: Fossil Warrior 0x94
149: Cat 0x95
150: Clear 0x96
151: VWXYZ 0x97
154: Superheavy Samurai 0x9A
169: Fluffal 0xA9
171: Deskbot 0xAB
175: D/D 0xAF
186: Raidraptor 0xBA
189: Gaia 0xBD
198: Performage 0xC6
211: PSYFrame 0xD3
256: Synchron Synchros 0x100 (Synchros that require a Synchron Tuner)
257: Synchro Fusions 0x101 (Fusions that require a Synchro Monster)
258: Evil HERO (Dark Fusion) 0x102
259: Cyber 0x103
487: Majespecter 0x1E7
512: Speed Spell 0x200
513: Chaos Xyz 0x201
601: Performapal 0x259
 
Extension
 
4098: R-Genex 0x1002
4106: Steelswarm 0x100A
4109: X-Saber 0x100D
4118: Vehichroid 0x1016
4139: Armor Ninja 0x102B
4149: The Fabled 0x1035
4167: Gem-Knight 0x1047
4175: /Assault 0x104F
4206: Spellbook 0x106E
7793: Greydle 0x1E71
8194: Genex Ally 0x2002
8214: Speedroids 0x2016
12296: E HERO 0x3008
12301: XX-Saber 0x300D
12354: Nordic Ascendant 0x3042
12366: Evoltile 0x304E
12397: Dragoon 0x306D
12435: Gimmick Puppet 0x3093
20488: Vision Hero 0x5008
20546: Nordic Relic 0x5042
24584: Evil HERO 0x6008
24642: Nordic Beasts 0x6042
24654: Evolsuar 0x606E
24685: Djinn of Rituals 0x606C
40968: Masked HERO 0xA008
41026: Nordic Alfar 0xA042
49160: D HERO 0xC008
 
2+ Archetype
 
602120: Neos AND E Hero 0x93008
1828513: Six Samuari AND Shien 0x1BE6A1
2818065: Karakuri AND Ninja 0x2B0011
3866659: Malefic AND Red-Eyes 0x3B0023
4063268: Scrap AND Worm 0x3E0024
4390935: Junk AND Synchron 0x430017
4391168: Junk AND Synchron Synchro 0x430100
4521995: Infernity AND Archfiend 0x45000B
4522009: Gladiator Beast AND Archfiend 0x450019
4522020: Scrap AND Archfiend 0x450024
4522082: Toon AND Archfiend 0x450062
4526159: Archfiend AND /Assault 0x45104F
4591687: Gem-knight AND Fusion 0x461047
4718592: Heraldic AND Number 0x480000
4718704: Chronomaly AND Number 0x480070
4722731: Number AND Armor Ninja 0x48102B
5373963: Infernity AND Guardian 0x52000B
5373981: Koa'ki AND Guardian 0x52001D
5373994: Naturia AND Guardian 0x52002A
5374044: Guardian AND Sphinx 0x52005C
5374064: Guardian AND Chronomaly 0x520070
7012437: Photon AND Bounzer 0x6A0055
7143937: Chaos Xyz AND Djinn 0x6C0201
7209083: Galaxy AND Prohecy 0x75003A
7667770: Ghishki AND Abyss 0x75003A
7667828: Mermail AND Abyss 0x750074
8061000: Number AND Galaxy 0x7B0048
8061013: Galaxy AND Photon 0x7B0055
9449491: Meklord AND Emperor 0x903013
9461779: Meklord AND Army 0x906013
9764916: Crystal Beast AND Cat 0x950034
16777283: Junk AND Synchron Synchro 0x1000043 (if you look back at 4391168 you'll see that it is the same, proving that the codes can go in either order)
16842794: Naturia AND Synchro Fusion 0x101002A
16932872: Evil HERO AND 258? 0x1026008
33554445: Speed Spell AND Saber 0x200000D
33554468: Speed Spell AND Scrap 0x2000024
33554502: Speed Spell AND Fusion 0x2000046
81940232: Number AND Gimmick Puppet 0x4E24F08
[/spoiler]
 
If your cards are part of an Archetype, find the appropriate one here, or if custom, figure out a new number that's not taken here.
 
For 2+ Archetypes, you'll need to add the set code of the 1st one to the 2nd; then do the same for the hexadecimal.
 
When I say add, I mean to add it on to the number. Look at the 2+ Archetype stuff for details.
 
Type your Archetype in as a number (the ones followed by a colon).
The other one (0xPPPP) is a hexadecimal number, which you will need for coding in Lua.
 
You can either convert this online, or manually if you know the formula for it. I have provided a conversion formula below.
 
TYPE
 
What type of card is this?
Find the type yours is and type in the appropriate code.
 
[spoiler=List]
2=Normal Spell Card
4=Normal Trap Card
17=Normal Monster
33=Effect Monster
65=Fusion Monster
97=Fusion / Effect Monster
129=Ritual Monster
130=Ritual Spell
161=Ritual / Effect Monster
545=Spirit Monster
1057=Union Monster
2081=Gemini Monster
4113=Tuner / Normal Monster
4129=Tuner / Effect Monster
8193=Synchro Monster
8225=Synchro / Effect Monster
12321=Synchro / Tuner / Effect Monster
16401=Token
65538=Quick-Play Spell Card
131074= Continuous Spell Card
131076= Continuous Trap Card
262146= Equip Spell Card
524290= Field Spell Card
1048580= Counter Trap Card
2097185= Flip Effect Monster
4194337= Toon Monster
8388609=Xyz Monster
8388641=Xyz / Effect Monster
 
16777233 = Normal Pendulum
16777249 = Effect Pendulum
16777280 = Fusion Pendulum
16777312 = Fusion Effect Pendulum
16777344 = Ritual Pendulum
16777472 = Ritual Effect Pendulum
16781329 = Normal Tuner Pendulum
16781345 = Effect Tuner Pendulum
16781376 = Fusion Effect Tuner Pendulum
16781408 = Fusion Tuner Effect Pendulum
16781568 = Ritual Tuner Effect Pendulum
16785408 = Synchro Pendulum
16785441 = Synchro Effect Pendulum
16789504 = Synchro Tuner Pendulum
16789536 = Synchro Effect Tuner Pendulum
25165825 = Xyz Pendulum
25165857 = Xyz Pendulum Effect
67108865 = Link/Normal
67108897 = Link/Effect
[/spoiler]
 
This list does not deal with every possible combination.
 
If you want something that isn't on this list (though most of it should be there), then do the following.

  • Find the corresponding hexadecimal codes that fit your card. If your card is a Synchro Pendulum Tuner Effect monster, then find the proper codes
  • Add the sum of them together (you only need to add the stuff after the 0x)
  • Convert the result into decimal (again, use the formula below or convert it elsewhere)

[spoiler=Hex Codes]
Monster 0x1
Spell 0x2 --Normal Spells
Trap 0x4 --Normal traps
Normal 0x10
Effect 0x20
Fusion 0x40
Ritual 0x80 -- Both for the monster and Spell Card.
Spirit 0x200
Union 0x400
Gemini 0x800
Tuner 0x1000
Synchro 0x2000
Flip 0x200000
Toon 0x400000
Xyz 0x800000
Pendulum 0x1000000
Quick-Play 0x10000
Continuous 0x20000 --Both Spell/Traps use this.
Equip 0x40000
Field 0x80000
Counter 0x100000
[/spoiler]
 
Race/Type
 
What is your monster's Type/Race? Warrior, Dragon, Machine?
Find the code for the monster's Type and enter it into the Race box.
 
This deals with primary Types only (as in the ones printed in the Type box of the card), and whatever exists out of the 24 confirmed Types. There is no room for hybrid or Fake Types.
 
[spoiler=List]
1=Warrior
2=Spellcaster
4=Fairy
8=Fiend
16=Zombie
32=Machine
64=Aqua
128=Pyro
256=Rock
512=Winged-Beast
1024=Plant
2048=Insect
4096=Thunder
8192=Dragon
16384=Beast
32768=Beast-Warrior
65536=Dinosaur
131072=Fish
262144=Sea Serpent
524288=Reptile
1048576=Psychic
2097152=Divine-Beast
4194304=Creator God
8388608 = Wyrm/Genryu

16777216 = Cyverse
[/spoiler]
 
Attributes
 
Pretty self-explanatory; what is your card's printed Attribute.
 
1 - EARTH
2 - WATER
4 - FIRE
8 - WIND
16 - LIGHT
32 - DARK
64 - DIVINE
 
Level
 
What is the Level / Rank / Link # of your monster?
 

Everything that isn't a Pendulum

 

In this field, just enter what Level / Rank it is, or what its Link Number is. If your monster is Level 10 or higher, just type a regular number; no need for hexacode.

 

Pendulums

 

Note that if you have a Pendulum Monster, you must include its Scale value as well. Otherwise, YGOPro will register it as being a Scale 0 monster.
 
This is the code you need to use first (in hexadecimal form): X0Y000Z
X and Y are your Scale values, and Z is the Level.
 
If your card is Level/Scale 10 or higher, you MUST use A through D in place of those values.
For example, if monster is Level 9 and Scale 10, use A0A0009
 
(A = 10, B = 11, C = 12, D = 13)
 
Then, you need to convert the following code into decimal form. That's the number you type into the Level box.
 
A Level 4 Pendulum with Scale 8 is 8080004 in hexadecimal.
Change it to decimal, and you get 134742020.
This is the number you fill in the Level section.
 

ATK / DEF

 

These two are generally self-explanatory; how much ATK/DEF do your monsters have? If they are Spell/Trap Cards, write 0. If your monster have ? ATK/DEF, then write -2.

 

Link Markers

 

You all know Link Monsters do not have a DEF stat, so use this field to add in the Link Markers. (Note that this is ripped from the BETA)

 

1 - SW
2 - S
4 - SE
8 - W
16 - NW
32 - E
64 - NE
128 - N

2 - S (Link Spider)
5 - SW / SE (Aurum)
7 - SW / S / SE (Gouki Great Ogre)
40 - W / E (Star Grail Maiden Eve)
42 - W / E / S (Gaiasaber)
128 - N (Imduk)
135 - N / SW / S / SE (Topologic Bomber Dragon)
168 - W / E / N (Ningirisu)
170 - W / E / N / S (Firewall Dragon)

 

Category
 
This is basically to further categorize what your card does. You don't have to add this one, so put 0 here.
 
If you want to add it for easier access, then you'll need to convert it in the same way like Pendulum Levels.
 
[divider1]
 
TEXTS
 
This section deals with the ID, name, desc and the 16 string boxes (str).
ID is self-explanatory; whatever your card's ID is, put it in here. Make sure it matches the one you put into DATAS.
 
name is also self-explanatory.
 
Desc is where your effect (or vanilla text) goes.
 
Str is basically an effect prompt (which effect would you like to activate?)
Make sure they align with the effects as they are coded in Lua (see below).
 
Even if you don't use all 16 boxes for prompts, make sure you click inside the unused boxes and space bar to get rid of the nulls.
 
If you do not get rid of the nulls, then YGOPro will crash.
 
[divider1]
 
The second half of this guide is below.

Link to comment
Share on other sites

  • 6 months later...

This is the harder half of adding your cards to YGOPro, which is coding.
 
Having some knowledge of programming (either with Lua or another language) may be of assistance to you in here, but otherwise isn't necessarily required.
 
If you want to learn the basics of Lua for a better understanding, there are some manuals online. Otherwise, you can make do with knowing the syntax of whatever other language. (Lua is a cleaner version of C, so that should be of some help).
 
Keep in mind that programming is NOT something that comes easy to people, even for those who have some degree of experience. (I say this having gone through a semester each of learning Java and C.)
 

iU8EggM.png

 
ADVISORY
 
First and foremost, it is recommended that you copy & paste the scripts from DevPro/Percy or YGOHack as they become available, and edit them appropriately for your needs.

This will save you A LOT of coding in the long run, because it can be very difficult to write card scripts on your own from bottom-up.
 
Of course, it is unlikely that one card script will have everything you want (if it does, great), so you will likely have to copy+paste from several card scripts.
 
You can call this the "Frankenstein method" as you are quite literally, taking bits and pieces from other cards to design your own.
 
Bear in mind that even though there exist at least 9,000 or so scripts for cards [anime/manga cards included], you may not find everything that you need, even with having a lot of resources you can take. (Reminder that some of these cards are alt. arts)
 
iU8EggM.png

 
NOTES
 
Unlike the SQL part, where you will need to download the SQL manager, you can type your file in any text editor of your choosing.
When saving, make sure you name the file c(cardnumber).lua; replace (cardnumber) with whatever your card's ID is.
 
Whatever you put into the SQL, use it here (and make sure that number is used for all effects).
 
TROUBLESHOOTING
 
If you are having coding errors, it may be helpful that you have error notifications turned on. Basically, when you start a match, if there is an error with any .lua file, it will notify you of the error as to where it is located in the file and what you need to fix. 
 
Open "system.conf" in your YGOPro folder with any text editor available and change the line that says "errorlog = 0" to "errorlog = 1". This will enable you to see the errors; you won't get this otherwise. 
 
Be warned that it will not mention ALL of your mistakes at once, so you will need to fix cards one at a time. Also, the program will not notify you of an error if the code is otherwise formatted correctly. 
 
iU8EggM.png

 
DESIGNING FROM SCRATCH
 
I said above that you should copy+paste from the existing scripts, didn't I? Well, I also said that there are limits to how effective that method is.
 
While the 9,000 or so cards on YGOPro (plus additions from YGOHack) should give you most of what you need, there are things that don't exist quite yet.
 
Eventually, you should know how to code cards from scratch, so you do not need to copy/paste things from the existing scripts, and have free reign to code whatever cards you'd like.
 
Below are the formats for doing each effect.
I've split them into two parts; one to deal with simple functions, and others that require peripherals.
 
[spoiler=BASIC]
-- Card Name
function cXXXXXXXX.initial_effect©
local eX=Effect.CreateEffect©
 
-- effect name
local eA=Effect.CreateEffect©
eA:SetType(EFFECT_TYPE_X)
eA:SetDescription(aux.Stringid(XXXX,n))
eA:SetCategory(CATEGORY_X)
eA:SetCode(EFFECT_X)
eA:SetRange(LOCATION_X)
eA:SetCountLimit(R, XXXXXXXX)
eA:SetTargetRange(LOCATION_X)
eX:SetCategory
eX:SetValue(V)
c:RegisterEffect(eA)
 
---- REPEAT FOR EACH EFFECT -----
 
end

// Put this AFTER you have written all of the effects


 
[spoiler=ADVANCED (WITH FILTERS/PERIPHERALS)]
-- Card Name
 
function cXXXXXXXX.initial_effect©
local eX=Effect.CreateEffect©
-- effect name (comment this in, so you know which effect is which)
local eX=Effect.CreateEffect©
eA:SetType(EFFECT_TYPE_X)
eA:SetDescription(aux.Stringid(XXXX,n))*
eA:SetCategory(CATEGORY_X)
eA:SetCode(EFFECT_X)
eA:SetRange(LOCATION_X)
eA:SetCountLimit(R, XXXXXXXX)
eA:SetTargetRange(LOCATION_X)
eA:SetProperty(EFFECT_FLAG_DELAY)
eX:SetCategory
eX:SetValue(V)
c:RegisterEffect(eA)
 
// REPEAT FOR EACH EFFECT
 
end

// Put this AFTER you have written all of the effects
 
Parameters

--effect
function cXXXXXXXX.value()
return Duel.GetMatchingGroupCount(nil,c:GetControler(), LOCATION_X,O,nil)
end
 
function cXXXXXXXXXXX.filter©
return c:IsFaceup() and c:IsRace(RACE_X) and c:IsType(TYPE_X)
end


 
REMINDERS
 
1. ALWAYS comment your code. The more effects/coding you have, the easier it is to get confused. If you have done some amount of programming (either for personal or academic reasons), this concept should be second nature.
 
Before each effect, mark what the effect is supposed to be doing. You should also do this in the peripherals, so you can link them to the associated function.
 
To comment in Lua, you need to use " --" (two dashes). The template is formatted like such, so use that.

Do NOT use the // method like I'm doing here in certain comments; that form is used in Java and C/C++.
 
DEFINITIONS
 
XXXXXXXX is your card ID.
 
(Whatever number you entered in the SQL program goes here).
 
A is the effect number (make sure that all parameters in your effect have the same A).
 
V is the value (i.e. use for incrementing/decrementing stuff). Use a negative value for effects that lower points.
Replace A with effect # and V for value (if you want to decrease, - #)
 
* This is a function, so will be more specific towards how stuff increases/decreases.
 
Replace XXXXXXXX with the card number, and n with some letter combination.
(Make them relevant to what it's supposed to be doing)
 
SetCountLimit shows how many times you can activate that effect per turn (denoted as R).
If you want a hard OPT on it, you need to add the card # to it with a comma.
 
If you're done with the effect stuff, write end after the last effect.
 

iU8EggM.png

 
LOCATIONS, TRIGGER TIMES, EFFECT TYPES
 
What kind of effect is it?
You can combine them if appropriate.
 
EFFECT TYPES
 
[spoiler=List]
EFFECT_TYPE_SINGLE -- Used in continuous effects that affect itself.
// Example: This card cannot be destroyed by card effects
Also used to trigger "When this card is summoned" or "When this card is destroyed", etc.
EFFECT_TYPE_FIELD --opposed to SINGLE, this is used in effects that affect more than one card.
// Example: Monsters you control are unaffected by card effects.
Also used to trigger/chain "When a monster was banished", "When a spell card is activated", etc.
--an exception, this is also used for Special Summon Protocols. Like SSing Lava Golem.
EFFECT_TYPE_EQUIP -- used when effect affects the equipped monster.
// Example: The equipped monster gains 500 ATK.
EFFECT_TYPE_ACTIONS --This has never been used for real but it's likely to check if an effect is activated. This is a part of EFFECT_TYPE_ACTIVATE
EFFECT_TYPE_ACTIVATE --This is used for Spell and Trap Activations, as well as Pendulums
EFFECT_TYPE_FLIP --self explanatory, this is used when it Flips. Flip Effect Monsters.
EFFECT_TYPE_IGNITION --these effects are Spell Speed 1 and cannot be chained, this effect is used with effects that can only be used during your Main Phase.
// Examples: Valhalla, Hall of the Fallen, Blizzard Dragon, Thunder Dragon, Mezuki
EFFECT_TYPE_TRIGGER_O --combined with the SINGLE or FIELD
--Remember that TRIGGER effects are delayed and mostly won't be chained to other effects, meaning the whole chain must resolve first before this applies, unless it's chained to another trigger effect.
--O means Optional.
EFFECT_TYPE_TRIGGER_F --same with above
--F means Forced.
EFFECT_TYPE_QUICK_O -- now, the Quick effects. Some effects don't require the FIELD.
TRIGGER effects can rarely be chained and QUICK can always be chained, so this is why there are times we need to use this.
--QUICK effects can still work without the FIELD but well it's more of analysis.
--can usually be chained to any effect.
EFFECT_TYPE_QUICK_F --same with above but Forced
EFFECT_TYPE_CONTINUOUS --same with QUICK_F but this doesn't trigger. It's like an invisible effect and shouldn't be used combine with to EVENT_FREE_CHAIN
--This also requires FIELD


 
SET CODE
 
What is the effect doing?
Type as EFFECT_X (X is one of the above, replace with whatever you need)
 
[spoiler=List]
IMMUNE_EFFECT
DISABLE
CANNOT_DISABLE
SET_CONTROL
CANNOT_CHANGE_CONTROL
CANNOT_ACTIVATE
CANNOT_TRIGGER
DISABLE_EFFECT
DISABLE_CHAIN
DISABLE_TRAPMONSTER
CANNOT_INACTIVATE
CANNOT_DISEFFECT
CANNOT_CHANGE_POSITION
TRAP_ACT_IN_HAND
TRAP_ACT_IN_SET_TURN
REMAIN_FIELD
MONSTER_SSET
CANNOT_SUMMON
CANNOT_FLIP_SUMMON
CANNOT_SPECIAL_SUMMON
CANNOT_MSET
CANNOT_SSET
CANNOT_DRAW
CANNOT_DISABLE_SUMMON
CANNOT_DISABLE_SPSUMMON
SET_SUMMON_COUNT_LIMIT
EXTRA_SUMMON_COUNT
SPSUMMON_CONDITION
REVIVE_LIMIT
SUMMON_PROC
LIMIT_SUMMON_PROC
SPSUMMON_PROC
EXTRA_SET_COUNT
SET_PROC
LIMIT_SET_PROC
DEVINE_LIGHT
CANNOT_DISABLE_FLIP_SUMMON
INDESTRUCTABLE
INDESTRUCTABLE_EFFECT
INDESTRUCTABLE_BATTLE
UNRELEASABLE_SUM
UNRELEASABLE_NONSUM
DESTROY_SUBSTITUTE
CANNOT_RELEASE
INDESTRUCTIBLE_COUNT
UNRELEASABLE_EFFECT
DESTROY_REPLACE
RELEASE_REPLACE
SEND_REPLACE
CANNOT_DISCARD_HAND
CANNOT_DISCARD_DECK
CANNOT_USE_AS_COST
LEAVE_FIELD_REDIRECT
TO_HAND_REDIRECT
TO_DECK_REDIRECT
TO_GRAVE_REDIRECT
REMOVE_REDIRECT
CANNOT_TO_HAND
CANNOT_TO_DECK
CANNOT_REMOVE
CANNOT_TO_GRAVE
CANNOT_TURN_SET
CANNOT_BE_BATTLE_TARGET
CANNOT_BE_EFFECT_TARGET
IGNORE_BATTLE_TARGET
CANNOT_DIRECT_ATTACK
DIRECT_ATTACK
DUAL_STATUS
EQUIP_LIMIT
DUAL_SUMMONABLE
REVERSE_DAMAGE
REVERSE_RECOVER
CHANGE_DAMAGE
REFLECT_DAMAGE
CANNOT_ATTACK
CANNOT_ATTACK_ANNOUNCE
CANNOT_CHANGE_POS_E
ACTIVATE_COST
SUMMON_COST
SPSUMMON_COST
FLIPSUMMON_COST
MSET_COST
SSET_COST
ATTACK_COST
UPDATE_ATTACK
SET_ATTACK
SET_ATTACK_FINAL
SET_BASE_ATTACK
UPDATE_DEFENSE
SET_DEFENCE
SET_DEFENCE_FINAL
SET_BASE_DEFENSE
REVERSE_UPDATE
SWAP_AD
SWAP_BASE_AD
CHANGE_CODE
ADD_TYPE
REMOVE_TYPE
CHANGE_TYPE
ADD_RACE
REMOVE_RACE
CHANGE_RACE
ADD_ATTRIBUTE
REMOVE_ATTRIBUTE
CHANGE_ATTRIBUTE
UPDATE_LEVEL
CHANGE_LEVEL
UPDATE_RANK
CHANGE_RANK
SET_POSITION
SELF_DESTROY
DOUBLE_TRIBUTE
DECREASE_TRIBUTE
DECREASE_TRIBUTE_SET
EXTRA_RELEASE
TRIBUTE_LIMIT
PUBLIC
COUNTER_PERMIT
COUNTER_LIMIT
RCOUNTER_REPLACE
LPCOST_CHANGE
LPCOST_REPLACE
SKIP_DP
SKIP_SP
SKIP_M1
SKIP_BP
SKIP_M2
CANNOT_BP
CANNOT_M2
CANNOT_EP
SKIP_TURN
DEFENCE_ATTACK
MUST_ATTACK
FIRST_ATTACK
ATTACK_ALL
EXTRA_ATTACK
MUST_BE_ATTACKED
AUTO_BE_ATTACKED
ATTACK_DISABLED
NO_BATTLE_DAMAGE
AVOID_BATTLE_DAMAGE
REFLECT_BATTLE_DAMAGE
PIERCE
BATTLE_DESTROY_REDIRECT
BATTLE_DAMAGE_TO_EFFECT
TOSS_COIN_REPLACE
TOSS_DICE_REPLACE
FUSION_MATERIAL
CHAIN_MATERIAL
SYNCHRO_MATERIAL
XYZ_MATERIAL
FUSION_SUBSTITUTE
CANNOT_BE_FUSION_MATERIAL
CANNOT_BE_SYNCHRO_MATERIAL
SYNCHRO_MATERIAL_CUSTOM
CANNOT_BE_XYZ_MATERIAL
SYNCHRO_LEVEL
RITUAL_LEVEL
XYZ_LEVEL
EXTRA_RITUAL_MATERIAL
NONTUNER
OVERLAY_REMOVE_REPLACE
SCRAP_CHIMERA
SPSUM_EFFECT_ACTIVATED
MATERIAL_CHECK
DISABLE_FIELD
USE_EXTRA_MZONE
USE_EXTRA_SZONE
MAX_MZONE
MAX_SZONE
HAND_LIMIT
DRAW_COUNT
SPIRIT_DONOT_RETURN
SPIRIT_MAYNOT_RETURN
CHANGE_ENVIRONMENT
NECRO_VALLEY
FORBIDDEN
NECRO_VALLEY_IM
REVERSE_DECK
REMOVE_BRAINWASHING
BP_TWICE
UNIQUE_CHECK
MATCH_KILL
SYNCHRO_CHECK


 
SET CODES
 
When does stuff trigger?
 
[spoiler=Effects and Events]
If you use this, EFFECT_TYPE is the following.
 
TRIGGER_O (something happens)
TRIGGER_F (something happens)
QUICK_O (chainable during either player's turn)
QUICK_F (chainable during either player's turn)
 
(O is optional, F is mandatory. Think of O as an “if” / F as a “when” effect.)
 
Write as EVENT_X (X is whatever)
 
STARTUP
FLIP
FREE_CHAIN
DESTROY
REMOVE
TO_HAND
TO_DECK
TO_GRAVE
LEAVE_FIELD
CHANGE_POS
RELEASE
DISCARD
LEAVE_FIELD_P
CHAIN_SOLVING
CHAIN_ACTIVATING
CHAIN_SOLVED
CHAIN_ACTIVATED
CHAIN_NEGATED
CHAIN_DISABLED
CHAIN_END
CHAINING
BECOME_TARGET
DESTROYED
ADJUST
SUMMON_SUCCESS
FLIP_SUMMON_SUCCESS
SPSUMMON_SUCCESS
SUMMON
FLIP_SUMMON
SPSUMMON
MSET
SSET
BE_MATERIAL
DRAW
DAMAGE
RECOVER
PREDRAW
CONTROL_CHANGED
EQUIP
ATTACK_ANNOUNCE
BE_BATTLE_TARGET
BATTLE_START
BATTLE_CONFIRM
PRE_DAMAGE_CALCULATE
DAMAGE_CALCULATE
PRE_BATTLE_DAMAGE
BATTLE_END
BATTLED
BATTLE_DESTROYING
BATTLE_DESTROYED
DAMAGE_STEP_END
ATTACK_DISABLED
BATTLE_DAMAGE
TOSS_DICE
TOSS_COIN
TOSS_COIN_NEGATE
TOSS_DICE_NEGATE
LEVEL_UP
PAY_LPCOST
DETACH_MATERIAL
TURN_END
PHASE
PHASE_START
ADD_COUNTER
REMOVE_COUNTER
FLAG_DELAY


 
LOCATIONS
 
Where are you activating this effect from?
 
[spoiler=List]
LOCATION_DECK
LOCATION_HAND
LOCATION_MZONE
LOCATION_SZONE
LOCATION_GRAVE
LOCATION_REMOVED – banished zone
LOCATION_EXTRA
LOCATION_OVERLAY – Xyz Material
LOCATION_ONFIELD –MZONE + SZONE
LOCATION_DECKBOT – NOT used for Ranges but for effects like SEND_REDIRECT, this means DECK BOTTOM
LOCATION_DECKSHF --Same with the last one, it's NOT to be used for SetRange, which means DECK SHUFFLE
LOCATION_FZONE --Field Spell Zone
LOCATION_PZONE --Pendulum Zone


 

iU8EggM.png

 
SET VALUES
 
There are two ways you can do this; simple boost or functions. (Latter one is used if you need to specify a particular group of cards)
 
SIMPLE
 
eX:SetValue(Y)
 
Replace A with effect # and Y for value (if you want to decrease, - #)
This one is simple, right?
 
ADVANCED
 
eX:SetValue(cXXXXXXXX.n)
 
XXXXXXXX is card number & n is some letter combo of your choice.
Make sure the letter combination is the same during the function part.
 
// This one will lead to a function below, which defines the constraints on when it works.
 
FUNCTIONS
 
You see in the Advanced section that there is a function .n at the end of the card #. That is a function, and like I said earlier, this defines constraints and helps you set up when an effect activates.
 
Write these AFTER you get the effect types out of the way, as the template demonstrates.
 
Below is some sample code.

[spoiler=Formatting and Peripherals (with practice code)]
function cXXXXXXXX.n()
 
Inside brackets are peripherals; extra variables for script to read/understand.
 
End these like you would in the main stuff.
Again, comment your code so you know what it does.
 
PERIPHERALS
 
These are further constraints on when/how stuff works.
 
[spoiler=List]
c - when in filters, this means to check any of the cards, when in summoning procs., this means itself.
Example: You can Normal Summon this card by Tributing 3 monsters. Check Beast King Barbaros or Egyptian God Cards.
e - effect. Which effect? Its own effect.
tp - player. (1-tp is your opponent)
eg - event group. When you have something like "When a card(s) is destroyed", this will be the eg
ep - event player. When you have something like "When your opponent summons an monster"
ev - event value. When you have something like "When you take 2000 or more damage"
re - reason event. Not sure if this is correct but this worked for some cards. "When this card is summoned by a Spell Card"
r - reason. I haven't used this but I already saw how it works. "When this card is destroyed by a Trap Card"
rp - reason player. This is different from ep, just learn more and you will understand. "When this card is banished by an opponent's card effect"
og/tuner - taken from Number F0/Hundred Eye Dragon (TF) - sometimes, when you use special special summon conditions. I think you can change it to any variable, but to avoid confusion, let's choose the best variable. - meaning overlay group or make it like sg (synchro group) or whatever.
This is more likely a predefined code to check the required materials to summon them.
 
Type them in the parentheses and separate with commas.


 
SET VALUES (ADVANCED)
 
[spoiler=Sample Run]
return Duel.GetMatchingGroupCount()
// Asks for cards + counts them.
 
Write this inside the parentheses (5 things)
 
nil,c:GetControler(), LOCATION_X,O,nil
 
// 1. nil skips over things (consider it like a NULL value)
// 2. Translates to Card:GetControler()
// 3. Location
 
// Your side is LOCATION_X, O
// Opponent's side is O, LOCATION_X
// Both players is LOCATION_X, LOCATION_X
 
// 4. Another nil.
Can replace controller with tp (target player) or 1-tp (opponent), but change the peripherals (see above).
 
PRACTICE
 
This one is an attack booster that generates power based on specific cards.
 
Card.IsRace,c:GetControler(), LOCATION_X,O,nil * Y
 
Replace 1st nil with Card.IsRace.
 
Replace 2nd nil with RACE_X (X is whatever race/Type). This is to exclude cards from filter.
Use e:GetHandler() if you want to exclude the card from being included in the effect.
 
Put a * Y number afterwards to determine the amount stuff should change by.
 
---
Card.IsRace.c:GetControler(), LOCATION_MZONE,O, RACE_MACHINE,*Y
 
return Duel.GetMatchingGroupCount(Card.IsRace.c:GetControler(), LOCATION_MZONE,O, RACE_MACHINE) *500
 
“This card gains 500 ATK for every Machine-Type monster on the field.”
 
FILTERS
 
Another function to store specifics that you'd like in effect.
 
function cXXX.filter©
return c:IsFaceup() and c:IsRace(RACE_X) and c:IsType(TYPE_X)
 
Replace XXX with your card number, and C with the peripheral value.
Unlike stuff in C(++) and Java, you explicitly write the word and.
 
PRACTICE 2
 
return Duel.GetMatchingGroupCount(cXXX.filter,c:GetControler(), LOCATION_MZONE,O, RACE_MACHINE) *500
 
Replace the Card.IsRace thing with the filter function, so you can apply the effect to specific things.



 

iU8EggM.png

 
SUMMON REQUIREMENTS
 
Sample code from existing cards, so you have an idea.
Extra Deck only right now; Rituals will be up later.
 
[spoiler=Synchro]
// Standard 1 Tuner
aux.AddSynchroProcedure(c,nil,aux.NonTuner,1)
 
The code for 2 Tuner requirements, like with Scar-Red Nova Dragon, is a lot more complicated, so I won't say it here.
 
// Specific Tuner
aux.AddSynchroProcedure(c,c60800381.tfilter,aux.NonTuner(nil),1)
 
Junk Warrior
Replace the nil in the standard with cXXXX (ID of the required monster)
 
// Specific non-Tuner
aux.AddSynchroProcedure2(c,nil,aux.FilterBoolFunction(Card.IsCode,90000401))
 
Custom card.
Put the card ID of the card you need as a required non-Tuner mat.
 
// Specific Levels
aux.AddSynchroProcedure2(c,nil,aux.NonTuner(c76891401.synfilter))
 
function c76891401.synfilter©
return c:GetLevel()==3
 
Sea Lord Gishilnodon


 
[spoiler=Xyz]

// Generic materials (Predetermined)
aux.AddXyzProcedure(c,nil,AA,BB)
 
AA = Level of monsters you need
BB = Amount needed (2 or more)
 
 // Generic materials (Undetermined)
aux.AddXyzProcedure(c,nil,AA,BB,nil,nil,CC)
 
Satellarknight Ptolemaeus
 
AA = Level  
BB = Min. number of monsters  
CC = Max. number of monsters
 
// Specific mats (Archetype)
aux.AddXyzProcedure(c,c42589641.xyzfilter,4,3)
 
(Put this after the main effects, like with other functions. Do not put them with the main ones)
 
function c42589641.xyzfilter©
return Duel.GetFlagEffect(c:GetControler(),42589641)==0 and c:IsSetCard(0x9c)
 
Stellarknight Triverr
 
// Specific mats (Attribute)
 
aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),8,2)
 
Number 22: Fran Ken
 
Replace DARK with whatever Attribute you want.
 
// Specific mats (Attribute AND Type)
aux.AddXyzProcedure(c,c10443957.mfilter,6,3,c10443957.ovfilter,aux.Stringid(10443957,0),3,c10443957.xyzop)
 
function c10443957.mfilter©
return c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT)
end
 
(This is the portion you need)
 
function c10443957.ovfilter©
return c:IsFaceup() and c:IsCode(58069384)
end
 
(Specific overlay)
 
CyDra Infinity.
 
You only need the mfilter, because it deals with the Type/Attribute.
You don't necessarily need the ovfilter UNLESS you want to Rank-Up from a specific monster.


 
[spoiler=Fusion]
 
// Specific multiples (cards)
aux.AddFusionProcCodeRep(c,89631139,3,true,true)
 
Blue-Eyes Ultimate Dragon's code.
89631139 is BEWD's card code; the 3 indicates the amount of it you need.
 
// Specific multiples (Archetype)
aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsSetCard,0x21C7),3,true)
 
Custom card.
21C7 is the Archetype code (see below section), and 3 is the number of materials you need
 
// Different specific materials
aux.AddFusionProcCode2(c,5405694,23995346,true,true)
 
Master of Dragon Knight's code.
 
The two IDs are that of Blue-Eyes Ultimate and BLS. It doesn't matter what order you put the materials in.
Replace the IDs with that of the cards you need.


 

[spoiler=Links]

// Generic (min)

    --link summon
    aux.AddLinkProcedure(c,nil,2)
    c:EnableReviveLimit()

 

(Gaiasaber)

 

// Specific Archetype (min)

    --link summon
    aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x1fc),2)

 

(Gouki the Great Ogre)

 

// Specific Types (min)

--link summon
    aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsType,TYPE_EFFECT),2)

 

(Topologic Bomber Dragon)

 

// Precisely [x] monsters

--link summon
    aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_EARTH),2,2)
    c:EnableReviveLimit()

 

(Missus Radiant)

 

 

 

iU8EggM.png

 
ARCHETYPE CODES
 
Remember the Archetype # you put into the SQL box in regular numerals?
Write that number in hexadecimal for the filters (and in the effects). You will need it for summon requirements (like above) or if your card involves a particular Archetype.
 
So, if my Archetype number is 2000 (one of my customs uses this), then for any filters and stuff, I would use 0x7D0.
 
(There is a conversion guide above)
Link to comment
Share on other sites

  • 1 month later...

Decided to merge the two tutorial threads into one for ease of access; should've done this when I wrote the Lua portion but oh well.

I apologize for the walls of text, but given the amount of content, it's bound to happen. (Also, the BBCode screwed up on the Lua part, so it uses the default color). 

 

I've updated the guide to explain stuff in SQL (though that should be self-explanatory for the most part) and some side notes regarding the coding itself (.lua files).

Also added code regarding the Extra Deck materials (I got most of them, but not all of them, including stuff like Utopia Kaiser and Scar-Red Nova Dragon/others that require multiple Tuners).

 

Regarding the part on commenting your code, really do it. Makes it easier for us to read your code if you need someone to look it over for errors, and definitely on you when you expand on things.

Start with one effect first, then build on the other ones as you get them to work.

 

(Concept also applies in standard programming; mark what the code is supposed to be doing. And yeah, please do not copy the // version of commenting that I have used in here.)

 

It does not cover how to write AIs for particular Decks, as I am not familiar with that part just yet.

However, doing this will allow you to at least have a proper fight against your creations without having to use the VS function against yourself (as opposed to the AI misplaying).

 

iU8EggM.png

 

As usual, if you have questions about stuff, please ask. 

I am not an expert on coding stuff in this game, but I have enough knowledge to answer most things.

 

 

P.S. The copyright symbols are supposed to be [c] (as in parenthesized c).

Somehow YCM wants to convert [c] into that symbol.

 

Be mindful of that as you type stuff.

Link to comment
Share on other sites

  • 1 year later...

You said replace the n with something relative to its effect, what does this mean exactly?

 

Basically Im Trying To Make A Field Spell For Dragons, It adds attack and defense which I believe I Have Down, It Offers an Optional Effect to destroy your opponents field spell, it makes all monsters on the field dragon types, and it isn't affected by heavy storm only mystical space typhoon, Im getting confused by the coding procss is all, im actually brand new to this

Link to comment
Share on other sites

 

ADVANCED

 

eX:SetValue(cXXXXXXXX.n)

 

XXXXXXXX is card number & n is some letter combo of your choice.

Make sure the letter combination is the same during the function part.

 

// This one will lead to a function below, which defines the constraints on when it works.

 

The underlined part, right?

 

Basically, XXXXXXXXX is whatever card number you set it to be in the SQL file, and n is an indicator of what your effect does (generally to differentiate between effects, especially if they are similar). If you add peripherals (as in add-ons for the Advanced stuff), whatever you put for "n" must be the same.

 

===

Might be easier if I post a sample code.

 

[spoiler=Yeah, I was coding stuff based on reindeer]

-- Champion Snow Flyer - Rudolph
function c90001220.initial_effect(c)
	--synchro summon
	aux.AddSynchroProcedure2(c,nil,aux.FilterBoolFunction(Card.IsCode,90001201))
	c:EnableReviveLimit()
	--add Flyer stuff
	local e1=Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(90001220,0))
	e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
	e1:SetType(EFFECT_TYPE_IGNITION)
	e1:SetRange(LOCATION_MZONE)
	e1:SetCountLimit(1)
	e1:SetTarget(c90001220.thtg)
	e1:SetOperation(c90001220.thop)
	c:RegisterEffect(e1)
	--cannot target
	local e2=Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
	e2:SetValue(aux.tgoval)
	c:RegisterEffect(e2)
	--indes
	local e3=Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_SINGLE)
	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
	e3:SetRange(LOCATION_MZONE)
	e3:SetValue(c90001220.indval)
	c:RegisterEffect(e3)
	--opponent can't trigger
	local e4=Effect.CreateEffect(c)
	e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
	e4:SetCode(EVENT_ATTACK_ANNOUNCE)
	e4:SetRange(LOCATION_MZONE)
	e4:SetCondition(c90001220.actcon)
	e4:SetOperation(c90001220.actop)
	c:RegisterEffect(e4)
	local e5=e4:Clone()
	e5:SetCode(EVENT_BE_BATTLE_TARGET)
	c:RegisterEffect(e5)
end

--search for Flyer stuff
function c90001220.filter1(c)
	return (c:IsSetCard(0xc9) or c:IsSetCard(0x4c9) or c:IsSetCard(0x5c9)) and c:IsAbleToHand()
end
function c90001220.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.IsExistingMatchingCard(c90001220.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end
	Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c90001220.thop(e,tp,eg,ep,ev,re,r,rp)
	if not e:GetHandler():IsRelateToEffect(e) then return end
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
	local g=Duel.SelectMatchingCard(tp,c90001220.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
	if g:GetCount()>0 then
		Duel.SendtoHand(g,nil,REASON_EFFECT)
		Duel.ConfirmCards(1-tp,g)
	end
end

--forget about triggering
function c90001220.actcon(e,tp,eg,ep,ev,re,r,rp)
	local tc=Duel.GetAttacker()
	if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end
	return tc and tc:IsControler(tp) and tc:IsSetCard(0x4c9) or tc:IsSetCard(0x5c9) or tc:IsSetCard(0xc9) or tc:IsCode(90001215)
end

function c90001220.actop(e,tp,eg,ep,ev,re,r,rp)
	local e4=Effect.CreateEffect(e:GetHandler())
	e4:SetType(EFFECT_TYPE_FIELD)
	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e4:SetCode(EFFECT_CANNOT_ACTIVATE)
	e4:SetTargetRange(0,1)
	e4:SetValue(c90001220.aclimit)
	e4:SetReset(RESET_PHASE+PHASE_DAMAGE)
	Duel.RegisterEffect(e4,tp)
end
function c90001220.aclimit(e,re,tp)
	return not re:GetHandler():IsImmuneToEffect(e)
end

 

 

 

--add Flyer stuff

    local e1=Effect.CreateEffect©

    e1:SetDescription(aux.Stringid(90001220,0))

    e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)

    e1:SetType(EFFECT_TYPE_IGNITION)

    e1:SetRange(LOCATION_MZONE)

    e1:SetCountLimit(1)

    e1:SetTarget(c90001220.thtg)

    e1:SetOperation(c90001220.thop)

    c:RegisterEffect(e1)

 

+++++++++++++++++

 

--search for Flyer stuff

function c90001220.filter1©

    return (c:IsSetCard(0xc9) or c:IsSetCard(0x4c9) or c:IsSetCard(0x5c9)) and c:IsAbleToHand()

end

function c90001220.thtg(e,tp,eg,ep,ev,re,r,rp,chk)

    if chk==0 then return Duel.IsExistingMatchingCard(c90001220.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil) end

    Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)

end

function c90001220.thop(e,tp,eg,ep,ev,re,r,rp)

    if not e:GetHandler():IsRelateToEffect(e) then return end

    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)

    local g=Duel.SelectMatchingCard(tp,c90001220.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)

    if g:GetCount()>0 then

        Duel.SendtoHand(g,nil,REASON_EFFECT)

        Duel.ConfirmCards(1-tp,g)

    end

end

 

-----

Using my searching one as an example, notice the bolded parts in the main effects, and how those codes come around in the peripherals (as in telling the program what the specifics are).

 

.thtg (where am I grabbing stuff from, and what sorts of cards am I getting)

.thop (match the cards from the noted locations, and then add them to the hand)

-----

 

In your case, you may wish to look at other cards that do similar things for other types; I do recommend this as not everyone is good in coding from scratch. I can code some cards, yes, but most of it is generally c/p. If it helps, there is a code bot on YGOPro's Discord channel that you can use for finding certain functions. My other piece of advice is to start small, and then work your way up with more effects.

 

If the stat booster works, then work on the type change. If that works, then immunity to Heavy Storm but only MST affects it (you can try for non-targeting protection). The optional Field Spell nuke is probably separate, so you can probably use a trigger effect to do that. (Again, find cards that are similar in application and borrow the code from there)

 

- Stat booster: Find something

- Type change: Zombie World does well in this.

- Heavy Storm protection: Just look for cards that have the "cannot be destroyed" clause, though you'll have to specify non-targeting. (Code I wrote above does have protection, but it's general destruction protection, and doesn't differentiate between targeting / non-targeting)

- Field Spell destruction: Look for an effect that can be triggered on your turn and targets a card on the field for destruction.

 

====================

Come to think of it, I may need to rewrite this guide a bit.

Link to comment
Share on other sites

  • 3 months later...

hello i'm having trouble coding my card with this effect
 

" If this card has 'Fleet Girl - Destroyer - Murasame' as an Xyz Material(ignore this), it gains this effect.- Once per turm, you can detach 1 Xyz Material from this card, you can add 1 'Fleet Girls(ignore this)' from your deck to your hand."

 

which basically mean that if i have a specific Xyz material, i can detach 1 material and search for card.

i can never figure out how to do this.

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

I was wondering if this was possible in TDOANE. The thing is, I don't want to waste PC space, to get a whole other game JUST for custom cards.

 

You asked this almost two weeks ago; see my answer above.

 

Reading over their description, it is unlikely this works for them, but check with the creators if you can code cards for them. Likely the answer is no. 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...