• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Order unit to get item, despite his full inventory?

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hello, guys! It's me again.
So in my map, i have a item stack system created by me. However, the problem is not in it. If i have 6 stacks of an item (max stacks are 10) and my other 5 slots are full, i can't get another item of the same type as the one that is stacking. I mean that i have 4 more stacks to put that item in, but the game says my inventory is full. How can i prevent this???

I know that i should probably run a trigger each time a unit is ordered to get an item and check if this unit has it's inventory full. If it is, then remove an item, order it again, and return the item i removed.
And the real problem comes, prepare for it.
What i should do when the hero gets almost near the item? How i can make the hero take it? I have to somehow make the event "A unit acquires an item" run.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Perhaps replacing the item with Tomes could solve this issue (no more errors when full inventory) because you can still pick up tomes when you have full inventory.

Don't forget to install Bribe's system, the Tome Removal system (because Tomes are naturally leak on its own, never gets removed)
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Mmmm... tomes? This means i have to create a copy of all my items as a tome? Man... i have lots of items, most of them created in triggers and i have to change them... damn. Another solution just came in ma mind. Here it is :

Event : unit is issued targeting an object

Then i check those things :
1. Is the object = item?
2. Is the item of class charged (only items of class "charged" in my map have stacks)
3. Is the unit's inventory full?
4. Is there a item in the unit's inventory = the item that the unit is ordered to get?
5. Is the item in the unit's inventory (that is equal to the item of the order) having less than the max charges (stacks)?

If those 5 conditions are true, then i index this as an instance (trough Hanky's Dynamic Indexing System), remove one of the items that the unit carries so that the game will actually order the unit to get the item without the Inventory is full message and then give the removed item again to the hero.

In a loop trigger, i check the distance between the issued unit and the item, if it's less than the distance that the unit needs to be within to get an item (like getting it normally), then i remove an item again, wait for my item stacks system to do it's thing and give the removed item.

Also, i will check if the unit has it's order cancelled.


Do you think this will work?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Regardless of distance between the unit and the item, the error message would still be triggered + voice saying "Inventory is full" if you have full item in your inventory slot.

If you can remove those, your system might work.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Regardless of distance between the unit and the item, the error message would still be triggered + voice saying "Inventory is full" if you have full item in your inventory slot.

If you can remove those, your system might work.
Can they be removed trough triggers, or it's interface problem?

EDIT : Both can be removed in the interface panel. So in the same trigger that marks the new instance, i will check again if the unit's inventory is full, but if the item that the unit is ordered to get can not be stacked, then i will trigger a message and play a sound for full inventory
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Damn that post took me too long.. It was a reply to http://www.hiveworkshop.com/forums/...espite-his-full-inventory-221772/#post2207720, the 6th post in the thread:



Might, but then, dont loop the trigger.. Nestharus wrote a library to detect UnitInRange events. This would require you to create a dummy unit at the item's location. But since you can also unregister with that system, that should not be such a big problem.

It does however require Nestharus' own UnitIndexer. So if you already have an indexing system in the map, you are either going to have a bad time, or you are going to have to replace it..
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Sound - Inventory Full
Text - Message - 'Inventory is full.'

However, the sound can not be set to "None"...

EDIT : I have removed the text by placing empty space " " in the Text - Message.
Now i have to search for a "quiet" sound because it can't be set to none... I can't even create a dummy sound which is actually nothing and input it...

Can someone give me a suggestion for "quiet" sound?

EDIT 2 : I have found the perfect sound, Ambient -> Elevator. I had to put the volume to 100% in order to hear SOMETHING. Usually my volume is to 8-10% :D
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I'm aiming for this system to be like in DotA.
You can still pick up items if you have full inventory.
You don't have to do just for stack items, you can do it for recipe items too.

Imagine, the ingredient for this recipe item is Item A, Item B, Item C.
You have Item A and Item B in your inventory but it is now full.

Usually, you will need to drop any of your item to make it to accept one more item (Item C) and complete the recipe, right ?

With this system, you don't need to drop the item at all, just click on Item C and it will do on its own, eureka !
The recipe is done (converted to Item D) and you will still maintain your other item in your inventory without dropping them to the ground and pick it (traditional way).
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Ahhh yes, yes! I completely forgot about this. You can create it then! It will be useful! :)
I also have a recipe system in my map (made by me). But i will not be able to do it the way you said because the whole thing will happen when you use the recipe, not just getting it. Soooo, dropping items can not be avoided... However, i like it this way. :)
 
Status
Not open for further replies.
Top