name: T.G.
card_text: If this card you control is used as Synchro Material for a "T.G." monster, you can treat it as a non-Tuner. If this card is sent to the GY as Synchro Material for a "T.G." monster: You can Special Summon 1 "T.G. Token" (Machine/EARTH/Level 1/ATK 0/DEF 0) in Attack Position. You can only use this effect of "T.G. Tank Grub" once per turn.
external_ids: local CARD_ID_0 = 74627017 --T.G. Token
  local SETCARD_ID_0 = 0x27 --T.G.
  
lua: local CARD_ID_0 = 74627017 --T.G. Token
  local SETCARD_ID_0 = 0x27 --T.G.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--nontuner
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_NONTUNER)
  	e1:SetValue(s.tnval)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.tkcon)
  	e2:SetTarget(s.tktg)
  	e2:SetOperation(s.tkop)
  	c:RegisterEffect(e2)
  end
  function s.tnval(e, c)
  	return e:GetHandler():IsControler(c:GetControler()) and c:IsSetCard(SETCARD_ID_0)
  end
  function s.tkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_SYNCHRO and e:GetHandler():GetReasonCard():IsSetCard(SETCARD_ID_0)
  end
  function s.tktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_MACHINE, ATTRIBUTE_EARTH, POS_FACEUP_ATTACK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.tkop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_MACHINE, ATTRIBUTE_EARTH, POS_FACEUP_ATTACK) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP_ATTACK)
  end
  
  
source_text: T.G.
  If this card you control is used as Synchro Material for a "T.G." monster, you can treat it as a non-Tuner. If this card is sent to the GY as Synchro Material for a "T.G." monster: You can Special Summon 1 "T.G. Token" (Machine/EARTH/Level 1/ATK 0/DEF 0) in Attack Position. You can only use this effect of "T.G. Tank Grub" once per turn.
target_text: -- T.G.
  local CARD_ID_0 = 74627017 --T.G. Token
  local SETCARD_ID_0 = 0x27 --T.G.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--nontuner
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCode(EFFECT_NONTUNER)
  	e1:SetValue(s.tnval)
  	c:RegisterEffect(e1)
  	--token
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_BE_MATERIAL)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.tkcon)
  	e2:SetTarget(s.tktg)
  	e2:SetOperation(s.tkop)
  	c:RegisterEffect(e2)
  end
  function s.tnval(e, c)
  	return e:GetHandler():IsControler(c:GetControler()) and c:IsSetCard(SETCARD_ID_0)
  end
  function s.tkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsLocation(LOCATION_GRAVE) and r == REASON_SYNCHRO and e:GetHandler():GetReasonCard():IsSetCard(SETCARD_ID_0)
  end
  function s.tktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_MACHINE, ATTRIBUTE_EARTH, POS_FACEUP_ATTACK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.tkop(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_MACHINE, ATTRIBUTE_EARTH, POS_FACEUP_ATTACK) then
  		return
  	end
  	local token = Duel.CreateToken(tp, id + 1)
  	Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP_ATTACK)
  end
  
  