dofile("scripts/entities/entityinclude.lua")

n = 0

function initFinalSpirit(flag, name)
	if getFlag(flag) > 0 then
		ent = getEntity(name)
		if ent ~= 0 then
			entity_delete(ent)
		end
	end
	if isFlag(flag, 1) then
		ent = createEntity(name, "", entity_x(n), entity_y(n))
		entity_setState(ent, STATE_FOLLOW, -1, true)
	end
end

function initFinalSpirits()
	n = getNaija()
	initFinalSpirit(FLAG_SPIRIT_ERULIAN, "Erulian-Final")
	initFinalSpirit(FLAG_SPIRIT_KROTITE, "Krotite-Final")
	initFinalSpirit(FLAG_SPIRIT_DRASK, "Drask-Final")
	initFinalSpirit(FLAG_SPIRIT_DRUNIAD, "Druniad-Final")
end
