Forum rules - please read before posting.

Crafting menu - alternative to clicking on Result icon?

Anyone know a straight forward way to have the Create button in the Crafting menu use the same functionality as if you click on the Result item?  Meaning, I don't want to click on the Result item from a recipe to add it to the inventory and close the menu...I instead want to be required to click the Create button, which would add the Result item to my inventory and close the menu.

Comments

  • If you uncheck Result is automatic? in the Recipe's properties within the Inventory Manager, then clicking the Create button will be required for the resulting item to appear.

    Having the item auto-move upon clicking Create is rather unique behaviour, so I feel it's best done via a custom event.  However, currently there is no event that triggers upon the succesful creation of a recipe.  I'll address this as part of the upcoming v1.64.0 update - if you bump this thread once its out, I'll assist with the event script.
  • Thanks Chris -
  • Hey Chris, I am having trouble finding the recipes "Result is automatic" checkbox in the latest AC, has it moved somewhere else? I am also curious about the custom events mentioned, I am guessing EventManager.Call_OnCraftingSucceed does the trick right? Thanks for the support!

  • edited January 2021

    I am having trouble finding the recipes "Result is automatic" checkbox in the latest AC, has it moved somewhere else?

    Yes - in v1.70.0, this option was moved to the properties list of the "Output" Crafting element used to display the recipe's resulting item. In the default interface, this is the Crafting menu's Crafting element.

    I am also curious about the custom events mentioned, I am guessing EventManager.Call_OnCraftingSucceed does the trick right?

    Yes, give this a try:

    using UnityEngine;
    using AC;
    
    public class AutoGetCrafting : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnCraftingSucceed += OnCraftingSucceed; }
        private void OnDisable () { EventManager.OnCraftingSucceed -= OnCraftingSucceed; }
    
        private void OnCraftingSucceed (Recipe recipe)
        {
            KickStarter.runtimeInventory.PerformCrafting (recipe, true);
        }
    
    }
    

    Bear in mind that you'll need a Crafting element of type "Output" to be present in your Menu Manager - though it can be made invisible if desired.

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.