|
Post by diogof on Dec 15, 2020 16:10:36 GMT
Hello boys. I need help with the crafting system. I need some items to be craftable if the character is near a workbench. My idea is to make a collider that when the character enters the "can craft" box for each item, the problem is that I don't know how to get to it. IF anyone has another solution, please share it.
Thank you all
|
|
|
Post by diogof on Dec 16, 2020 16:02:23 GMT
I finally found the solution, I hope it helps someone. The script is simple, it is activated "unlockInArear" so that the items are unlocked by entering a collider or it is deactivated to use the "UnlockItemCraft" function in a Trigger Generic Action
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Invector.vItemManager;
public class WorkBench : MonoBehaviour
{
// Start is called before the first frame update
public vItemListData itemListData;
public List<vItem> unlockItems;
public bool unlockInArear;
private void OnTriggerEnter(Collider other)
{
if (unlockInArear == true)
{
if (other.CompareTag("Player") && other.GetComponent<vItemManager>())
{
UnlockItemCraft(true);
}
}
}
private void OnTriggerExit(Collider other)
{
if (unlockInArear == true)
{
if (other.CompareTag("Player") && other.GetComponent<vItemManager>())
{
UnlockItemCraft(false);
}
}
}
public void UnlockItemCraft(bool canCraft)
{
for (int i = 0; i < itemListData.items.Count; i++)
{
for (int j = 0; j < unlockItems.Count; j++)
{
if (itemListData.items[i].name == unlockItems[j].name)
{
itemListData.items[i].canCraft = canCraft;
}
}
}
}
}
|
|
|
Post by MunK on Jan 15, 2021 13:29:31 GMT
I finally found the solution, I hope it helps someone. The script is simple, it is activated "unlockInArear" so that the items are unlocked by entering a collider or it is deactivated to use the "UnlockItemCraft" function in a Trigger Generic Action using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Invector.vItemManager;
public class WorkBench : MonoBehaviour
{
// Start is called before the first frame update
public vItemListData itemListData;
public List<vItem> unlockItems;
public bool unlockInArear;
private void OnTriggerEnter(Collider other)
{
if (unlockInArear == true)
{
if (other.CompareTag("Player") && other.GetComponent<vItemManager>())
{
UnlockItemCraft(true);
}
}
}
private void OnTriggerExit(Collider other)
{
if (unlockInArear == true)
{
if (other.CompareTag("Player") && other.GetComponent<vItemManager>())
{
UnlockItemCraft(false);
}
}
}
public void UnlockItemCraft(bool canCraft)
{
for (int i = 0; i < itemListData.items.Count; i++)
{
for (int j = 0; j < unlockItems.Count; j++)
{
if (itemListData.items[i].name == unlockItems[j].name)
{
itemListData.items[i].canCraft = canCraft;
}
}
}
}
}
Wow Thanks! I've been looking for a solution for this as well. Once again thanks for sharing!
|
|
|
Post by Invector on Jan 27, 2021 15:01:46 GMT
|
|
noir
Full vMember
Posts: 57
|
Post by noir on Dec 9, 2021 17:25:49 GMT
Is there a way to hide items that are craftable until the player learns how?
|
|
xizor
New vMember
Posts: 15
|
Post by xizor on Aug 21, 2022 18:25:01 GMT
Have followed all of the steps in the Official Invector Integration video, but the items do not appear in the newly created crafting window. I have tried using Basic Locomotion, Melee, & ShooterMelee Templates. All the same deadend. Thoughts?
|
|
|
Post by marcus83 on May 24, 2023 0:40:23 GMT
Hi,
Is there a Documentation page for the Inventory Crafting Addon? I watched the video, but the version of the inventory crafting add-on, that I downloaded isn't the same and the video I found wasn't up to date, the inventory crafting add-on doesn't work with the test scene either. there are some new items like books that I'm guessing work like recipes, but they don't work either.. toggles like the "can craft" toggle are not present in the UI where they are shown even in this thread. I followed the video regardless and set up the UI, buttons etc and just tried to require some items craft from existing items in my inventory but I can not get this to function..
Ive just been playing with this for a few days, but I haven't had any other real problems from the controller, I set up a couple custom characters, custom weapons, swapped animations, also have played with and got working many of the add-ons like the cover addon on custom characters in a custom scene and many other things with out any real issue what so ever, so its not incompetence. if anyone can point me to the documentation for this or some instruction that would be great, I only found documentation for the melee / shooter, nothing for the inventory crafting... Maybe I over looked it?
thx
NVM, I found the documentation in the install folder, so maybe I'm incompetent after all!
cheers
|
|
|
Post by marcus83 on May 24, 2023 15:20:25 GMT
Sorry to bother everyone again, I set this up and a few things didn't work but I worked threw them no big deal and everything is working but, lets say I use a book to unlock a crafting recipe and the book is consumed, is that crafting recipe saved with the demo inventory item saver? to try to be clear, when I load the inventory again after quiting application, will I be able to craft the item learned from the book still? Sorry to ask but I didn't see any information on the topic in the documentation or anywhere else and its kinda an important detail.. thx
|
|