Skip to content

Effect.SetCode ​

Signature ​

lua
Effect.SetCode(Effect e, int code) -> void

Description ​

Stores the engine code for e. Depending on the effect type, this is an EVENT_* timing, an EFFECT_* rule or procedure, or a composed/custom code. It is unrelated to a card's archetype setcode.

How To Use It ​

Effect.SetCode is not related to a card's archetype setcode. The separate Archetypes and Setcodes Learn page documents card membership. This function stores the engine code that identifies what an Effect listens for or what rule it applies.

The core stores the supplied integer directly. Its meaning comes from the effect's SetType:

Effect shapeSetCode familyPurpose
Spell/Trap activation (EFFECT_TYPE_ACTIVATE)Usually EVENT_FREE_CHAIN, or a specific EVENT_*Chooses the activation window.
Trigger or Quick effectEVENT_*, a composed phase/counter event, or a custom eventChooses the event that can wake the effect.
Event-watching Continuous effectA continuous-only EVENT_*Runs an operation immediately when that engine event is processed.
Single, Field, Equip, Xyz-material, or Grant ruleEFFECT_*Chooses the rule, modifier, restriction, procedure, or replacement being applied.
Ignition effectUsually no codeIgnition effects are selected by the player during an open Main Phase; SetRange and callbacks normally define them.
Flip EffectEVENT_FLIP is assigned by SetTypeThe core normalizes EFFECT_TYPE_FLIP and overwrites the code with EVENT_FLIP.

Call SetType before SetCode, especially for Flip Effects, and finish setting the code before RegisterEffect. Registration indexes the effect under its current code; changing the code afterward does not reindex it.

EFFECT_TYPE_CONTINUOUS means an event-processing action with an Operation callback. An ordinary persistent ATK modifier, summon restriction, material rule, or player rule normally uses EFFECT_TYPE_SINGLE, EFFECT_TYPE_FIELD, EFFECT_TYPE_EQUIP, or another non-action type instead.

A normal optional trigger listens for an event:

lua
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)

A rule effect uses an EFFECT_* code instead:

lua
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)

EVENT_ADJUST is a special continuous-only event. It is used when a script must reconcile state after the core finishes an adjustment pass, such as maintaining a card group, repairing a derived rule, or checking an unusual win condition:

lua
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetRange(LOCATION_MZONE)
e1:SetOperation(s.adjustop)
c:RegisterEffect(e1)

An adjust operation can run many times. Make it idempotent: inspect current state and change only what is actually wrong. Do not use EVENT_ADJUST as a substitute for a known summon, movement, chain, or phase event.

The core reserves these event codes for EFFECT_TYPE_CONTINUOUS: EVENT_ADJUST, EVENT_BREAK_EFFECT, EVENT_TURN_END, EVENT_PRE_BATTLE_DAMAGE, EVENT_SPSUMMON_SUCCESS_G_P, and every EVENT_PHASE_START+PHASE_* code. The core rejects a Trigger or Quick effect registered with one of those codes.

Phase-end triggers compose the event base and phase:

lua
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.epcon)
e2:SetOperation(s.epop)
c:RegisterEffect(e2)

Custom events require a listener and a matching raise call. Use the same stable code on both sides:

lua
local custom_code=EVENT_CUSTOM+id

e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(custom_code)
e3:SetRange(LOCATION_MZONE)
e3:SetOperation(s.customop)
c:RegisterEffect(e3)

-- In the operation that creates the custom event:
Duel.RaiseSingleEvent(c,custom_code,e,REASON_EFFECT,tp,tp,0)

Choose the code family first, then add the callbacks required by that specific code. SetCode alone does not supply a target range, value, condition, cost, target, or operation.

Complete Code Reference ​

SetCode accepts a 32-bit integer, so there is no finite list of every possible custom number. The current engine snapshot defines 342 named code bases for this parameter: 76 EVENT_* bases, 265 ordinary EFFECT_* codes, and 1 card-ID flag base.

The local script snapshot contains 34,714 direct SetCode calls using 447 distinct written expressions. The tables below list every named engine code. Direct uses counts only expressions that spell that constant explicitly; a variable such as custom_code cannot be assigned to a base constant reliably by static text scanning.

Codes that are built from a base ​

NeedCorrect shapeEffect type
End of a phaseEVENT_PHASE+PHASE_*Trigger/Quick, or an activation effect when appropriate
Start of a phaseEVENT_PHASE_START+PHASE_*EFFECT_TYPE_CONTINUOUS
A counter is added/removedEVENT_ADD_COUNTER+counter_type / EVENT_REMOVE_COUNTER+counter_typeTrigger/Quick
A script-defined eventEVENT_CUSTOM+stable_unique_idTrigger/Quick; another operation must raise the exact same code
Counter permission/limit/replacementEFFECT_COUNTER_PERMIT+counter_type, EFFECT_COUNTER_LIMIT+counter_type, or EFFECT_RCOUNTER_REPLACE+counter_typeRule effect
A card-ID flag-style codeEFFECT_FLAG_EFFECT+card_idRule/flag effect; usually created through flag-effect helpers
A private marker on a non-action rule effectA raw card IDOnly when other scripts deliberately query that same ID with IsHasEffect/IsAffectedByEffect

Do not combine unrelated ordinary EVENT_* values or unrelated EFFECT_* values. The + forms above work because the high bits identify a code family and the low bits carry a phase, counter type, or custom ID.

Valid phase-end forms are EVENT_PHASE+PHASE_DRAW, +PHASE_STANDBY, +PHASE_BATTLE_START, +PHASE_BATTLE, and +PHASE_END. Valid continuous phase-start forms use EVENT_PHASE_START with PHASE_DRAW, PHASE_STANDBY, PHASE_MAIN1, PHASE_BATTLE_START, PHASE_MAIN2, or PHASE_END.

Values that are not general SetCode arguments ​

  • EFFECT_TYPE_*, EFFECT_FLAG_*, CATEGORY_*, RESET_*, SUMMON_TYPE_*, and a bare PHASE_* belong to other APIs. They are not interchangeable with event/effect codes.
  • An Ignition effect normally omits SetCode; writing SetCode(0) adds no useful meaning.
  • Do not copy the legacy SetCode(RESET_CHAIN) pattern. RESET_CHAIN is a reset mask, not an effect code.
  • A raw card ID is only an intentional private marker for a non-action rule effect. For a script-raised action event, use EVENT_CUSTOM+id on both the listener and raise call.
  • SetCode(0x182) does not give a card archetype membership. For that rule, use SetCode(EFFECT_ADD_SETCODE) with SetValue(0x182).

Every event code ​

For EFFECT_TYPE_SINGLE, an ordinary event generally concerns the handler itself. For EFFECT_TYPE_FIELD, it can observe matching events elsewhere, subject to range, condition, and property rules. Continuous-only events are called out explicitly.

Engine, movement, and Chain events ​

CodeValueWhat it is forDirect uses
EVENT_STARTUP1000Legacy/reserved local constant that is absent from the current core snapshot. No indexed card script registers it directly.0
EVENT_FLIP1001When flipped111
EVENT_FREE_CHAIN1002Open activation timing rather than a past occurrence. Common for Spell/Trap activations and optional Quick Effects.5786
EVENT_DESTROY1010Before a confirmed destroyed card moves8
EVENT_REMOVE1011When banished192
EVENT_TO_HAND1012When added to hand101
EVENT_TO_DECK1013When returned to Deck25
EVENT_TO_GRAVE1014When sent to Graveyard (excluding REASON_RETURN)1278
EVENT_LEAVE_FIELD1015When leaving the field323
EVENT_CHANGE_POS1016When position changes58
EVENT_RELEASE1017When Tributed91
EVENT_DISCARD1018When discarding from hand14
EVENT_LEAVE_FIELD_P1019Before a card leaving the field moves66
EVENT_CHAIN_SOLVING1020When chain resolution starts (after EVENT_CHAIN_ACTIVATING)148
EVENT_CHAIN_ACTIVATING1021When chain activation is preparing0
EVENT_CHAIN_SOLVED1022When chain resolution ends107
EVENT_CHAIN_ACTIVATED1023Legacy/reserved local constant that is absent from the current core snapshot. No indexed card script registers it directly.0
EVENT_CHAIN_NEGATED1024When chain activation is negated (after EVENT_CHAIN_ACTIVATING)27
EVENT_CHAIN_DISABLED1025When chain effect is negated54
EVENT_CHAIN_END1026When chain ends45
EVENT_CHAINING1027When an effect is activated1028
EVENT_BECOME_TARGET1028When becoming an effect target26
EVENT_DESTROYED1029When destroyed647
EVENT_MOVE1030When moving a card (e.g., Urgent Rabbit Horse)37
EVENT_LEAVE_GRAVE1031When leaving the Graveyard6
EVENT_LEAVE_DECK1032When leaving the Deck or Extra Deck3
EVENT_ADJUST1040Continuous-only. Runs after the core completes an adjustment pass; use for idempotent state reconciliation or unusual win checks.23
EVENT_BREAK_EFFECT1050Continuous-only. Runs when Duel.BreakEffect() creates a visible resolution break.25

Summon, material, damage, and control events ​

CodeValueWhat it is forDirect uses
EVENT_SUMMON_SUCCESS1100When Normal Summon succeeds1382
EVENT_FLIP_SUMMON_SUCCESS1101When Flip Summon succeeds165
EVENT_SPSUMMON_SUCCESS1102When Special Summon succeeds2451
EVENT_SUMMON1103During Normal Summon (before monster appears, e.g., Solemn Warning timing)25
EVENT_FLIP_SUMMON1104During Flip Summon16
EVENT_SPSUMMON1105During Special Summon51
EVENT_MSET1106When Setting a monster17
EVENT_SSET1107When Setting a Spell/Trap16
EVENT_BE_MATERIAL1108When used as Synchro/Xyz/Link Material, used as Ritual/Fusion Material, or Tributed for a Tribute Summon241
EVENT_BE_PRE_MATERIAL1109When about to be used as Synchro/Xyz/Link Material or Tributed for a Tribute Summon6
EVENT_DRAW1110When drawing59
EVENT_DAMAGE1111When dealing battle/effect damage74
EVENT_RECOVER1112When recovering LP20
EVENT_PREDRAW1113Before normal draw in Draw Phase25
EVENT_SUMMON_NEGATED1114When Normal Summon is negated3
EVENT_FLIP_SUMMON_NEGATED1115When Flip Summon is negated0
EVENT_SPSUMMON_NEGATED1116When Special Summon is negated1
EVENT_SPSUMMON_SUCCESS_G_P1117Continuous-only. Runs before a group-procedure Special Summon such as a Pendulum Summon succeeds.3
EVENT_CONTROL_CHANGED1120When control changes9
EVENT_EQUIP1121When an Equip Card is equipped17

Battle and random-result events ​

CodeValueWhat it is forDirect uses
EVENT_ATTACK_ANNOUNCE1130When attack is declared482
EVENT_BE_BATTLE_TARGET1131When selected as attack target150
EVENT_BATTLE_START1132When Damage Step starts (before flipping)125
EVENT_BATTLE_CONFIRM1133Before damage calculation (after flipping)35
EVENT_PRE_DAMAGE_CALCULATE1134During damage calculation (e.g., Wing Slash)132
EVENT_DAMAGE_CALCULATING1135Legacy/reserved local constant that is absent from the current core snapshot. No indexed card script registers it directly.0
EVENT_PRE_BATTLE_DAMAGE1136Continuous-only. Runs immediately before battle damage is applied.4
EVENT_BATTLE_END1137Legacy/reserved local constant that is absent from the current core snapshot. No indexed card script registers it directly.0
EVENT_BATTLED1138After damage calculation (e.g., Alien Girl, same timing as Flip Effects)158
EVENT_BATTLE_DESTROYING1139When destroying a monster by battle and sending it to Graveyard (e.g., Blackwing - Shura the Blue Flame)332
EVENT_BATTLE_DESTROYED1140When destroyed by battle and sent to Graveyard (e.g., Mystic Tomato)341
EVENT_DAMAGE_STEP_END1141When Damage Step ends139
EVENT_ATTACK_DISABLED1142When attack is negated (e.g., Double Chance)6
EVENT_BATTLE_DAMAGE1143When dealing battle damage210
EVENT_TOSS_DICE1150After dice roll result1
EVENT_TOSS_COIN1151After coin toss result4
EVENT_TOSS_COIN_NEGATE1152When re-tossing a coin2
EVENT_TOSS_DICE_NEGATE1153When re-rolling a dice3

Level, cost, material, and turn-end events ​

CodeValueWhat it is forDirect uses
EVENT_LEVEL_UP1200When Level increases1
EVENT_PAY_LPCOST1201When paying LP cost7
EVENT_DETACH_MATERIAL1202When removing Xyz Material9
EVENT_RETURN_TO_GRAVE1203Legacy/reserved local constant that is absent from the current core snapshot. No indexed card script registers it directly.0
EVENT_TURN_END1210Continuous-only turn-end processing event. For an ordinary End Phase trigger, use EVENT_PHASE+PHASE_END.7

Phase, counter, and custom event bases ​

CodeValueWhat it is forDirect uses
EVENT_PHASE0x1000Composed base. Add a PHASE_* value, for example EVENT_PHASE+PHASE_END, for a phase-end Trigger or Quick effect.1526
EVENT_PHASE_START0x2000Continuous-only composed base. Add a PHASE_* value, for example EVENT_PHASE_START+PHASE_DRAW.42
EVENT_ADD_COUNTER0x10000Composed base. Add the 16-bit counter type, for example EVENT_ADD_COUNTER+0x1. The core raises it after counters are successfully added.2
EVENT_REMOVE_COUNTER0x20000Composed base. Add the 16-bit counter type. Duel.RemoveCounter raises it automatically; Card.RemoveCounter does not.1
EVENT_CUSTOM0x10000000Composed base for script-defined events. Add a stable unique ID and raise that exact code with Duel.RaiseEvent or Duel.RaiseSingleEvent.76

Every engine effect code ​

These codes identify continuous rules, modifiers, restrictions, procedures, and replacements. The description states the role of the code; the exact callback contract can additionally require SetRange, SetTargetRange, SetTarget, SetValue, SetCondition, or SetOperation. Search the local scripts for a proven pattern before using an unfamiliar low-level or reserved code.

Core rules and action restrictions ​

CodeValueWhat it is forDirect uses
EFFECT_IMMUNE_EFFECT1Immune to effects248
EFFECT_DISABLE2Negates effects (e.g., Skill Drain)725
EFFECT_CANNOT_DISABLE3Effect cannot be negated12
EFFECT_SET_CONTROL4Sets control26
EFFECT_CANNOT_CHANGE_CONTROL5Cannot change control11
EFFECT_CANNOT_ACTIVATE6Player cannot activate effects326
EFFECT_CANNOT_TRIGGER7Card cannot trigger effects115
EFFECT_DISABLE_EFFECT8Negates effects (e.g., Forbidden Chalice)601
EFFECT_DISABLE_CHAIN9Negates in chain (processor.cpp)1
EFFECT_DISABLE_TRAPMONSTER10Negates Trap Monsters107
EFFECT_CANNOT_INACTIVATE12Activation cannot be negated18
EFFECT_CANNOT_DISEFFECT13Cannot be negated during effect processing16
EFFECT_CANNOT_CHANGE_POSITION14Cannot change position75
EFFECT_TRAP_ACT_IN_HAND15Trap can activate from hand45
EFFECT_TRAP_ACT_IN_SET_TURN16Trap can activate in the turn it was Set56
EFFECT_REMAIN_FIELD17Remains on field for X turns (e.g., Swords of Revealing Light)57
EFFECT_MONSTER_SSET18Monster can be Set in Spell/Trap Zone20
EFFECT_CANNOT_SUMMON20Cannot Normal Summon monsters136
EFFECT_CANNOT_FLIP_SUMMON21Cannot Flip Summon monsters34
EFFECT_CANNOT_SPECIAL_SUMMON22Cannot Special Summon monsters920
EFFECT_CANNOT_MSET23Cannot Set monsters46
EFFECT_CANNOT_SSET24Cannot Set Spells/Traps27
EFFECT_CANNOT_DRAW25Cannot draw cards9
EFFECT_CANNOT_DISABLE_SUMMON26Summon cannot be negated9
EFFECT_CANNOT_DISABLE_SPSUMMON27Special Summon cannot be negated21
EFFECT_SET_SUMMON_COUNT_LIMIT28Limits Normal Summon count per turn6
EFFECT_EXTRA_SUMMON_COUNT29Increases Normal Summon count74
EFFECT_SPSUMMON_CONDITION30Special Summon condition668
EFFECT_REVIVE_LIMIT31Monsters with revival restrictions (Card.EnableReviveLimit())0

Summon and Set procedures ​

CodeValueWhat it is forDirect uses
EFFECT_SUMMON_PROC32Summon rule effect166
EFFECT_LIMIT_SUMMON_PROC33Summon rule restriction23
EFFECT_SPSUMMON_PROC34Special Summon rule693
EFFECT_EXTRA_SET_COUNT35Increases Set (Normal Summon) count7
EFFECT_SET_PROC36Set (Normal Summon) rule30
EFFECT_LIMIT_SET_PROC37Set (Normal Summon) rule restriction16
EFFECT_DIVINE_LIGHT38Divine Light1
EFFECT_CANNOT_DISABLE_FLIP_SUMMON39Flip Summon cannot be negated1

Movement, targeting, combat permissions, and costs ​

CodeValueWhat it is forDirect uses
EFFECT_INDESTRUCTABLE40Cannot be destroyed2
EFFECT_INDESTRUCTABLE_EFFECT41Cannot be destroyed by effects449
EFFECT_INDESTRUCTABLE_BATTLE42Cannot be destroyed by battle523
EFFECT_UNRELEASABLE_SUM43Cannot be Tributed for a Tribute Summon67
EFFECT_UNRELEASABLE_NONSUM44Cannot be Tributed except for a Tribute Summon48
EFFECT_DESTROY_SUBSTITUTE45Mandatory destruction substitute (replace this card's destruction with another card)41
EFFECT_CANNOT_RELEASE46Cannot perform Tribute actions7
EFFECT_INDESTRUCTABLE_COUNT47Cannot be destroyed X times per turn109
EFFECT_UNRELEASABLE_EFFECT48Cannot be Tributed1
EFFECT_DESTROY_REPLACE50Optional destruction substitute (replace destruction with another action)246
EFFECT_RELEASE_REPLACE51Tribute substitute0
EFFECT_SEND_REPLACE52Can send to another location instead of the intended one (e.g., Dessert Castle)5
EFFECT_CANNOT_DISCARD_HAND55Cannot discard from hand2
EFFECT_CANNOT_DISCARD_DECK56Cannot send cards from Deck to Graveyard3
EFFECT_CANNOT_USE_AS_COST57Cannot be used as cost0
EFFECT_CANNOT_PLACE_COUNTER58Cannot place counters1
EFFECT_CANNOT_TO_GRAVE_AS_COST59Cannot be sent to Graveyard as cost1
EFFECT_LEAVE_FIELD_REDIRECT60Redirect destination when leaving field275
EFFECT_TO_HAND_REDIRECT61Redirect destination when returning to hand4
EFFECT_TO_DECK_REDIRECT62Redirect destination when returning to Deck2
EFFECT_TO_GRAVE_REDIRECT63Redirect destination when sent to Graveyard35
EFFECT_REMOVE_REDIRECT64Redirect destination when banished0
EFFECT_CANNOT_TO_HAND65Cannot be added to hand21
EFFECT_CANNOT_TO_DECK66Cannot be returned to Deck4
EFFECT_CANNOT_REMOVE67Cannot be banished22
EFFECT_CANNOT_TO_GRAVE68Cannot be sent to Graveyard3
EFFECT_CANNOT_TURN_SET69Cannot be Set face-down9
EFFECT_CANNOT_BE_BATTLE_TARGET70Cannot be targeted for attacks57
EFFECT_CANNOT_BE_EFFECT_TARGET71Cannot be targeted by effects320
EFFECT_IGNORE_BATTLE_TARGET72Cannot be targeted for attacks - weak type (e.g., Legendary Fisherman)15
EFFECT_CANNOT_DIRECT_ATTACK73Cannot attack directly108
EFFECT_DIRECT_ATTACK74Can attack directly195
EFFECT_DUAL_STATUS75Gemini status2
EFFECT_EQUIP_LIMIT76Equip target restriction608
EFFECT_DUAL_SUMMONABLE77Can be re-summoned (Gemini)1
EFFECT_UNION_LIMIT78Union restriction20
EFFECT_REVERSE_DAMAGE80Converts damage to recovery9
EFFECT_REVERSE_RECOVER81Converts recovery to damage2
EFFECT_CHANGE_DAMAGE82Changes damage value90
EFFECT_REFLECT_DAMAGE83Reflects damage12
EFFECT_CANNOT_ATTACK85Cannot attack329
EFFECT_CANNOT_ATTACK_ANNOUNCE86Cannot declare an attack104
EFFECT_CANNOT_CHANGE_POS_E87Cannot be changed to Defense Position by effects (e.g., Aggro Cloud)1
EFFECT_ACTIVATE_COST90Activation cost (e.g., Magical Shackles)7
EFFECT_SUMMON_COST91Summon cost20
EFFECT_SPSUMMON_COST92Special Summon cost (e.g., Tyrant Dragon)28
EFFECT_FLIPSUMMON_COST93Flip Summon cost0
EFFECT_MSET_COST94Monster Set cost1
EFFECT_SSET_COST95Spell/Trap Set cost1
EFFECT_ATTACK_COST96Attack cost (e.g., Mist Valley Falcon)17

Stats, identity, position, Tributes, and counters ​

CodeValueWhat it is forDirect uses
EFFECT_UPDATE_ATTACK100Increase/decrease ATK2120
EFFECT_SET_ATTACK101Set ATK, ATK becomes X for Special Summon, or continuously change ATK106
EFFECT_SET_ATTACK_FINAL102Temporarily change ATK (all chain-entering effects)374
EFFECT_SET_BASE_ATTACK103Set original ATK or continuously change original ATK75
EFFECT_UPDATE_DEFENSE104Increase/decrease DEF506
EFFECT_SET_DEFENSE105Set DEF, DEF becomes X for Special Summon, or continuously change DEF58
EFFECT_SET_DEFENSE_FINAL106Temporarily change DEF (all chain-entering effects)106
EFFECT_SET_BASE_DEFENSE107Set original DEF or continuously change original DEF28
EFFECT_REVERSE_UPDATE108Invert ATK/DEF increase/decrease (e.g., Tengu)1
EFFECT_SWAP_AD109Swap ATK and DEF (e.g., Super Crashbug)1
EFFECT_SWAP_BASE_AD110Swap original ATK and DEF4
EFFECT_SET_BASE_ATTACK_FINAL111Temporarily change original ATK27
EFFECT_SET_BASE_DEFENSE_FINAL112Temporarily change original DEF10
EFFECT_ADD_CODE113Add card code5
EFFECT_CHANGE_CODE114Change card code66
EFFECT_ADD_TYPE115Add card type (Types)133
EFFECT_REMOVE_TYPE116Remove card type12
EFFECT_CHANGE_TYPE117Change card type89
EFFECT_ADD_RACE120Add race0
EFFECT_REMOVE_RACE121Remove race1
EFFECT_CHANGE_RACE122Change race69
EFFECT_ADD_ATTRIBUTE125Add attribute20
EFFECT_REMOVE_ATTRIBUTE126Remove attribute1
EFFECT_CHANGE_ATTRIBUTE127Change attribute86
EFFECT_UPDATE_LEVEL130Change Level264
EFFECT_CHANGE_LEVEL131Set Level239
EFFECT_UPDATE_RANK132Change Rank6
EFFECT_CHANGE_RANK133Set Rank3
EFFECT_UPDATE_LSCALE134Change Left Scale15
EFFECT_CHANGE_LSCALE135Set Left Scale20
EFFECT_UPDATE_RSCALE136Change Right Scale15
EFFECT_CHANGE_RSCALE137Set Right Scale20
EFFECT_SET_POSITION140Set position15
EFFECT_SELF_DESTROY141Non-chain destruction (e.g., Sin series)88
EFFECT_SELF_TOGRAVE142Non-chain send to Graveyard17
EFFECT_DOUBLE_TRIBUTE150Can be used as two Tributes29
EFFECT_DECREASE_TRIBUTE151Decrease Tributes8
EFFECT_DECREASE_TRIBUTE_SET152Decrease Tributes for Setting monsters1
EFFECT_EXTRA_RELEASE153Mandatory Tribute substitute (e.g., Soul Exchange)1
EFFECT_TRIBUTE_LIMIT154Tribute restriction9
EFFECT_EXTRA_RELEASE_SUM155Tribute substitute for summon (e.g., Kaiser Cyclone)1
EFFECT_TRIPLE_TRIBUTE156Reserved/unsupported in the current snapshot; no indexed script uses it directly.0
EFFECT_ADD_EXTRA_TRIBUTE157Add usable Tributes (e.g., True Draco)14
EFFECT_EXTRA_RELEASE_NONSUM158Tribute substitute for effect cost (e.g., Dark World)2
EFFECT_PUBLIC160Make hand public22

LP, phases, attacking, damage, and randomness ​

CodeValueWhat it is forDirect uses
EFFECT_LPCOST_CHANGE170Change LP cost value6
EFFECT_LPCOST_REPLACE171Replace LP cost with another action1
EFFECT_SKIP_DP180Skip Draw Phase14
EFFECT_SKIP_SP181Skip Standby Phase2
EFFECT_SKIP_M1182Skip Main Phase 16
EFFECT_SKIP_BP183Skip Battle Phase21
EFFECT_SKIP_M2184Skip Main Phase 21
EFFECT_CANNOT_BP185Cannot enter Battle Phase50
EFFECT_CANNOT_M2186Cannot enter Main Phase 20
EFFECT_CANNOT_EP187Cannot enter End Phase1
EFFECT_SKIP_TURN188Skip entire turn5
EFFECT_DEFENSE_ATTACK190Can attack in Defense Position19
EFFECT_MUST_ATTACK191Must attack54
EFFECT_FIRST_ATTACK192Must attack first1
EFFECT_ATTACK_ALL193Can attack all monsters43
EFFECT_EXTRA_ATTACK194Increase attack count162
EFFECT_MUST_BE_ATTACKED195Reserved/unsupported in the current snapshot; no indexed script uses it directly.0
EFFECT_ONLY_BE_ATTACKED196Can only attack this card1
EFFECT_ATTACK_DISABLED197Attack negated (marker for successful Duel.NegateAttack())0
EFFECT_NO_BATTLE_DAMAGE200Does not inflict battle damage to opponent31
EFFECT_AVOID_BATTLE_DAMAGE201Does not take battle damage142
EFFECT_REFLECT_BATTLE_DAMAGE202Opponent takes battle damage instead26
EFFECT_PIERCE203Piercing damage188
EFFECT_BATTLE_DESTROY_REDIRECT204Redirect destination when destroyed by battle20
EFFECT_BATTLE_DAMAGE_TO_EFFECT205Treat battle damage as effect damage1
EFFECT_BOTH_BATTLE_DAMAGE206Both players take battle damage3
EFFECT_ALSO_BATTLE_DAMAGE207Opponent also takes battle damage dealt to you5
EFFECT_CHANGE_BATTLE_DAMAGE208Change battle damage dealt by this card or received by player74
EFFECT_TOSS_COIN_REPLACE220Replace coin toss0
EFFECT_TOSS_DICE_REPLACE221Replace dice roll0
CodeValueWhat it is forDirect uses
EFFECT_FUSION_MATERIAL230Specify Fusion Material conditions8
EFFECT_CHAIN_MATERIAL231Player affected by Chain Material effect2
EFFECT_EXTRA_SYNCHRO_MATERIAL232Can be treated as your Synchro Material from the hand or opponent's field3
EFFECT_XYZ_MATERIAL233Can be used as Xyz Material0
EFFECT_FUSION_SUBSTITUTE234Fusion Material substitute12
EFFECT_CANNOT_BE_FUSION_MATERIAL235Cannot be used as Fusion Material51
EFFECT_CANNOT_BE_SYNCHRO_MATERIAL236Cannot be used as Synchro Material101
EFFECT_SYNCHRO_MATERIAL_CUSTOM237Custom Tuner Synchro process7
EFFECT_CANNOT_BE_XYZ_MATERIAL238Cannot be used as Xyz Material76
EFFECT_CANNOT_BE_LINK_MATERIAL239Cannot be used as Link Material69
EFFECT_SYNCHRO_LEVEL240Level when used as Synchro Material5
EFFECT_RITUAL_LEVEL241Level when used as Ritual Tribute10
EFFECT_XYZ_LEVEL242Level when used as Xyz Material18
EFFECT_EXTRA_RITUAL_MATERIAL243Can be used as Ritual Tribute from Graveyard11
EFFECT_NONTUNER244Treated as non-Tuner monster (e.g., Phantom King Hydride)14
EFFECT_OVERLAY_REMOVE_REPLACE245Substitute for removing Xyz Material11
EFFECT_SCRAP_CHIMERA246Scrap Chimera1
EFFECT_TUNE_MAGICIAN_X247Tuning Magician Xyz Material restriction1
EFFECT_TUNE_MAGICIAN_F248Lua procedure convention used by the local Synchro helpers even though the current core has no native consumer for this name.1
EFFECT_PRE_MONSTER250Access various monster values (used with Card.AddMonsterAttribute())0
EFFECT_MATERIAL_CHECK251Check materials195
EFFECT_DISABLE_FIELD260Disable zones (e.g., Ojama King)23
EFFECT_USE_EXTRA_MZONE261Lock Monster Zones1
EFFECT_USE_EXTRA_SZONE262Lock Spell/Trap Zones0
EFFECT_MAX_MZONE263Maximum Monster Zone slots3
EFFECT_MAX_SZONE264Maximum Spell/Trap Zone slots2
EFFECT_MUST_USE_MZONE265Must use specific Monster Zone slots9

Player rules, Deck state, and material requirements ​

CodeValueWhat it is forDirect uses
EFFECT_HAND_LIMIT270Hand size limit5
EFFECT_DRAW_COUNT271Number of cards drawn in Draw Phase12
EFFECT_SPIRIT_DONOT_RETURN280Spirit Monster does not return to hand1
EFFECT_SPIRIT_MAYNOT_RETURN281Spirit Monster can choose not to return to hand2
EFFECT_CHANGE_ENVIRONMENT290Change Field Spell2
EFFECT_NECRO_VALLEY291Necrovalley2
EFFECT_FORBIDDEN292Cannot be played (e.g., Forbidden Order)2
EFFECT_NECRO_VALLEY_IM293Unaffected by Necrovalley5
EFFECT_REVERSE_DECK294Reverse Deck order1
EFFECT_REMOVE_BRAINWASHING295Remove brainwashing6
EFFECT_BP_TWICE296Two Battle Phases4
EFFECT_UNIQUE_CHECK297Only one can exist on field (used with Card.SetUniqueOnField())0
EFFECT_MATCH_KILL300Match victory (e.g., Victory Dragon)1
EFFECT_SYNCHRO_CHECK310Genomix Fighter2
EFFECT_QP_ACT_IN_NTPHAND311Activate from hand in opponent's turn (e.g., Ecclesia the Virtuous)12
EFFECT_MUST_BE_SMATERIAL312Must be used as Synchro Material (e.g., Phonon Pulse Dragon)2
EFFECT_TO_GRAVE_REDIRECT_CB313Redirect destination (e.g., Gem Beasts)18
EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE314Change battle damage caused by this card13
EFFECT_CHANGE_RANK_FINAL315Reserved/unsupported in the current snapshot; no indexed script uses it directly.0
EFFECT_MUST_BE_FMATERIAL316Must be used as Fusion Material1
EFFECT_MUST_BE_XMATERIAL317Must be used as Xyz Material1
EFFECT_MUST_BE_LMATERIAL318Must be used as Link Material1

Advanced procedures, materials, and modern rules ​

CodeValueWhat it is forDirect uses
EFFECT_SPSUMMON_PROC_G320Pendulum Summon rule2
EFFECT_SPSUMMON_COUNT_LIMIT330Special Summon count limit5
EFFECT_LEFT_SPSUMMON_COUNT331Remaining summon count (e.g., Summon Limit)5
EFFECT_CANNOT_SELECT_BATTLE_TARGET332Opponent cannot select as attack target135
EFFECT_CANNOT_SELECT_EFFECT_TARGET333Opponent cannot select as effect target1
EFFECT_ADD_SETCODE334Treated as specific archetype effect12
EFFECT_NO_EFFECT_DAMAGE335Player affected by "effect damage becomes 0"56
EFFECT_UNSUMMONABLE_CARD336Reserved/unsupported in the current snapshot; no indexed script uses it directly.0
EFFECT_DISABLE_CHAIN_FIELD337Reserved/unsupported in the current snapshot; no indexed script uses it directly.0
EFFECT_DISCARD_COST_CHANGE338Change discard cost for Counter Traps (e.g., Ariadne the Absolver)1
EFFECT_HAND_SYNCHRO339Use hand monsters as Synchro Material9
EFFECT_ADD_FUSION_CODE340Treated as specific card name for Fusion Material (e.g., Fusion Identification)5
EFFECT_ADD_FUSION_SETCODE341Treated as specific archetype for Fusion Material (e.g., Toy Parade)4
EFFECT_RISE_TO_FULL_HEIGHT342Reserved/unsupported in the current snapshot; no indexed script uses it directly.0
EFFECT_ONLY_ATTACK_MONSTER343Can only attack specific monster1
EFFECT_MUST_ATTACK_MONSTER344Must attack specific monster if attacking25
EFFECT_PATRICIAN_OF_DARKNESS345Opponent chooses attack target (e.g., Patrician of Darkness)5
EFFECT_EXTRA_ATTACK_MONSTER346Attack a monster X times55
EFFECT_UNION_STATUS347Union status1
EFFECT_OLDUNION_STATUS348Old Union status1
EFFECT_ADD_FUSION_ATTRIBUTE349Reserved/unsupported in the current core snapshot; no indexed script uses it directly.0
EFFECT_REMOVE_FUSION_ATTRIBUTE350Reserved/unsupported in the current core snapshot; no indexed script uses it directly.0
EFFECT_CHANGE_FUSION_ATTRIBUTE351Attribute when used as Fusion Material1
EFFECT_EXTRA_FUSION_MATERIAL352Additional Fusion Material (e.g., Omni Alchemist)10
EFFECT_TUNER_MATERIAL_LIMIT353Synchro Material restriction12
EFFECT_ADD_LINK_CODE354Card name when used as Link Material2
EFFECT_ADD_LINK_SETCODE355Reserved/unsupported in the current core snapshot; no indexed script uses it directly.0
EFFECT_ADD_LINK_ATTRIBUTE356Attribute when used as Link Material1
EFFECT_ADD_LINK_RACE357Race when used as Link Material1
EFFECT_EXTRA_LINK_MATERIAL358Hand as Link Material18
EFFECT_QP_ACT_IN_SET_TURN359Quick-Play Spell can activate in the turn it was Set8
EFFECT_EXTRA_PENDULUM_SUMMON360Additional Pendulum Summon9
EFFECT_MATERIAL_LIMIT361Material restriction2
EFFECT_SET_BATTLE_ATTACK362Use set ATK for battle damage calculation6
EFFECT_SET_BATTLE_DEFENSE363Use set DEF for battle damage calculation4
EFFECT_OVERLAY_RITUAL_MATERIAL364Xyz Materials can be used for Ritual Summon1
EFFECT_CHANGE_GRAVE_ATTRIBUTE365Change attribute of cards in Graveyard (e.g., Advanced Shift)1
EFFECT_CHANGE_GRAVE_RACE366Change race of cards in Graveyard (e.g., Advanced Shift)2
EFFECT_ACTIVATION_COUNT_LIMIT367Reserved/unsupported in the current snapshot; no indexed script uses it directly.0
EFFECT_LIMIT_SPECIAL_SUMMON_POSITION368Cannot Special Summon in specific position21
EFFECT_TUNER369Can be treated as a Tuner for a Synchro Summon (Hundred Apple Dragon - Apple Wyrm)3
EFFECT_KAISER_COLOSSEUM370Kaiser Colosseum1
EFFECT_REPLACE_DAMAGE371Damage is replaced by a specific action2
EFFECT_XYZ_MIN_COUNT372Can only be used for an Xyz Summon with at least X materials1
EFFECT_SYNCHRO_LEVEL_EX373Allows monsters without Levels to be used as Synchro Material3
EFFECT_RITUAL_LEVEL_EX374Allows monsters without Levels to be used as Ritual Material0
EFFECT_DOUBLE_XMATERIAL375Counts as 2 materials when Xyz Summoning a monster that requires 3 or more materials5
EFFECT_REVEAL_ONFIELD376Affected face-down cards on the field can be inspected by the effect controller1
EFFECT_ADD_CARD_TYPE377Adds TYPE_* bits to the card type used by Card.GetCardType (distinct from ordinary EFFECT_ADD_TYPE)2
EFFECT_REMOVE_CARD_TYPE378Removes TYPE_* bits from the card type used by Card.GetCardType0
EFFECT_CHANGE_CARD_TYPE379Replaces the card type used by Card.GetCardType with the supplied TYPE_* bitmask0

Encoded and engine-managed effect codes ​

CodeValueWhat it is forDirect uses
EFFECT_COUNTER_PERMIT0x10000Encoded base. Add the counter type to allow that kind of counter on the affected card.3
EFFECT_COUNTER_LIMIT0x20000Encoded base. Add the counter type; SetValue supplies the permitted limit.0
EFFECT_RCOUNTER_REPLACE0x30000Encoded base. Add the counter type to replace removal of that kind of counter.1
EFFECT_FLAG_EFFECT0x20000000Card-ID flag-effect base. Add a card ID for a manually registered flag-style code; RegisterFlagEffect normally creates these codes for you.11

Engine sources ​

Parameters ​

  • e Effect
  • code int

Source ​

  • D:\Programs\GitHub\ygopro-core\libeffect.cpp:613

Guided Examples ​

Learn how to use this function in context:

More guided lessons (7)

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 12863 indexed script(s).
  • Search this function in the Script Explorer with Effect.SetCode.
CardIDScriptDetected Calls
Salamandra with Chain62091148Scripts/c62091148.lua7
Astrograph Sorcerer, the Starfrost Magician48171151Scripts/c48171151.lua3
Artmage Non-Finito74631897Scripts/c74631897.lua5
Pendulum Evolution55795155Scripts/c55795155.lua5
Levia-Dragoon - Daedalus78579058Scripts/c78579058.lua3
Lady's Dragonmaid48658295Scripts/c48658295.lua4
Azure Ocean Dragon Lord - Neo-Daedalus Rage41570943Scripts/c41570943.lua4
Eternal Favorite87532344Scripts/c87532344.lua7
Surprise Fusion35167375Scripts/c35167375.lua4
Astrograph Sorcerer76794549Scripts/c76794549.lua3
Spellbook of the Grand Circle11911336Scripts/c11911336.lua6
Ultra Polymerization76647978Scripts/c76647978.lua5
Goyo Emperor59255742Scripts/c59255742.lua7
Accel Synchro Stardust Dragon30983281Scripts/c30983281.lua4
Melffy Playtime Surprise58036097Scripts/c58036097.lua3
Ashtraja Susanoo17020474Scripts/c17020474.lua2
Deftero Enneacraft - "alazoneIA"92171126Scripts/c92171126.lua4
Destiny HERO - Destro-Dogma25158975Scripts/c25158975.lua5
Yomagna the Fire Phantom17350692Scripts/c17350692.lua3
Fiendsmith's Sequence49867899Scripts/c49867899.lua2
D/D/D Alfred the Divine Sage King11852093Scripts/c11852093.lua1
El Shaddoll Apkallone50907446Scripts/c50907446.lua8
Mementotlan Fusion66518509Scripts/c66518509.lua2
Meteoroa Drytron24166324Scripts/c24166324.lua3
...and 12839 more

Script Examples ​

Salamandra with Chain (62091148) ​

Source: Scripts/c62091148.lua

lua
	e1:SetCategory(CATEGORY_EQUIP+CATEGORY_POSITION+CATEGORY_MSET)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetHintTiming(TIMING_DAMAGE_STEP)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)

Astrograph Sorcerer, the Starfrost Magician (48171151) ​

Source: Scripts/c48171151.lua

lua
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
	e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(custom_code)
	e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
	e2:SetRange(LOCATION_HAND)

Artmage Non-Finito (74631897) ​

Source: Scripts/c74631897.lua

lua
	e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
	e0:SetCode(EVENT_SPSUMMON_SUCCESS)
	e0:SetCondition(s.condition)
	e0:SetOperation(s.regop)