Having Only One of Each Tool
Author: Zoleda Davila
Posted on 2/8/2024
A special feature I wanted for the inventory is that the player could only have one of each tool at a time. An issue I was having was even though the limit was one for each tool in the Data Table, when the player was in range to interact with each tool, they could still pick up the tool and put the tool in a different slot. For the way we want our game to function, this is an issue, because we want the inventory to be maximized for the player. In order to do this, I first wanted to edit the Handle Interact function that is in all items that we can interact with. This was not working, because we had to have access to both the player's inventory, how much the item gave you, and the information in the data table.
After reverting back the changes that I made to the item's Handle Interact, I decided to check in the inventroy component when we have to add the item to inventory. First, I edited the Find Slot function to see if we already had a slot with that specific item. If we did, then we would check if the quanitity in that slot was equal to the limit of how many we could have for that item. If we did then we will return that we could not find a slot and an index of zero. Then, when we call the Find Slot fucntion, we check if we found a slot. If we did not, then we check if the index is -1. If yes, then we find empty slots and add to inventory. If not, that means we are at our limit for that one item and we do not complete the process of adding the item to our inventory. During testing, it does not work if you try to add a tool you already have in your inventory.
Just A Simple Farming Game
Status | In development |
Authors | Golden Goblins, SeotatopDehsam, MOOster_MOO, WendigoCrypt, zoleda_davila, SenorCarlito, thackattack42 |
Genre | Simulation |
Tags | Action-Adventure, Farming, Third Person |
More posts
- Sneak Peek: Farm CutsceneMar 19, 2024
- Fine-tuning Enemy AIMar 01, 2024
- Major Perforce IssuesMar 01, 2024
- Animations Failing To PlayMar 01, 2024
- Getting Random Location In a NavMeshFeb 29, 2024
- Issues with Testing Spawn PointsFeb 29, 2024
- Double Use of Seed ItemsFeb 25, 2024
- NavMesh not updatingFeb 24, 2024
- Issues with Player LocationFeb 23, 2024
- Foundations of Enemies and AnimationsFeb 17, 2024
Leave a comment
Log in with itch.io to leave a comment.