Sorry, we don't have any way to make discounts on any one product dependent on purchase of another product.
You could put a discount code for Product Z in Product A's button, so clicking Add to Cart for Product A after Product Z had already been added to the cart would apply that discount, but there'd be nothing to prevent buyers removing Product A from their cart and keeping the discounted Product Z.
You could also offer a discount code on the thank-you page after Product A is purchased, which buyers could use when they place another order for Product Z later on, but there'd be nothing to prevent people sharing that code with others who could order the discounted Z without ever having ordered A.
You might consider making a third, "bundled" product that you'd understand to be a combination of A and Z at a special, package-deal price. If these products issue downloads or use Inventory Control, you could use Approach B described here to create the package-deal product: