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
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2305README
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.
- 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.
- Create a new folder in the
Assets/for your mod name. - Create a new
REPOLib > Modin your mod folder. - Follow this tutorial to create
ItemContent, Item Prefab andItem. See below for more information on how to setup that. - Export the mod like instructed here.
- In your
.csprojinclude the bundle like<ItemGroup><EmbeddedResource Include="bundle\selfreviveupgrade"/></ItemGroup>. - In your
repoharmonymod, you can load the bundle from embedded bundle, seeSelfReviveUpgrade.RegisterBundledItemAndUpgrade()for more information. - Register your upgrade and item with
REPOLibas 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:
- Copy over following resources from REPO to your mod:
Assets/REPO/Game/Prefabs/Item Upgrae Player Grab Strength.prefabAssets/REPO/Game/Materials/upgrade_strength.matAssets/REPO/Game/Textures/Texture2Ds/Upgrade_Grab-Strength_Albedo.png
- Use albedo as a reference for your own upgrade. I drew mine in Krita.
- Open the material (
.mat) and drag and drop albedo into Albedo in the sidebar. - Open (double click) the prefab
.prefab, and find in the Hierarchy Mesh. Expand Materials and drag and drop over your.matcopy (it took me a while to make my prefab display the correct texture). - 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 для добавления улучшения и его предмета.