Prompted by this answer, is it possible for your death to trigger a Contingency? If you're dead, how does the spell activate, and if it's then casting another spell, is it possible for that to happen if you as the spellcaster are dead?
[RPG] Can the trigger for Contingency be your own death
character-deathdnd-5espells
Related Solutions
A Glyph wards an area or an object. While the trigger can be refined to be conditionally dependent on (almost) anything you want it still probably necessarily needs to interact with the area or object you've warded:
You decide what triggers the glyph when you cast the spell. For glyphs inscribed on a surface, the most typical triggers include touching or standing on the glyph, removing another object covering the glyph, approaching within a certain distance of the glyph, or manipulating the object on which the glyph is inscribed. For glyphs inscribed within an object, the most common triggers include opening that object, approaching within a certain distance of the object, or seeing or reading the glyph. Once a glyph is triggered, this spell ends.
The above quote, preceeding the section on refining the trigger, does not indicate that the trigger can be anything but rather that it can be lots of things and also lists several things it definitely can be. If you go outside that list for the basic trigger, you need to confirm with your GM that the new trigger is possible. Unlike the open-ended section on refining triggers, it is not the case that the basic trigger can accomplish what you want.
Furthermore, there is historical precedence for it not doing so; Glyph of Warding in earlier editions of the game, while always very open ended, specified some version of the following clause (taken from AD&D 2.0):
A Glyph of Warding is a powerful inscription magically drawn to prevent unauthorized or hostile creatures from passing, entering, or opening.
which indicates the general scope of potential triggers-- they must in some way relate to the warded object or area. Refinement, however, is not nearly so limited.
This means the following death triggers are possible:
This Glyph, placed above a doorframe, triggers upon any creature entering if Aroden is dead.
This Glyph, placed upon the floor of the room, triggers if Aroden is killed while inside the warded area.
This Glyph, placed upon the surface of Aroden's back, triggers upon his death
But the following triggers probably don't work:
This Glyph, placed upon the wall of the study, triggers upon Aroden's death
This permanent Glyph, placed upon the ceiling of the sitting room, creates a bright flash of light each time a creature dies.
In conclusion it's not proximity but interaction that matters, but proximity is usually a prerequisite of interaction. Non-local parts to trigger's refinement are fine, but the trigger itself (very probably) has to involve the warded object or area in some way.
Addendum for the specific purpose of dead-man-switching a WMD:
You can do this with the spell, and it is very appropriate. What you want is a glyph on each weapon that triggers "When a person not bearing the Royal Seal attempts to move, activate, or dispel the object, or if the object is moved, activated, or subjected to dispelling forces in any way and I am dead", and then you just tell the kingdom about the first part. You can't make the devices trigger upon your death but you can make them (and any other devices you feel so inclined to affect) work fine until you die and then turn upon their masters if they are ever used past that point. Basically, you are creating a cursed item whose curse's activation is delayed until your death.
This kind of warding, though, is still somewhat risky, since the glyph can be dispelled if the dispelling is done carefully, and then replaced with you none the wiser.
You could also ward yourself with a (surface, and thus mobile) Glyph that triggers when someone approaches or strikes the surface with the intent to kill you, and have that Glyph somehow remotely trigger the deadman operation via your choice of long-range communication spells and recievers, but you should be aware such a measure can be triggered against your wishes by a clever opponent of your home nation, or bypassed via clever assassination methods (e.g. poison for the specific wording I mentioned)
Basically, this does almost exactly what you want it to for your linked answer, but is a lot less infallible than you might have first thought.
Stone Casting Likely Allowed, but there is case for No.
The Reserve Ioun Stone only states that:
While this stone orbits your head, you can cast any spell stored in it.
There is no difference in casting language between the stone or a spell naturally, just that you can cast any spell stored in it.
However, there is a case against this with the requirement of expending a spell slot (see below.)
If allowed, this is an excellent way to expand the list of possible Contingent spells outside of the traditional Wizard spell list.
Next is to look at the requirements of Contingency
Choose a spell of 5th level or lower that you can cast, that has a casting time of 1 action, and that can target you. You cast that spell—called the contingent spell—as part of casting contingency, expending spell slots for both, but the contingent spell doesn’t come into effect.
What happens here is that you have cast both Contingency as well as the spell from the Ioun Stone (assuming it passes the criteria of 1 action casting time and targets only yourself).
Do note that this frees up the space in the Ioun Stone as the spell has been cast.
The spell cast from the stone is no longer stored in it, freeing up space.
The contingent spell is fully cast and just waiting to come into effect. There is nothing more needed for the spell to take effect other than the trigger provided.
To answer your specific questions:
Does having the spell stored in such a way count as a spell "you can cast"?
Yes, the language is identical between casting from an ioun stone or casting naturally.
Does the fact that the spell is stored in an item mean that it can't be cast as part of another spell as Contingency requires?
There is nothing to suggest this given the casting language is identical.
Is there any other reason why this would not work?
The main remaining concern is the requirement from Contingency of
expending spell slots for both [Contingency and the spell to be triggered].
If it is required for a spell slot to be used, then using the Reserved Ioun Stone will not qualify as there is no spell slot expended.
I think this is a bit of a stretch, but a strict RAW reading may preclude the use of the Stone with Contingency because it failed to expend the spell slot.
This concern is similar to Ring of Spell storing requiring a spell slot to be expended when casting a spell into it. Jeremy Crawford confirms that here
It requires a spell slot. A wand doesn't expend a spell slot.
Comparison to other Items:
The Ring of Spell Storing also uses similar language and should be able to be used in this way as well.
While wearing this ring, you can cast any spell stored in it.
This is an example of something that would not work with contingency. The language here requires an action to cast Hat of Disguise.
While wearing this hat, you can use an action to cast the disguise self spell from it at will.
Best Answer
Per Contingency, when you cast Contingency, you also cast the contingent spell, but it doesn't go into affect until the trigger event occurs.
So as long as your death doesn't cause the statuette to be destroyed or removed from your dead body, then your 5th level or lower spell should fire. Since you've already cast it and the contingent spell is just being held in check until the contingency event triggers the spell's release.