It sounds like you're asking about covenants / vaults. It would be cool if that functionality was available... https://blog.casa.io/why-bitcoin-needs-covenants/