Magic mouth
From Ardrana
When magic mouth is cast, the wizard imbues the chosen object with an enchanted mouth that suddenly appears and speaks its message when a specified event occurs. The message, which must be of 25 words or less, can be in any language known by the spellcaster, but cannot be used to cast magical spells or trigger command words. It does, however, move to the words articulated -- if it is placed upon a statue, the mouth of the statue would actually move and appear to speak. Of course, the magic mouth can be placed upon a tree, rock, door, or any other object, excluding intelligent members of the animal or vegetable kingdoms.
The spell functions when specific conditions are fulfilled, according to the command of the spellcaster. Some examples are to speak "to the first creature that touches you," or "to the first creature that passes within 30 feet." Commands can be as general or as detailed as desired, although only visual and audible triggers can be used, such as the following: "Speak only when a venerable female human carrying a sack of groat clusters sits cross-legged within 1 foot." Such visual triggers can react to a character using the disguise ability, but cannot distinguish invisible creatures. If desired, the effect can be keyed to a specific noise or spoken word.
Note: This version of magic mouth originally appeared in the 2nd Edition Player's Handbook for Advanced Dungeons & Dragons from TSR. Its use here is for the purposes of providing context for the campaign only.