Inventory Engine and TPC healing

CruttMutt

Member
Hi! Now I'm sure there isn't an official Inventory Engine integration or anything like that but I have done well so far but I have hit a snag which I'm hoping is just because I am a novice missing something:

I am trying to make the HealthBonusItem script get the component from the Character Health to heal the player on item use. I had this working perfectly fine before I upgraded the inventory system by following the documentation, but now I can't seem to get the script to talk to the "Opsive.UltimateCharacterController.Traits" on use and complete the Heal function. I stare at it for ages but I can't pick myself why this one won't see it but my others would. I know both the TPCC and the Inventory Engine are working fine up to this point, and I get the debug.log of the item being used so I just need to get that action of healing happening.

Maybe there is a better way I can go about it?

The unity console has this error currently:
Assets\InventoryEngine\Demos\PixelRogue\Scripts\Items\HealthBonusItem.cs(6,14): error CS0234: The type or namespace name 'UltimateCharacterController' does not exist in the namespace 'Opsive' (are you missing an assembly reference?)


The Code:


using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using MoreMountains.Tools;
using System;
using Opsive.UltimateCharacterController.Traits;

namespace MoreMountains.InventoryEngine
{
[CreateAssetMenu(fileName = "HealthBonusItem", menuName = "MoreMountains/InventoryEngine/HealthBonusItem", order = 1)]
[Serializable]
/// <summary>
/// Demo class for a health item
/// </summary>
public class HealthBonusItem : InventoryItem
{
[Header("Health Bonus")]

[SerializeField] protected GameObject m_Character;

public int HealthBonus;

public override bool Use()
{
base.Use();
var health = m_Character.GetComponent<Health>();
health.Heal(HealthBonus);
Debug.LogFormat("increase character's health by "+HealthBonus);
return true;
}

}
}




Thanks very much!
 
Last edited:
Okay, it's not too hard to understand what they are doing, thanks for that. But I am still struggling to see why it can't see that assembly reference from these particular scripts.

Might not be much more you can do since they're working in all the other scripts. If you think of any tips I would appreciate it but suppose I just gotta work out where it's going wrong.
 
Yeah sure! It was something I struggled to find for a while and the person at more mountains who made the inventory failed to suggest this was a potential issue.

It was simple for me though once I worked it out:

Find the "MoreMountains.InventoryEngine" assembly definition in Scripts and remove the Define Constraints. I believe this made it restricted to only talking across MoreMountain scripts. Once they were gone I have had no problem having his scripts access my other scripts.

Hope it's as easy for you! This was never suggested to me as support when I emailed MoreMountains so no guarantee on anything and I never heard back when I told them this is what I did to correct it.
 
Hello Friend. Have you found a way to integrate the amount of unused bullets and the amount of bullet you have in the cartridge of any UCC firearm? I need to add this to InventoryEngine, thanks: D
 
Hello Friend. Have you found a way to integrate the amount of unused bullets and the amount of bullet you have in the cartridge of any UCC firearm? I need to add this to InventoryEngine, thanks: D
Hello!

I have not yet as I have been mainly focused on melee up until this point but I will be implementing a bow and arrow system soon which will work very similar. I will let you know if I come up with a good way to do that! I would like it to appear in my actual inventory too. Ideally it would be great to just have them talk to eachother, but I would assume it will involve maybe setting up a public int that follows the players use and collect of the particular resource... Will let you know if I get there! If you come up with anything I would love to hear how you got there too :D
 
Okay :D, for my part I have integrated the use of long-range weapons, and what has to do with health.

So far, and I hope to go for more.
 
Top