Conditional Powers

Alice has a superpower, but she only gets to keep the power as long as she does (or doesn't do) a specific thing.

If the condition is too restrictive this can fall into Blessed with Suck or become a Weaksauce Weakness.

A Super-Trope of Virgin Power, where the something is not having sex. Compare No Man of Woman Born And Situational Sword.

Anime

 * In Darker than Black, Contractors need to perform a 'remuneration' of varying degrees of seriousness/irony, be it drinking beer, breaking their own fingers, baking a cake, or de-aging. Under rare circumstances, it is actually possible to 'pay off' the contract in full--.
 * In Nana of Banana those with powers have a condition they must follow, for example the protagonist, Nana, has to eat bananas still in their skin the day after she uses her power to manipulate bananas.
 * In the anime and manga of El Hazard, the teacher Fujisawa has super-strength so long as he can refrain from drinking alcohol. In the anime,
 * A specific mechanic with Nen abilities in Hunter X Hunter is turning your power into this. By limiting the conditions in which you can use an ability and/or impose penalties for not using them within those conditions, a Nen user can multiply their Nen ability's power several times over.

Comic Books

 * In Scott Pilgrim, being a Vegan gives you psychic powers by freeing up the remaining 90% of Your Brain, as demonstrated by Todd Ingram, the third evil ex-boyfriend.
 * They're surprisingly lenient about it in the film compared to other examples of this trope. You get multiple screw ups before there are consequences.
 * On the other hand, one of the infringements they punish Todd is accidental, thanks to a Poison Chalice Switcheroo. The others are stated to be mistakes on Todd's part, as he was unaware that gelato contains milk and eggs (something he was fully aware of in the comic) and that chicken is a meat.

Film - Live Action

 * The Invisible Boy of Mystery Men can only turn invisible if no one is watching. This turns out to mean living, sapient beings; when it's necessary for him to be invisible to pass an electronic sensor, he can.

Literature

 * Thieves' World stories. Each Adept of the Blue Star has a Dark Secret, and if an Adept's secret is spoken aloud, he will lose his powers.
 * In Talking to Dragons Daystar accidentally makes Shiara's powers only work when she is polite. She does not like this one bit.
 * Bitter Seeds by Ian Tregillis features a team of psychic children. Their powers require electrical batteries wired into their brains. As long as the batteries are charged, they can burninate and phase-shift to their hearts' content. Once they run out of juice though ...
 * In Wizard of the Pigeons by Megan Lindholm, the wizard and his colleagues each have a condition on which their powers depend. (One, for instance, may not use her powers to help others unless they ask her to.) Some of the wizard's troubles in the book result from him forgetting which of the rules he lives by is the condition, and which are just rules he's given himself.

Mythology

 * This trope dates back to the notion of the Geas, a boon granted by a supernatural being that bound one to certain rules. Cu Chulainn was bound by two such laws: one, he could never partake of dog meat, and two, he would always accept hospitality when offered. His downfall came when a hag offered him a meal of dog meat, forcing him to break his geas.
 * A Native American legend features a man who has a "can't be hit by bullets as long as I don't touch metal" power, which was nullified by accidentally touching a ladle.
 * Antaeus was the son of Poseidon and Gaea, who remained invincible as long as he was in contact with earth. Hercules had to hold him off the ground to defeat him.
 * Samson in the book of Judges had Super Strength in exchange for a number of promises to God, including not cutting his hair. When he tells his secret to his lover (who has already tried to exploit various fake weaknesses), Delilah, she betrays him and has him shaved, and he lost his strength.

Tabletop Games

 * Many magic schools in Unknown Armies work this way.
 * Shadowrun mages often prevent magic loss by accepting something like this being applied to their magic. They can be as simple as needing to chant while casting spells to needing to not eat anything for 24 hours or needing to be in a forest/city/desert/whatever.
 * A standard way to build power modifiers in GURPS is to take a Vow, then add the point value of the Vow to the power modifier, to reflect the fact that your power goes away if you break the Vow. Vows are disadvantages worth negative points, so your power becomes cheaper this way, to make up for it being harder to keep.
 * Many classes in Dungeons and Dragons, especially ones that grant powers with a divine power source. Paladins are arguably the most well-known example; if a paladin knowingly performs any act that isn't Lawful Good, his paladin powers are stripped from him until he atones. But the Forsaker probably takes the cake as it requires you to destroy magic items daily to maintain your powers.
 * In The Dresden Files RPG, Items of Power and Sponsored Magic tend to come with restrictions on how and when they can be used. The most obvious for Items of Power is that the item has to be in your possession to use the powers. Some sponsored magics will only work for certain ends—a demon might grant a character a bonus to their spellcasting power, but only if they're using that spell to kill, for example. In other cases, it's a little more lenient, and will only not work for certain things—a Sword of the Cross, for example, will work for just about any ass-kicking so long as it's a righteous ass-kicking for the cause of good, but will stop working and drop out of the user's hands of its own accord if the wielder tries to use it for selfish or evil reasons.

Toys

 * Bionicle: Kanohi Masks of Power grant the wearer powers as long as they is worn.

Web Animation

 * In Homestar Runner, Bubs apparently had the ability to fly (or at least hover a few inches off the ground) until Strong Bad got him to say "sbu".

Western Animation

 * Part of the shtick in The Wild Thornberrys was that Eliza was given the power to talk to animals—and if she revealed the fact to anyone, she would lose the ability.
 * Timmy's access to The Fairly Odd Parents has the same condition.
 * Sabrina the Animated Series: it's not a direct problem for a witch to reveal his/her witchiness to a mortal, but if that mortal tells another mortal, the witch gets depowered.
 * Raven from Teen Titans can only manifest her most dramatic magical abilities while feeling particularly strong emotions- something she deliberately avoids, as this also leaves her open to Power Incontinence and/or possession by her Super-Powered Evil Side.
 * Puck from Gargoyles eventually has a geas laid on him that he can only use his magic to teach or protect Xanatos's infant son Alexander. Otherwise, he's just.