Hey Hive, I've stumbled across a problem when I tried to make a backpack unit.
The idea was to give the hero the ability to summon a backpack-dummy unit (I used Summon Misha), however I wanted to keep the inventory so that when the unit died or was resummoned, it would keep its inventory, and I made that work. The only problem is that when the backpack unit died, after a few seconds it would drop all the items, since it was not a hero. No matter how I tried to work around this problem, it would either end with losing all the items, or making copies (dropping items after death, but and also have the items when summoned).
When I try to remove the unit when it dies to prevent it from dropping the items, the items are removed as well. Here are the 3 triggers I use:
Maybe I'm going about this all wrong, but I think I need to either fix the trigger system, or somehow avoid having this particular normal unit type drop items on death. Any ideas?
The idea was to give the hero the ability to summon a backpack-dummy unit (I used Summon Misha), however I wanted to keep the inventory so that when the unit died or was resummoned, it would keep its inventory, and I made that work. The only problem is that when the backpack unit died, after a few seconds it would drop all the items, since it was not a hero. No matter how I tried to work around this problem, it would either end with losing all the items, or making copies (dropping items after death, but and also have the items when summoned).
When I try to remove the unit when it dies to prevent it from dropping the items, the items are removed as well. Here are the 3 triggers I use:
-
SaveInventory
-
Events
- Unit - A unit Dies
-
Conditions
- (Unit-type of (Triggering unit)) Equal to Backpack
-
Actions
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
- Set ItemTest[(Integer A)] = (Item carried by (Triggering unit) in slot (Integer A))
-
Loop - Actions
-
For each (Integer A) from 1 to 6, do (Actions)
-
Events
-
LoadInventory
-
Events
- Unit - A unit Spawns a summoned unit
-
Conditions
- (Unit-type of (Summoned unit)) Equal to Backpack
-
Actions
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
- Hero - Create (Item-type of ItemTest[(Integer A)]) and give it to (Summoned unit)
-
Loop - Actions
-
For each (Integer A) from 1 to 6, do (Actions)
-
Events
-
PlsDontDropOnDeath
-
Events
- Unit - A unit Loses an item
-
Conditions
-
And - All (Conditions) are true
-
Conditions
- ((Triggering unit) is dead) Equal to True
- (Unit-type of (Triggering unit)) Equal to Backpack
-
Conditions
-
And - All (Conditions) are true
- Actions
-
Events