Our hospital cat tries to scoot out the front door and loves to sit on top of other cats’ carriers. We have a portable transmitter with an adjustable radius. When our cat gets within that radius, his collar beeps, then shocks him briefly if that beeping is ignored. He knows to avoid that area when wearing the collar. When not wearing it, he knows he can roam freely. Search “radio fence”. You can get additional collars if multiple cats, additional transmitters to cover separate areas, or the actual fence, running a perimeter wire.