Skip to content

Effect.SetOperation ​

Signature ​

lua
Effect.SetOperation(Effect e, nil|function op_func) -> void

Description ​

Sets e's operation callback. Passing nil clears the operation. For activated effects, this callback resolves after the Chain reaches this Link, so it should re-check targets, locations, relation, and other state that may have changed since activation.

How To Use It ​

The operation callback performs the effect when the Chain resolves.

For targeted cards, retrieve the target and re-check that it is still related to the resolving effect before applying the action:

lua
function s.operation(e,tp,eg,ep,ev,re,r,rp)
    local tc=Duel.GetFirstTarget()
    if tc and tc:IsRelateToEffect(e) then
        Duel.Destroy(tc,REASON_EFFECT)
    end
end

Passing nil to SetOperation clears the operation. That is occasionally useful for effects whose category or target data is enough and no resolution callback is needed.

Parameters ​

  • e Effect - Effect whose operation callback is replaced or cleared.
  • op_func nil|function - Operation callback, or nil to clear it.

Source ​

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

Guided Examples ​

Learn how to use this function in context:

More guided lessons (2)

Used By ​

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

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

Script Examples ​

Salamandra with Chain (62091148) ​

Source: Scripts/c62091148.lua

lua
	e1:SetCost(s.cost)
	e1:SetTarget(s.target)
	e1:SetOperation(s.operation)
	c:RegisterEffect(e1)
	--

Astrograph Sorcerer, the Starfrost Magician (48171151) ​

Source: Scripts/c48171151.lua

lua
	e1:SetCountLimit(1,id)
	e1:SetTarget(s.ptg)
	e1:SetOperation(s.pop)
	c:RegisterEffect(e1)
	--special summon

Artmage Non-Finito (74631897) ​

Source: Scripts/c74631897.lua

lua
	e0:SetCode(EVENT_SPSUMMON_SUCCESS)
	e0:SetCondition(s.condition)
	e0:SetOperation(s.regop)
	c:RegisterEffect(e0)
	--spsummon condition