You are viewing a potentially older version of this package. View all versions.
McHorse-SelfReviveUpgrade-1.0.0 icon

SelfReviveUpgrade

Adds a self revive upgrade to the shop

Date uploaded 2 days ago
Version 1.0.0
Download link McHorse-SelfReviveUpgrade-1.0.0.zip
Downloads 1729
Dependency string McHorse-SelfReviveUpgrade-1.0.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2305 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2305
Zehs-REPOLib-3.0.4 icon
Zehs-REPOLib

Library for adding content to R.E.P.O.

Preferred version: 3.0.4

README

Self Revive Upgrade

A simple mod that adds self-revival upgrade. You buy this expensive upgrade in the shop, and then use it. You get a stack of SELF REVIVE. Once you die, and you have more than one SELF REVIVE stacks, that stack decreases and respawns you with all of the items in your inventory in the truck.

This mod relies on REPOLib to add the upgrade and the item upgrade.

How to make new upgrades

It's been a quite complicated journey, so I'd like to share how I achieved adding an upgrade in REPO with REPOLib.

  1. I started with setting up Unity project with REPOLib. Install dotnet 9.*, install Unity Hub, and follow this and this tutorials to get Unity project working.
  2. Create a new folder in the Assets/ for your mod name.
  3. Create a new REPOLib > Mod in your mod folder.
  4. Follow this tutorial to create ItemContent, Item Prefab and Item. See below for more information on how to setup that.
  5. Export the mod like instructed here.
  6. In your .csproj include the bundle like <ItemGroup><EmbeddedResource Include="bundle\selfreviveupgrade"/></ItemGroup>.
  7. In your repoharmony mod, you can load the bundle from embedded bundle, see SelfReviveUpgrade.RegisterBundledItemAndUpgrade() for more information.
  8. Register your upgrade and item with REPOLib as well.

And that should be it! The rest is up to you what you are going to do with the logic.

Setting up Item prefab

While creating ItemContent and Item is covered by the wiki, it was a bit tricky to setup the item prefab (the object itself), so here is a breakdown:

  1. Copy over following resources from REPO to your mod:
    • Assets/REPO/Game/Prefabs/Item Upgrae Player Grab Strength.prefab
    • Assets/REPO/Game/Materials/upgrade_strength.mat
    • Assets/REPO/Game/Textures/Texture2Ds/Upgrade_Grab-Strength_Albedo.png
  2. Use albedo as a reference for your own upgrade. I drew mine in Krita.
  3. Open the material (.mat) and drag and drop albedo into Albedo in the sidebar.
  4. Open (double click) the prefab .prefab, and find in the Hierarchy Mesh. Expand Materials and drag and drop over your .mat copy (it took me a while to make my prefab display the correct texture).
  5. While stile being in the .prefab, click the root element in Hierarchy (in my case it was Item Prefab, and in Inspector you should see Photon View, Item Upgrade (Script), Item Toggle (Script) and other components).
    • Remove Item Upgrade Player Grab Strength (Script).
    • Add a component named REPO Lib Item Upgrade (Script), and in Upgrade Id specify the ID of an upgrade you'll register with REPOLib.
    • In Item Upgrade (Script) component, under Upgrade Event (), drag and drop into the field under Runtime Only the recently added REPO Lib Item Upgrade (Script) component.
    • Select No Function > REPOLibItemUpgrade > Upgrade () one row above.

That should be it. No need to implement your own class for incrementing your own upgrade stat or creating a patch for it. Congratulations on creating your own upgrade! 🎉

Улучшение на самовоскрешение

Простой мод, который добавляет улучшение самовоскрешения. Вы покупаете это дорогое улучшение в магазине, а затем используете его. Вы получаете стопку SELF REVIVE. Когда вы умираете и у вас больше одной стопки SELF REVIVE, одна стопка расходуется, и вы возрождаетесь со всеми предметами из вашего инвентаря в грузовике.

Этот мод использует REPOLib для добавления улучшения и его предмета.