• 🏆 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!

Unit Inventory - Automatically Dropping Items?

Status
Not open for further replies.
Level 1
Joined
Apr 13, 2013
Messages
2
I've been fiddling around with the World Editor trying to create a sort of diner dash-esque map and I've hit a snag. I have a non-hero waiter unit that i want to be able to pick up items such as food and drinks and use them on customers. I want to be able to upgrade all of the waiters' inventories at a separate upgrade building. I've managed to get this working fine, starting with a 2-slot inventory and upgrading to 3, 4 and 5-slot, but I've encountered an interesting glitch.

Once the inventory is upgraded past 3 slots, when I try to pick up another item with an active ability, the game automatically drops my most recently picked up item and replaces it with the new one. I tried removing the active ability from the item and the game let me pick up as many as I wanted. I also tried picking up 4 items with no ability and then a 5th item with an active ability, which then forced the waiter to drop both the 3rd and 4th item, leaving him with 3 including the one he had just picked up.

I've not introduced any triggers that might be causing this. I tried dropping in a regular Paladin with a 6-slot inventory and he could pick up any number and combination of items no problem. I made a custom hero backpack ability that increased inventory size as it leveled up, and that also worked totally fine. Does anybody have any idea what might be causing this and, if possible, is there a workaround that doesn't require JASS or complicated triggers?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Instead of upgrading the inventory size, unblock the inventory. Have the unit start with a 6 slot inventory, which you make sure is working. When the unit is created, block off the appropriate number of slots by placing undropable dummy items in them. When an inventory upgrade is researched, iterate through all appropriate units and remove dummy items as appropriate for the upgrade.

Not the most elegant solution but should avoid bugs.
 
Level 1
Joined
Apr 13, 2013
Messages
2
Thanks, I hadn't even considered that! I'll work on implementing that straight away. I found that if I changed the inventory to start at 1 slot, then it would give the same bug but only allow me to pick up 2 items before it forced me to drop them, so that might be a pretty solid fix.
 
Level 20
Joined
Aug 29, 2012
Messages
826
You could create several waiter units, one with 2 inventory slots, one with 3 etc., and then replace your waiter by the higher level unit when your upgrade is complete, that way you don't have to fiddle with ability levels, you just need to create different inventory abilities with fixed numbers of slots, I think the editor has no problem dealing with that
 
Status
Not open for further replies.
Top