Most of the setup here is constants. I'll split them up by penalty type:
Rupee Loss Penalty:- DEATHPENALTY_RUPEE_LOSS_PERCENT: Percentage (0-100) of your rupees that you lose on death.
- DEATHPENALTY_NUM_RUPEEBAGS: How many rupee bags to create at the spot where you died. If 0, there will be no rupee bags and anything lost is gone forever. If >1 it's mostly a cosmetic effect.
- DEATHPENALTY_RUPEE_LOSS_IS_FIXED: If 1, DEATHPENALTY_RUPEE_LOSS_PERCENT will act as a fixed number of rupees to be taken instead of a percentage.
- DEATHPENALTY_MAGNETIZE_RUPEEBAGS: If 1, rupee bags will fly towards you when you get close.
- DEATHPENALTY_RUPEEBAGS_USE_DCOUNTER: If 1, rupee bags will gradually fill the counter, otherwise it's instantaneous.
- DEATHPENALTY_FAST_RUPEE_FILL: If 1, any draining or filling rupees with fill faster. This is a good idea if you're handling large amounts of rupees being lost or gained.
- SFX_DEATHPENALTY_RUPEEBAG: The sound that plays when you collect a rupee bag.
- CMB_DEATHPENALTY_RUPEEBAG: The combo used for the rupee bag's graphic.
- CS_DEATHPENALTY_RUPEEBAG: The cset used for the rupee bag's graphic.
Max HP Loss Penalty:- DEATHPENALTY_HP_REDUCTION_PERCENT: Percentage (0-100) total max HP that you can lose. For example if you set this to 25, max health won't drop below 75%.
- DEATHPENALTY_HP_REDUCTION_TIERS: How many stages there are to the health reduction. In other words how many deaths it takes to reach the minimum HP you can get.
- DEATHPENALTY_HP_REDUCTION_ONLY_FULL_HEARTS: If 1, the HP reduction will never cap HP at a non full heart increment. This can make what's going on less apparent but also looks cleaner.
- DEATHPENALTY_RUPEEBAG_REVERSES_HP_REDUCTION: If 1, picking up a rupee bag will undo the health reduction caused by that death.
- SFX_DEATHPENALTY_UNCURSE_CONSUMABLE: The sound that plays when you use an uncurse consumable.
- CR_DEATHPENALTY_HP_REDUCTION: The script counter storing the current HP reduction level (Script 1 by default). With this you can show the HP reduction on the subscreen.
- CR_DEATHPENALTY_HP_REDUCTION_CURES: How many HP reduction curing consumables you're currently holding (Script 2 by default).
To undo the effects of this penalty, there's an item script you can put on a consumable item. DeathPenalty_UncursePickup is for consumables that go into effect when you pick them up while DeathPenalty_UncurseConsumable is for ones you can carry in the inventory. Items carrying the second script should be set to increment the counter represented by CR_DEATHPENALTY_HP_REDUCTION_CURES in the editor.
Item Loss Penalty:
Setting up this one will require editing the script more directly. Find the function DeathPenalty_GiveTakeItems() and look for this part in particular:
//Examples
//ItemsToTake[17] = 2; //EXAMPLE: Blue ring - Taken forever
//ItemsToTake[6] = 1; //EXAMPLE: Sword 2 - Can be regained
For each item you want to be taken away on death, write a line below these comments like shown in the examples. The number in [ ] is the item you want taken away and the number after the = is the behavior. Putting a 1 after the = indicates that the item can be regained if you get the rupee bag from that death, while a 2 means it's gone forever.
Extra Counter Loss Penalty:
This setup is similar to the item loss one and allows for taking from other counters besides rupees.
- DEATHPENALTY_EXTRA_COUNTER_PENALTY_BASED_ON_MAX: If 1, extra counter penalties that are percentage based will be based on the max amount for the counter. Otherwise it'll be based on what you're currently carrying.
Find the function DeathPenalty_GiveTakeCounters() and look for this part:
//Examples
//DeathPenalty_TakeCounter_Percent(tc, CR_ARROWS, false, 50); //EXAMPLE: Takes 50% of arrows, can be regained
//DeathPenalty_TakeCounter_Exact(tc, CR_BOMBS, true, 5); //EXAMPLE: Takes 5 bombs, can't be regained
Use the same functions as the examples to set which counters should take what. The four arguments of the functions, separated by commas, go in the following order:
- tc - This is the the same for each instance. Just put tc like in the examples.
- The counter to take from - This is a numeric value for the counter you're setting. See CR_* constants in std_constants.zh.
- Whether or not it's permanent - If true, you can't get the counter item back from a rupee bag. Otherwise it's false.
- The value to take - If you're using the Percent function this is a percentage. Otherwise it's an exact value.
Misc:- DEATHPENALTY_ACTIVE_ON_F6: If 1, the penalty will go into effect if you F6. If you have this enabled, you'll also want to use the onContinue global script DeathPenalty_onContinue to ensure it doesn't activate when loading a save.
- DEATHPENALTY_RESET_F6_HP: If 1, the behavior seen in Isle of Rebirth where F6 leaves you with the same HP you had before goes into effect. Use this if you don't want people using it to heal.
- DEATHPENALTY_SPECIAL_DEATH_OVERRIDES_OLD_RUPEEBAGS: If 1, special cases where new rupee bags aren't created will still remove the old ones.
Compatibility with other scripts:
This will require a bit of scripting knowledge, but if you have another script that kills Link where you don't want rupee bags to drop, such as a bottomless pit, stick this function in the part where he dies:
DeathPenalty_DisableRupeeBags();
This script only requires std.zh.