Dingirsu,
2 Level 8 monsters
You can only Special Summon "Dingirsu, the Orcust of the Evening Star(s)" once per turn. You can also Xyz Summon this card by using an "Orcust" Link Monster you control as material. If a card(s) you control would be destroyed by battle or card effect, you can detach 1 material from this card instead. If this card is Special Summoned: You can activate 1 of these effects;
● Send 1 card your opponent controls to the GY.
● Attach 1 of your banished Machine monsters to this card as material.
local SETCARD_ID_0 = 0x11b --Orcust

local SETCARD_ID_0 = 0x11b --Orcust
local s, id, o = GetID()
function s.initial_effect(c)
	c:SetSPSummonOnce(id)
	--xyz summon
	aux.AddXyzProcedure(c, nil, 8, 2, s.ovfilter, aux.Stringid(id, 0))
	c:EnableReviveLimit()
	--effect
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
	e1:SetProperty(EFFECT_FLAG_DELAY)
	e1:SetTarget(s.tg)
	e1:SetOperation(s.op)
	c:RegisterEffect(e1)
	--destroy replace
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_DESTROY_REPLACE)
	e2:SetRange(LOCATION_MZONE)
	e2:SetTarget(s.desreptg)
	e2:SetValue(s.desrepval)
	e2:SetOperation(s.desrepop)
	c:RegisterEffect(e2)
end
function s.ovfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_LINK)
end
function s.ofilter(c)
	return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_MONSTER) and c:IsCanOverlay()
end
function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
	local b1 = Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, 0, LOCATION_ONFIELD, 1, nil)
	local b2 = Duel.IsExistingMatchingCard(s.ofilter, tp, LOCATION_REMOVED, 0, 1, nil)
	if chk == 0 then
		return b1 or b2
	end
	local off = 1
	local ops, opval = {}, {}
	if b1 then
		ops[off] = aux.Stringid(id, 1)
		opval[off] = 0
		off = off + 1
	end
	if b2 then
		ops[off] = aux.Stringid(id, 2)
		opval[off] = 1
		off = off + 1
	end
	local op = Duel.SelectOption(tp, table.unpack(ops)) + 1
	local sel = opval[op]
	e:SetLabel(sel)
	if sel == 0 then
		e:SetCategory(CATEGORY_TOGRAVE)
		Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, 1 - tp, LOCATION_ONFIELD)
	else
		e:SetCategory(0)
	end
end
function s.op(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local sel = e:GetLabel()
	if sel == 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
		local g = Duel.SelectMatchingCard(tp, Card.IsAbleToGrave, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
		if g:GetCount() > 0 then
			Duel.HintSelection(g)
			Duel.SendtoGrave(g, REASON_EFFECT)
		end
	else
		if not c:IsRelateToEffect(e) then
			return
		end
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
		local g = Duel.SelectMatchingCard(tp, s.ofilter, tp, LOCATION_REMOVED, 0, 1, 1, nil)
		if g:GetCount() > 0 then
			Duel.Overlay(c, g)
		end
	end
end
function s.repfilter(c, tp)
	return c:IsControler(tp) and c:IsOnField() and c:IsReason(REASON_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function s.desreptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		return eg:IsExists(s.repfilter, 1, nil, tp) and c:CheckRemoveOverlayCard(tp, 1, REASON_EFFECT)
	end
	return Duel.SelectEffectYesNo(tp, c, 96)
end
function s.desrepval(e, c)
	return s.repfilter(c, e:GetHandlerPlayer())
end
function s.desrepop(e, tp, eg, ep, ev, re, r, rp)
	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_EFFECT)
	Duel.Hint(HINT_CARD, 0, id)
end


Dingirsu,
2 Level 8 monsters
You can only Special Summon "Dingirsu, the Orcust of the Evening Star(s)" once per turn. You can also Xyz Summon this card by using an "Orcust" Link Monster you control as material. If a card(s) you control would be destroyed by battle or card effect, you can detach 1 material from this card instead. If this card is Special Summoned: You can activate 1 of these effects;
● Send 1 card your opponent controls to the GY.
● Attach 1 of your banished Machine monsters to this card as material.
-- Dingirsu,
local SETCARD_ID_0 = 0x11b --Orcust
local s, id, o = GetID()
function s.initial_effect(c)
	c:SetSPSummonOnce(id)
	--xyz summon
	aux.AddXyzProcedure(c, nil, 8, 2, s.ovfilter, aux.Stringid(id, 0))
	c:EnableReviveLimit()
	--effect
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
	e1:SetProperty(EFFECT_FLAG_DELAY)
	e1:SetTarget(s.tg)
	e1:SetOperation(s.op)
	c:RegisterEffect(e1)
	--destroy replace
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
	e2:SetCode(EFFECT_DESTROY_REPLACE)
	e2:SetRange(LOCATION_MZONE)
	e2:SetTarget(s.desreptg)
	e2:SetValue(s.desrepval)
	e2:SetOperation(s.desrepop)
	c:RegisterEffect(e2)
end
function s.ovfilter(c)
	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_LINK)
end
function s.ofilter(c)
	return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_MONSTER) and c:IsCanOverlay()
end
function s.tg(e, tp, eg, ep, ev, re, r, rp, chk)
	local b1 = Duel.IsExistingMatchingCard(Card.IsAbleToGrave, tp, 0, LOCATION_ONFIELD, 1, nil)
	local b2 = Duel.IsExistingMatchingCard(s.ofilter, tp, LOCATION_REMOVED, 0, 1, nil)
	if chk == 0 then
		return b1 or b2
	end
	local off = 1
	local ops, opval = {}, {}
	if b1 then
		ops[off] = aux.Stringid(id, 1)
		opval[off] = 0
		off = off + 1
	end
	if b2 then
		ops[off] = aux.Stringid(id, 2)
		opval[off] = 1
		off = off + 1
	end
	local op = Duel.SelectOption(tp, table.unpack(ops)) + 1
	local sel = opval[op]
	e:SetLabel(sel)
	if sel == 0 then
		e:SetCategory(CATEGORY_TOGRAVE)
		Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, 1 - tp, LOCATION_ONFIELD)
	else
		e:SetCategory(0)
	end
end
function s.op(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local sel = e:GetLabel()
	if sel == 0 then
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
		local g = Duel.SelectMatchingCard(tp, Card.IsAbleToGrave, tp, 0, LOCATION_ONFIELD, 1, 1, nil)
		if g:GetCount() > 0 then
			Duel.HintSelection(g)
			Duel.SendtoGrave(g, REASON_EFFECT)
		end
	else
		if not c:IsRelateToEffect(e) then
			return
		end
		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_XMATERIAL)
		local g = Duel.SelectMatchingCard(tp, s.ofilter, tp, LOCATION_REMOVED, 0, 1, 1, nil)
		if g:GetCount() > 0 then
			Duel.Overlay(c, g)
		end
	end
end
function s.repfilter(c, tp)
	return c:IsControler(tp) and c:IsOnField() and c:IsReason(REASON_BATTLE + REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
end
function s.desreptg(e, tp, eg, ep, ev, re, r, rp, chk)
	local c = e:GetHandler()
	if chk == 0 then
		return eg:IsExists(s.repfilter, 1, nil, tp) and c:CheckRemoveOverlayCard(tp, 1, REASON_EFFECT)
	end
	return Duel.SelectEffectYesNo(tp, c, 96)
end
function s.desrepval(e, c)
	return s.repfilter(c, e:GetHandlerPlayer())
end
function s.desrepop(e, tp, eg, ep, ev, re, r, rp)
	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_EFFECT)
	Duel.Hint(HINT_CARD, 0, id)
end

