Skip to content

Duel.CheckLPCost ​

Signature ​

lua
Duel.CheckLPCost(int player, int cost, [bool must_pay]) -> bool|nil

Description ​

Checks whether player can pay the specified LP cost without paying it. Use this in a Cost callback's chk==0 branch. The core returns false for nonpositive costs, and the optional must_pay flag is passed to the LP-cost check.

Parameters ​

  • player int - Player checked for payment ability.
  • cost int - LP amount to check; values of 0 or less return false.
  • must_pay bool optional - Passed through to the core LP-cost check; scripts use true when the player must be able to pay that exact amount.

Returns ​

  • bool|nil - True if the LP cost can be paid; false if it cannot or cost is nonpositive; nil if player is invalid.

Source ​

  • D:\Programs\GitHub\ygopro-core\libduel.cpp:4908

Guided Examples ​

Learn how to use this function in context:

Used By ​

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

  • Detected in 354 indexed script(s).
  • Search this function in the Script Explorer with Duel.CheckLPCost.
CardIDScriptDetected Calls
Ultra Polymerization76647978Scripts/c76647978.lua1
Deftero Enneacraft - "alazoneIA"92171126Scripts/c92171126.lua1
Odd-Eyes Revolution Dragon16306932Scripts/c16306932.lua1
Enlightenment Dragon46186135Scripts/c46186135.lua1
Yummy★Snatchy30581601Scripts/c30581601.lua1
El Shaddoll Meshachrer32467459Scripts/c32467459.lua1
Super Duper Polymerization44886582Scripts/c44886582.lua1
Chaos Emperor, the Dragon of Armageddon4538826Scripts/c4538826.lua1
Gem-Knight Phantom Quartz24484270Scripts/c24484270.lua1
Beyond the Pendulum22125101Scripts/c22125101.lua1
Ursarctic Quint Charge15758127Scripts/c15758127.lua1
R.B. Lambda Blade17188206Scripts/c17188206.lua1
R.B. Lambda Cannon81794107Scripts/c81794107.lua1
Kaiki the Unity Star60822251Scripts/c60822251.lua1
Todoroki the Earthbolt Star30118701Scripts/c30118701.lua1
Abyss Actor - Mellow Madonna78310590Scripts/c78310590.lua1
Psychic Arsenal16238373Scripts/c16238373.lua1
Materiactor Meltthrough66059345Scripts/c66059345.lua1
Masterking Archfiend35606858Scripts/c35606858.lua1
Chaos Emperor Dragon - Envoy of the End82301904Scripts/c82301904.lua1
Salamangreat Sanctuary1295111Scripts/c1295111.lua1
Ekto Enneacraft - "tromarIA"29570824Scripts/c29570824.lua1
Enato Enneacraft - "oknirIA"55965529Scripts/c55965529.lua1
Psychic Omnibuster70659412Scripts/c70659412.lua1
...and 330 more

Script Examples ​

Ultra Polymerization (76647978) ​

Source: Scripts/c76647978.lua

lua
end
function c76647978.cost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.CheckLPCost(tp,2000) end
	Duel.PayLPCost(tp,2000)
end

Deftero Enneacraft - "alazoneIA" (92171126) ​

Source: Scripts/c92171126.lua

lua
end
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.CheckLPCost(tp,900) end
	Duel.PayLPCost(tp,900)
end

Odd-Eyes Revolution Dragon (16306932) ​

Source: Scripts/c16306932.lua

lua
end
function c16306932.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return e:GetHandler():IsDiscardable() and Duel.CheckLPCost(tp,500) end
	Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
	Duel.PayLPCost(tp,500)