I drew this up for you... open it in a new window and follow along.![]()
1. The relay is energized from the ignition switch being ON.
2. The relay get's it's switchable power from the headlight circut 12V+.
3. When the ignition switch is OFF, the relay is not energized and allows 12V+ from headlights to flow across the NC (normally closed) terminals of the relay, to one terminal of buzzer, piezo or whatever.
4. When the door is opened, the pin-switch gets grounded and that ground is then supplied to the other terminal of the buzzer and it goes BZZZZZZZZ!
Let me know if your door switch is switched POSITIVE and I'll show you how to put one more relay in the circut to invert the voltage.