Skip to content

Duel.TossCoin ​

Signature ​

lua
Duel.TossCoin(int player, int count) -> int,...?

Description ​

Tosses count coins for player and returns one integer result per toss. Results are 0 or 1. Normal script use passes a positive count up to MAX_COIN_COUNT; the binding rejects 0 and values below -1, and clamps large positive counts to the core maximum.

Parameters ​

  • player int
  • count int

Returns ​

  • int - First coin result, 0 or 1.
  • ...? - Additional coin results.

Source ​

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

Used By ​

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

  • Detected in 50 indexed script(s).
  • Search this function in the Script Explorer with Duel.TossCoin.
CardIDScriptDetected Calls
Reversal Box2606417Scripts/c2606417.lua1
Arcana Force EX - The Chaos Ruler12686296Scripts/c12686296.lua1
Desperado Barrel Dragon76728962Scripts/c76728962.lua1
Arcana Force V - The Hierophant3376703Scripts/c3376703.lua1
Light Force30913809Scripts/c30913809.lua1
Saion the Vaylantz Archer15130912Scripts/c15130912.lua2
Dark Time Wizard40235813Scripts/c40235813.lua1
Goddess of the Two Sides50915474Scripts/c50915474.lua1
Bettan Bat84079032Scripts/c84079032.lua1
VIP Whale14556954Scripts/c14556954.lua1
Elemental HERO Chaos Neos17032740Scripts/c17032740.lua1
Arcana Force XII - The Hangman72321198Scripts/c72321198.lua1
Arcana Force XIX - The Sun39761418Scripts/c39761418.lua1
Ancient Warriors Saga - East-by-South Winds62528292Scripts/c62528292.lua1
Arcana Spread76302448Scripts/c76302448.lua1
Arcana Reading11819473Scripts/c11819473.lua1
Arcana Force VII - The Chariot34568403Scripts/c34568403.lua1
Time Wizard of Tomorrow26273196Scripts/c26273196.lua1
Light Barrier73206827Scripts/c73206827.lua1
Prepare to Strike Back4483989Scripts/c4483989.lua1
Toon Barrel Dragon28112535Scripts/c28112535.lua1
Origami Goddess7930346Scripts/c7930346.lua1
Vortex of Time42138622Scripts/c42138622.lua1
Head Judging38143903Scripts/c38143903.lua1
...and 26 more

Script Examples ​

Reversal Box (2606417) ​

Source: Scripts/c2606417.lua

lua
	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COIN)
	local coin=Duel.AnnounceCoin(tp)
	local res=Duel.TossCoin(tp,1)
	if coin~=res and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)

Arcana Force EX - The Chaos Ruler (12686296) ​

Source: Scripts/c12686296.lua

lua
				{b2,61,0})
		end
	else res=Duel.TossCoin(tp,1) end
	if res==1 then
		if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end

Desperado Barrel Dragon (76728962) ​

Source: Scripts/c76728962.lua

lua
	local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
	if g:GetCount()==0 then return end
	local c1,c2,c3=Duel.TossCoin(tp,3)
	local ct=c1+c2+c3
	if ct==0 then return end