Forum rules - please read before posting.

Opsive Controller with AC Integration

Hi, the integration is good in the fact if you pick up a weapon via using the opsive components then it goes in the inventory. the way I decided to set it up is using AC with a hotspot on the weapon it gets picked up and goes in AC inventory but is there a way where I can then click on the inventory icon weapon and then it gets equipped then is removed from inventory. So really I want the opposite to the integration.

Comments

  • As the potential range of implementations between the two assets is so wide, custom scripting will be necessary for some of the finer details. The integration is designed to give a "base" for more project-specific code.

    It is possible to hook into AC's OnInventorySelect custom event to run additional code when a specific inventory item is selected. For example:

    using UnityEngine;
    using AC;
    
    public class InventorySelectExample : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnInventorySelect += OnInventorySelect; }
        private void OnDisable () { EventManager.OnInventorySelect -= OnInventorySelect; }
    
        private void OnInventorySelect (InvItem invItem)
        {
            Debug.Log ("Selected item " + invItem.label + " with ID = " + invItem.id);
        }
    
    }
    

    This will cause a message to display in the Console each time an item is selected. You can replace this behaviour with e.g. a call to have UCC equip a particular weapon.

    For the exact code necessary to do that, see UCC's own documentation or consult its developers. If you need help making use of that code, let me know here once you have it and I can show you how to make use of it in the above script.

  • Ok, I worked it out. I didn't know how to use your code so I used opsive pickup and equip codes in the documentation. But I changed the script to have the code in a public function and used send message to the item that gets picked up and on the inventory I used send message to equip the item and it worked. It's probably not really a good way but it did work though.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.