tModLoader Lives & Injury

hamstar

Terrarian
Wtg5BvU.png

Lives v2.1.1.2 (Mirror)

Injury v2.1.1.1 (Mirror)


Note: Requires Mod Helpers


These are two mods made for adding a deeper concept of mortality for the game. Lives adds a limit to the number of allowed deaths (until a 'hardcore' final death), and Injuries lets you attain permanent injuries (loss of maximum HP) from a small portion of damage received. Falling from high places and generally becoming low on health have additional effects, also.

Being injured produces 'Broken Hearts' that can be recovered within a time limit, and crafted into new Life Crystals or Cracked Life Crystals to restore lost health (see below).

New to Lives (v2.0.0): Settings now exist to implement "continues", with various configurable effects for running out of lives.

You may adjust mod settings in the respective configuration files found in 'Documents/My Games/Terraria/ModLoader/Mod Configs'.

m = current max health
n = damage taken

(0.75 + (m/400)) - (n / 15), in 5 unit chunks

  1. uFFeoi4.png
    1-Up- (Lives) Adds a new life. Crafted anywhere with:
    1. 1 Life Crystal OR 4 Life Fruits
    2. 1 Guide Voodoo Doll
    3. 15 Gold Coins
  2. D2u5U4Y.png
    Vitae- (Injury) Life extract. Painfully extracted. Crafted (with a slight risk of summoning evil spirits) at a demon altar with:
    1. 1 Broken Heart
    2. 1 Living animal (any)
    3. 1 Mushroom
  3. VPTF1zz.png
    Cracked Life Crystal- (Injury) Recovers +20 max health temporarily. Crafted at a crafting bench with:
    1. 2 Vitae
    2. 10 Ruby Gemspark Block
  4. HnEaVcB.png
    Life Crystal- (Injury) Recovers +20 max health permanently. Crafted at a crafting bench with:
    1. 4 Vitae
    2. 4 Shadow Orbs OR 4 Tissue Samples
    3. 10 Ruby Gemspark Block
  5. igvDZYB.png
    Band of Life- (Injury) Generates max health over time (up to 400). Crafted at a crafting bench with:
    1. 1 Band of Regeneration
    2. 4 Life Crystals
    3. 10 Vitae
  6. 1LUdaGh.png
    Fortitude Potion- (Injury) Adds resistance to injury. Crafted at a bottle/alchemy station with:
    1. 1 Bottled Water
    2. 1 Vitae
    3. 1 Bone
    4. 1 Shadow Orb OR 1 Tissue Sample
  7. bKIU4F3.png
    Heartstrings - (Injury) Broken hearts drop nearer and last longer. Crafted at a tinker's workshop with:
    1. 20 Bee's Wax
    2. 1 Shadow Orb/Crimson Heart (light pet)
    3. 1 Rainbow String
  8. IJX7P9c.png
    Enriched Vitae - (Injury) Enriched life extract. A drink to die for (literally; highly toxic). Increases max hp by 5 (up to 500). Crafted 5xat a bottle/alchemy station with:
    1. 3 Wandering Hearts
    2. 2 Vitae
    3. 1 Pink Prickly Pear
  9. T3ciIob.png
    Life Vest - (Injury) Fortifies against injury. Also works as a floatation device. Crafted at a tinkerer's workshop with:
    1. 10 Silk
    2. 50 Bubble block
    3. 5 Shroomite bar
    4. 10 Enriched Vitae
  10. J4GikHK.png
    Band of Afterlife - (Injury) Slowly fills maximum life (up to 500). Regeneration stacks with Band of Life. Broken Hearts drop closer and last longer. Crafted at a tinkerer's workshop with:
    1. 1 Band of Life
    2. 1 Heartstrings
    3. 20 Enriched Vitae

Installation

Requires tModLoader (+0.11). Copy the above .tmod files from the above .zip files into your 'Documents/My Games/Terraria/ModLoader/Mods' folder to play.

Source code available for lives and injury. Injury's API and Lives' API now available (now with Mod.Call() bindings).

Note for mod authors: Mods can freely adjust in-game config settings programmatically via. weak reference/API, but they are not automatically saved to file.


Potential future plans
  • Remove fall damage negation in favor of simply reduction (i.e. Lucky Horseshoe isn't perfect protection)
  • Add more diverse kinds of injuries


v2.1.1.2
  • Fixed incorrect ModContent.GetInstance call in ExtraLifeItem.ConsumeItem
v2.1.1.1
  • Updated internal code conventions (especially for MH updates)
v2.1.1
  • Updated for TML 11.5
  • Added ranges to some config settings
v2.1.0
  • Updated to TML11.4 and MH5b
v2.0.1
  • Changed to PacketProtocol-based net code (untested)
  • Relocated LivesPlayer connect code to new code file
  • Minor internal refactoring
  • Added lives reset after settings sync on join to server (if player created anew)
  • Fixed "continue" message flooding itself out of chat
v2.0.0
  • Refactored draw code to use config settings for positioning of lives display
  • Added mediumcore-with-revert value to "SignalDifficultyChange"
  • Implemented "continues"
  • Added config settings for effects to occur on "continue"
  • Restructured LivesPlayer "mortality" stuff into new code files (in particular, decoupled this code from PreKill hook)
  • Refactored UI display stuff for better form
  • Implemented "continues" drawing
  • Added inbox message about continues
v1.6.2.1
  • Updated to MH v4.2.3 (including conventions)
  • Switched snake case to camel case
v1.6.1
  • Updated to Mod Helpers v2.0.2
  • Added API Mod.Call() bindings
  • Restructured player code file
  • Added MP player load bug failsafe
v1.6.0.1
  • Added mod icon
  • Added support for Hamstar Helpers v1.2.0 issue report
  • Refactored net protocol
  • Added API
v1.5.4
  • Updated for TML 0.10
  • Offloaded utility/helper code to Hamstar's Helpers mod (now a dependency)
  • Numerous fixes and tweaks
v1.5.3
  • Fixed a possible premature immortality bug.
v1.5.2
  • Added config setting 'Enabled' (allows disabling mod without unloading)
v1.5.1.1
  • Minor refactoring.
v1.5.0-1
  • Moved config file to Mod Configs subfolder.
  • Fixed a possible bug that would get players stuck in hardcore mode.
  • Altered 1-Up item sprite.
  • 1 life left = last life
v1.4.6
  • Fixed config reloading between game sessions.
v1.4.4
  • Fixed major saving bug.

v1.4.2
  • Fixed possible saving glitch.
  • Improved code.
v1.4.0
  • Added 15 gold coins to the default 1-Up recipe.
  • Life Fruits also work to craft 1-Ups in the place of Life Crystals.
  • Added numerous options for configuring the 1-Up recipe.
v1.3.2-3
  • Added proper multiplayer support.
  • Exposed classes for DLL reference use. No gameplay changes.
v1.3.0-1
  • Updated to TML 0.9
v1.2.0
  • Added 1-up craftable (Life Crystal + Guide Voodoo Doll). Can be configured.

v2.1.1.1
  • Fixed some incorrect ModContent.GetInstance uses
v2.1.1
  • Update to TML11.5
  • Implemented FloatInputElement for config
  • Changed config ranges to not use extremes
v2.1.0
  • Updated MH recipe groups
  • Fixed MH recipe group typos
v2.0.4
  • Updated to TML11.4 and MH5b
  • Updated for Mod Helpers v2.0.2
  • Added MP player load bug failsafe
v2.0.3
  • Changed Enchanced Vitae recipe to require Strange Plants (instead of Prickly Pears)
v2.0.2
  • Added alternate Vitae recipe using Life Crystals (4:1)
  • Added Wandering Heart recipe using Life Fruits (1:1)
  • Assorted internal refactoring
  • Added SaveModSettingsChanges to API
  • Added Mod.Call() bindings for API
  • Altered Enriched Vitae recipe to craft +2 for an additional +1 Vitae and +1 Wandering Heart
v2.0.1
  • Added Band of Afterlife - Slow recovers up to 500 max hp
  • Added Heartstrings - Lets dropped broken hearts last longer
  • Added Life Vest - Adds resistance against injury
  • Added Wandering Heart (item and projectile)
  • Added Vitae
  • Added Enriched Vitae
  • Added injury on death (also config option)
  • Wandering Hearts replace Broken Hearts when over 400 hp
  • Vitae (made from Broken Hearts) is now used to craft Life Crystals
  • Removed definitions for Fortitude Bracer, Heart Catcher, Heart Mender, Life Line, Hearty Soup, Life Cereal
  • Added Vitae crafting risk (spawns wraith + applies curse)
v1.10.0
  • Added mod icon
  • Added support for Hamstar Helpers v1.2.0 issue report
  • Refactored net protocol
  • Updated impact trauma buff icon
  • Added API
v1.9.5
  • Updated for TML 0.10
  • Offloaded utility/helper code to Hamstar's Helpers mod (now a dependency)
  • Numerous fixes and tweaks
v1.9.4
  • Added 'Enabled' config setting (disables mod without unloading)
v1.9.3
  • Added some config options.
  • Set some classes public.
v1.9.2
  • Increased duration for broken hearts (16 -> 24 seconds)
  • Prevented use of Cracked Life Crystals at full hp
  • Various bug fixes
v1.9.1
  • Players no longer incur harm from hits <20% max hp when at full health.
  • Set broken hearts not to fly as far away on hit.
v1.9.0
  • Added better visibility for Broken Hearts
  • Added larger pickup range for Broken Hearts
  • Added Cracked Life Crystals (craftable from Broken Hearts); gives +20 temporary health
  • Moved config file to 'Mod Configs' subfolder
  • Assorted code improvements
v1.8.4
  • Fixed config reloading between game sessions.
v1.8.3
  • Bleeding Heart projectile's duration increased + configs added.
v1.8.2
  • Added a lot of new config options to fine tune max health loss, and renamed existing ones for readability.
  • Rebalanced Band of Life (now requires Regen Potions to craft).
  • Added Broken Hearts that drop from own injuries that can be used to craft Life Crystals anew (32 Glass + 4 Tissue Samples/Shadow Scales + 4 Broken Hearts + 10 Regen Potions).
v1.7.0
  • Added craftable Band of Life: Slowly recovers max hp (Band of Regen + 5 Life Crystals + 10 Pixie Dust)
v1.6.2-3
  • Tweaked default damage settings (updates config).
v1.6.0
  • Nurse removes injury buildup.
  • Formula tweaked to factor in armor, but also scaled down:
    • ((0.75 + (m/400)) - n / 20), in 5 unit chunks
  • Improved code.
v1.5.0
  • Added max health loss harm FX (sound + blood).
  • Modified harm formula to slowly erode buildup with time (AKA accumulated damage before losing a chunk of max health).
  • Modified harm formula to let higher max health absorb more hits before taking harm.
v1.4.2-3
  • Added proper multiplayer support.
  • Exposed classes for DLL reference use. No gameplay changes.
v1.4.0-1
  • Updated to TML 0.9

Lives.png
Injury.png


 
Last edited:
That's a nice idea! I won't personally use it because I'm not really a person who likes challenges like this, but it sounds like something people would enjoy
 
i checked for the config but i didn't see the lives one there and i only had 1 life and i died, can you help? other than that its a great mod
 
i checked for the config but i didn't see the lives one there and i only had 1 life and i died, can you help? other than that its a great mod
It appears the config file saves when the mod unloads. Try reloading all mods. I'll fix that shortly.
 
I'm interested, but also afraid. What's the full extent of the Injuries mod? I kind of want to enable it for my current playthrough, but I'm not sure if they will throw a lot of curveballs at me.

Actually, I still want more info on this, but I think I'm gonna man up and enable it.
 
That's the spirit! Also, here's the fixed versions (with a few minor tweaks to fall injuries):
 

Attachments

  • Injury v1.3.5.zip
    6.3 KB · Views: 363
  • Lives v1.1.2.zip
    7.5 KB · Views: 300
No max HP recovery yet, but I did add craftable 1-ups (Life Crystal + Guide Voodoo Doll):
 

Attachments

  • Lives v1.2.0.zip
    8.9 KB · Views: 287
Last edited:
I haven't enabled this mod yet but do you think using Life Crystals to recover your lost hp would be good for single player at least? There are lots of Life Crystals. Lets say you have 87 max health because of injuries; you use 1 Life Crystal to make it 88 or 90 or 95 or 97.Then when it is close enough to your vanilla max health value (lets say it is beginning of game and 100hp), you use another one to complete to 100, then Life Crystal functions as normal like vanilla and your max life becomes 120hp then 140hp... Until you get injured again and Life Crystals start to recover lost max HPs. I am thinking you would get injured lot of times and some other mods may also use Life Crystals for recipes, so this would give player a challenge to choose between max health and that recipe. Also number and placement of Life Crystals on a world creates a challenge. And that makes player dig/discover more areas on a world which he wouldn't need to normally.
 
Life Crystals do recover health. They're the only way to do so, until you can get Life Fruits.

Edit: New version to expose classes for DLL use. No gameplay changes.

Edit Edit: Also multiplayer. Just 'cause.
 

Attachments

  • Injury v1.4.3.zip
    7.4 KB · Views: 313
  • Lives v1.3.3.zip
    10.1 KB · Views: 292
Last edited:
My suggestions for the mods!
Isn't the 1-up craftable a little too easy to craft? And where does one craft it? In my opinion they should be crafted in Demon/Crimson Altars only.
Also no idea how difficult this is to apply: But I think the 1-up should be find-able in other sources too. It's a long way to Hell at early game. Maybe getting them from Gold Chests/Fishing Crates/Rare pot drop too? Or a rare boss drop would work too.



The injury mod is perfect tho. It makes Life Crystals finally useful. You know, after you get full life they become trashable junk. But now I need to constantly keep them around. And this makes me explore ALL of the world. This is one of the best mods I have seen and I wish everyone would give it a go at least once.
 
One thing to consider is weighing crafting of 1-Ups vs. use for healing (if both mods enabled), since they're both dependent on Life Crystals (until you can get stocked up on Life Fruits, maybe). Other than that, I could add a configuration for a 'hard' crafting recipe for 1-Ups. Added pink gel? Dungeon keys? Strange Plants? 10 gold coins? Large gems? Large amber gems? Angel Statues?
 
Last edited:
One thing to consider is weighing crafting of 1-Ups vs. use for healing (if both mods enabled), since they're both dependent on Life Crystals (until you can get stocked up on Life Fruits, maybe). Other than that, I could add a configuration for a 'hard' crafting recipe for 1-Ups. Added pink gel? Dungeon keys? Strange Plants? 10 gold coins? Large gems? Large amber gems? Angel Statues?

Extra lives should be something extremely rare tho. I think they should instead be a hard-to-get item from chests/pots/crates/expert bags.
If you craft them, they should need something like 10 life crystals and/or 1-3 lifefruits or so.
 
Injury v1.5.0:
  • Added max health loss harm FX (sound + blood).
  • Modified harm formula to slowly erode buildup with time (AKA accumulated damage before losing a chunk of max health).
  • Modified harm formula to let higher max health absorb more hits before taking harm.
Lives v1.4.0
  • Added 15 gold coins to the default 1-Up recipe.
  • Life Fruits also work to craft 1-Ups in the place of Life Crystals.
  • Added numerous options for configuring the 1-Up recipe.
 

Attachments

  • Injury v1.5.0.zip
    8.6 KB · Views: 310
  • Lives v1.4.0.zip
    10.2 KB · Views: 283
Hey! I thought on something neat that might be on your alley!

What about a "disease/illness" mod?

"Ill" is an special, permanent debuff that could cause the following:
"Slows down the player horizontal speed (Half the effect of Chilled), causes the player's Physical abilities to decrease (Like Weak) and reduces total Magic Damage by 25% (Akin to how Mana Sickness reduction's work)."

The only way to remove is by talking to the nurse and be treated, since it's a debuff. (Maybe you could make an expensive "medicine" item that could remove it, or a cheap "bandage" item that COULD remove it)
It lingers even if the player dies.


How could you get ill? By many means
  • At a low chance, while you are in the Tundra biome, and not close to any NPC. The chances increasing the more time you spend there, going up to 100%. This can be prevented if you consume a Warmth Potion or wear Hand Warmer/Ankh Shield/Eskimo Armor
  • At a 1% chance when a Slime enemy inflicts melee damage on the player
  • Inflictable by enemies who also inflict the "Poison", "Venom" and "Feral Bite" debuffs, at a random chance (Except Queen Bee's touch attack, Bee, Brain of Cthulhu, Creeper, Dart Trap, Super Dart Trap)
  • Drinking a Red's Potion. And maybe a new item you could create: "Rotten food" or "Illness potion".
  • At a low chance, while you are in the Corruption or Crimson biome. The probabilities increase the more time you spend there, going up to 100% eventually.
  • At an extremely low chance, while it's raining or blizzard and the player is in the surface (stacks with other area-related illness causes). Could be avoided by wearing the complete Rain armor. Meanwhile, an Umbrella Hat could lower the chances of getting ill in rain.
  • At a very, very, very low chance. During each game's tick.

What do you think of this mod idea? It would make the nurse needed and useful. But it might need a little bit of coding... And I have no idea how difficulty would that be to apply.

I also have more suggestions for this "mod idea". But they might be too much.
 
Last edited:
So, after playing a while I have noticed I barely get injuries anymore.
Is the formula far too forgiving now or what? Back then I would get wounds all the time.


Also... Could there be a way to make the nurse remove some "injury buildup"? It seems weird that injury buildup heals so quickly. I literally do not get any injury any more, and this is odd. It's also weird that a NURSE cannot heal injuries.
 
Injury 1.6.0:
  • Nurse removes injury buildup.
  • Formula tweaked to factor in armor, but also toned down (m=max hp, n=damage):
    • m = m - ((0.75 + (m/400)) - n / 20), in 5 unit chunks
  • Improved code.
Lives 1.4.3:
  • Fixed possible saving glitch.
  • Improved code.
 

Attachments

  • Injury v1.6.0.zip
    9 KB · Views: 258
  • Lives v1.4.3.zip
    11.5 KB · Views: 285
Last edited:
Lives 1.4.4-5: Fixed a major bug with saving (sorry, player data saving code was giving me all sorts of confusions)

Injury 1.6.2-3: Tweaked default settings (config file will update)
Injury 1.7.0: Added craftable Band of Life (slowly restores max hp)
 

Attachments

  • Lives v1.4.5.zip
    11.5 KB · Views: 324
  • Injury v1.6.3.zip
    9.2 KB · Views: 272
  • Injury v1.7.0.zip
    11 KB · Views: 283
Last edited:
Back
Top Bottom