Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand or GY) by banishing 3 Pyro monsters or 1 "Blaze Accelerator" card from your face-up field and/or GY. You can only Special Summon "Volcanic Emperor" once per turn. When Summoned this way: You can inflict 500 damage to your opponent for each banished Pyro monster, then you can Set 1 "Volcanic" Trap directly from your Deck. Each time your opponent Special Summons a monster(s), inflict 500 damage to your opponent.
--ヴォルカニック・エンペラー
--Volcanic Emperor
--scripted by pyrQ
local s,id=GetID()
function s.initial_effect(c)
	c:SetSPSummonOnce(id)
	c:EnableReviveLimit()
	c:AddMustBeSpecialSummoned()
	--Must be Special Summoned (from your hand or GY) by banishing 3 Pyro monsters or 1 "Blaze Accelerator" card from your face-up field and/or GY
	local e0=Effect.CreateEffect(c)
	e0:SetType(EFFECT_TYPE_FIELD)
	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e0:SetCode(EFFECT_SPSUMMON_PROC)
	e0:SetRange(LOCATION_HAND|LOCATION_GRAVE)
	e0:SetCondition(s.spcon)
	e0:SetTarget(s.sptg)
	e0:SetOperation(s.spop)
	e0:SetValue(1)
	c:RegisterEffect(e0)
	--Inflict 500 damage to your opponent for each banished Pyro monsters
	local e1=Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id,0))
	e1:SetCategory(CATEGORY_DAMAGE)
	e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
	e1:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL+1) end)
	e1:SetTarget(s.damsettg)
	e1:SetOperation(s.damsetop)
	c:RegisterEffect(e1)
	--Each time your opponent Special Summons a monster(s), inflict 500 damage to your opponent
	local e2=Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCondition(s.damcon)
	e2:SetOperation(s.damop)
	c:RegisterEffect(e2)
end
s.listed_names={id}
s.listed_series={SET_BLAZE_ACCELERATOR,SET_VOLCANIC}
function s.spcostfilter(c,tp)
	return ((c:IsMonster() and c:IsRace(RACE_PYRO)) or c:IsSetCard(SET_BLAZE_ACCELERATOR))
		and c:IsFaceup() and c:IsAbleToRemoveAsCost()
end
function s.rescon(sg,e,tp,mg)
	return Duel.GetMZoneCount(tp,sg)>0
		and ((sg:IsExists(Card.IsSetCard,1,nil,SET_BLAZE_ACCELERATOR) and #sg==1)
		or sg:FilterCount(Card.IsRace,nil,RACE_PYRO)==3)
end
function s.spcon(e,c)
	if c==nil then return true end
	local tp=c:GetControler()
	local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,c)
	return #rg>0 and aux.SelectUnselectGroup(rg,e,tp,1,3,s.rescon,0)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
	local g=nil
	local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,c)
	local g=aux.SelectUnselectGroup(rg,e,tp,1,3,s.rescon,1,tp,HINTMSG_REMOVE,s.rescon,nil,true)
	if #g>0 then
		g:KeepAlive()
		e:SetLabelObject(g)
		return true
	end
	return false
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
	local g=e:GetLabelObject()
	if not g then return end
	Duel.Remove(g,POS_FACEUP,REASON_COST)
	g:DeleteGroup()
end
function s.damsettg(e,tp,eg,ep,ev,re,r,rp,chk)
	local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,RACE_PYRO),tp,LOCATION_REMOVED,LOCATION_REMOVED,nil)
	if chk==0 then return #g>0 end
	Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#g*500)
end
function s.setfilter(c)
	return c:IsSetCard(SET_VOLCANIC) and c:IsTrap() and c:IsSSetable()
end
function s.damsetop(e,tp,eg,ep,ev,re,r,rp)
	local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,RACE_PYRO),tp,LOCATION_REMOVED,LOCATION_REMOVED,nil)
	if #g==0 then return end
	if Duel.Damage(1-tp,#g*500,REASON_EFFECT)>0
		and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil)
		and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
		local sg=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil)
		if #sg>0 then
			Duel.BreakEffect()
			Duel.SSet(tp,sg)
		end
	end
end
function s.damcon(e,tp,eg,ep,ev,re,r,rp)
	return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp)
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
	Duel.Hint(HINT_CARD,0,id)
	Duel.Damage(1-tp,500,REASON_EFFECT)
end