This check won't work if the entity extends ig.EntityLevelChange. ig.game.spawnEntity returns the entity created, so this should probably be an instanceof check of the returned value instead.