- Joined
- Jul 26, 2008
- Messages
- 1,009
I found an inventory system on wc3c.net that worked out great for my needs, or so I thought.
It works great in it's own map, but when transfered into my map it seems to create bugs for itself (Heroes can't pick up items after recieving the bag item). I'm debugging it and trying to pinpoint the problem.
My Request:
Could someone help me or work with me to make this system work for my map? It's from Kricz and it's written in vJASS. Currently the only problems are you have to put items in the backpack to make them stack, you can't pick up items off the ground, and when your inventory is full the item doesn't go to the backpack instead.
What I've Done:
I've modified some triggers and ran a few tests to try to pinpoint the issue. I've taken out these from the custom inventory system:
To see if any particular spot on those was the problem. Still bugged. I then created a seperate map with all my systems too see if it was system conflict. Still bugged. I then checked to see if the problem was that you give the inventory to the hero off map initialization, nope that was okay.
I've found that when you pick up just the equipment bag you don't bug, until you pick up the backpack. I've also found that if you're given the system but not the backpack, you still bug. These two seem to contradict each other. It's obviously something behind the system of the backpack and not the item itself.
I assume the problem lies in this code, but that's merely a hunch:
Attached is 1) the main Map using the system 2) the System and 3) the System with the components of the main map to test it out together.
My Map:
Vuen's D&D is the map I'm modifying. It's a 3 DM, 7 Player, roleplay map. A fusion between SotDRP and an ORPG or to some players a DnD game tool.
It works great in it's own map, but when transfered into my map it seems to create bugs for itself (Heroes can't pick up items after recieving the bag item). I'm debugging it and trying to pinpoint the problem.
My Request:
Could someone help me or work with me to make this system work for my map? It's from Kricz and it's written in vJASS. Currently the only problems are you have to put items in the backpack to make them stack, you can't pick up items off the ground, and when your inventory is full the item doesn't go to the backpack instead.
What I've Done:
I've modified some triggers and ran a few tests to try to pinpoint the issue. I've taken out these from the custom inventory system:
JASS:
call TriggerAddCondition(.Use, Condition(function thistype.useItem))
call TriggerAddCondition(.Pickup, Condition(function thistype.pickupItem))
call TriggerAddCondition(.Drag, Condition(function thistype.dragItem))
call TriggerAddCondition(.Drop, Condition(function thistype.dropItem))
To see if any particular spot on those was the problem. Still bugged. I then created a seperate map with all my systems too see if it was system conflict. Still bugged. I then checked to see if the problem was that you give the inventory to the hero off map initialization, nope that was okay.
I've found that when you pick up just the equipment bag you don't bug, until you pick up the backpack. I've also found that if you're given the system but not the backpack, you still bug. These two seem to contradict each other. It's obviously something behind the system of the backpack and not the item itself.
I assume the problem lies in this code, but that's merely a hunch:
JASS:
method control takes nothing returns boolean
local real dx = GetUnitX(.Owner) - .x
local real dy = GetUnitY(.Owner) - .y
local Item it = Item.getItemById(GetItemTypeId(.item))
if GetUnitCurrentOrder(.Owner) != .order or GetItemX(.item) != .x or GetItemY(.item) != .y or GetWidgetLife(.Owner) <= 0.405 then
return false
elseif SquareRoot(dx * dx + dy * dy) <= ITEM_PICKUP_DIST and GetItemX(.item) == .x or GetItemY(.item) == .y and GetWidgetLife(.Owner) > 0.405 then
call IssueImmediateOrder(.Owner, "stop")
if (AUTO_EQUIP and it.Equipment and .isSlotEmpty(it.Slot) and .checkHero(it, false) and .allowauto) then
return Inventory.equipItem(.Owner, .item, it)
endif
if not .checkItemForStack(.item) then
if not .getSlotForItem(.item) then
call SimError(GetOwningPlayer(.Owner), "Inventory and Backpack are full.")
return false
endif
endif
return false
elseif SquareRoot(dx * dx + dy * dy) > ITEM_PICKUP_DIST then
return true
endif
return false
endmethod
Attached is 1) the main Map using the system 2) the System and 3) the System with the components of the main map to test it out together.
My Map:
Vuen's D&D is the map I'm modifying. It's a 3 DM, 7 Player, roleplay map. A fusion between SotDRP and an ORPG or to some players a DnD game tool.
Attachments
Last edited: