I want to use an Equipment Item called "Pot" to make a dish.
I want to be able to put the ingredients into the dropped pot and Craft when the ingredients are ready.

The node [can use recipe] needs to be a combatant.

Can I somehow make it so that only non-combatant (equipped) ITEMS can be crafted?
  • Hm, you can use the conditions of crafting recipes to check if the pot is equipped.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • My intentions are not clear.
    The pot is not rigged, it's on the ground.
    In other words, they are independent items that don't belong to anyone.

    For example, in this game called OverCook2, it's like throwing food into a pot or pan.


    I couldn't find a solution, so I added Add Combatant to the pot and defined a Combatant called "pot".

    I want the dropped items to be added to the pot's inventory when TriggerEntered to the pot's combatant trigger.

    I've tested it, and when I enter the trigger for the pot, it is added to the Player's inventory.
    Is it possible to force it to be added only to Player?
    Is the only way to add it to the NPC's Inventory is to create a Schmatic Machine?
    In that case, when I try to define it from the Trigger Machine on the NPC side, I can't find a node that allows me to select an item (EquipmentItem) from a game object that has already been dropped to the ground (ItemCollector or EquipmentItemPrefab). I don't see any node that can select an item (EquipmentItem) from a game object (ItemCollector or EquipmentItemPrefab) that has already been dropped on the ground.
    Is there any way to make this happen?

    Is there any way to do this? Also, do I have to create custom C# code?
  • You probably use Item Collectors for this - they'll always use the player for the collection.

    I don't think this is currently possible, I'll look into adding nodes to get the items from item collectors in schematics.

    You can do it with custom C# code, for this, have a component with this attached:
    protected Combatant combatant;

    protected virtual void Start()
    {
    this.combatant = ORKComponentHelper.GetCombatant(this.gameObject);
    if(this.combatant == null)
    {
    this.enabled = false;
    }
    }

    protected virtual void OnTriggerEnter(Collider other)
    {
    ItemCollector collector = other.gameObject.GetComponent<ItemCollector>();
    if(collector != null)
    {
    IShortcut item = collector.Item;
    this.combatant.Inventory.Add(item, false, false, false);
    GameObject.Destroy(other.gameObject);
    }
    }


    The Start function will find the pot's combatant (and disable the component if it isn't found), the OnTriggerEnter function checks for item collectors and adds them to the inventory (and destroys them).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thank you very much.
    I immediately pasted this script into the pot's Prefab.
    The ItemCollector that exists in the scene from the beginning was added to the pot's Inventory as usual.

    However, when the EquipmentItemPrefab generated by the ItemCollector dropped by the Player is thrown into the pot, it is somehow added to the Player's Inventory.
    What is going on?
    The schematic that the Player drops looks like this.
    https://imgur.com/a/eKJsNwa
  • I found the cause.
    The Trigger was not attached to the ItemCollector dropped by the Player.

    Now it works as desired, but I am not sure if it is correct.
    protected virtual void OnTriggerEnter(Collider other)
    {
    if (combatant == null) return;

    //ItemCollector collector = other.gameObject.GetComponent<ItemCollector>();
    //if (collector != null)
    //{
    // IShortcut item = collector.Item;
    // this.combatant.Inventory.Add(item, true, true, false);
    // GameObject.Destroy(other.gameObject);
    //}

    if (other.TryGetComponent(out InteractionForwarder interaction))
    {
    var itemCollector = interaction.interaction.gameObject.GetComponent<ItemCollector>();
    var item = itemCollector.Item;
    this.combatant.Inventory.Add(item, true, true, false);
    GameObject.Destroy(other.gameObject);
    }
    }
  • edited February 2022
    Hm, I think your interaction controller on the dropped item is just immediately started by the player via the Trigger Enter start type.

    Seems correct at first glance :)
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.