Forum rules - please read before posting.

Inventory, Shop and Crafting

2»

Comments

  • Cool! I'll have a look.

  • Hello, I'm bringing back this post because I need another customization help for the Crafting part...
    Basically, besides the ingredients, I'd like to allow the creation of the recipe only if player has some tools in its inventory. Meaning, every recipe requires some ingredients AND the presence in the inventory of some specific tools.
    My Crafing UI has a "Create" button which simply calls the AC Inventory - Crafting - Create Recipe. So I thought to create a custom action to run before that, that based on the recipe the player is trying to make, is also checking specific items.
    But other than that, I've no clues... Maybe I should extend the InventoryManager for Crafting instead...?
    I can't figure out the best way. So any help in that sense is very appreciated.

  • Yes, you'd need to first determine what Recipe the currently-laid ingredients would produce, and then check for a specific item's presence.

    Code snippet:

    MenuCrafting crafting = PlayerMenus.GetElementWithName ("Crafting", "Crafting") as MenuCrafting;
    Recipe recipe = KickStarter.runtimeInventory.CalculateRecipe (crafting.IngredientsInvCollection);
    if (recipe == null) return;
    
    if (recipe.EditorLabel == "Cake" && !KickStarter.runtimeInventory.PlayerInvCollection.Contains (2)) return;
    
    crafting.SetOutput ();
    

    In this example, the Recipe "Cake" will not be run if the Player isn't carrying an item with an ID of 2.

    This snippet also does the job of the "Create Recipe" method, so no need for the Inventory: Crafting Action.

  • Thanks! I'll give it a try (using return 0f; since it's in an Action)

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.