- Joined
- Mar 27, 2012
- Messages
- 3,232
And here's for something completely different!
Story
I have a map, where each hero has a spellbook. At some point I got tired of adding the Inventory(hero) ability to each hero, so I put it in their spellbook.
On one of the heroes I forgot to remove the ability from hero itself.
The result? First 6 items I picked up simply disappeared, but they did add stats.
Back then I simply removed the ability from the hero and was done with it.
However, recently I started to test what this little glitch can do. The results blew me away.
What?
In the game there are 5 inventory abilities. They do stack, but in a strange way. If you combine 2 inventory abilities that both have 4 slots, then you can still only see 4 items.
That's because inventories overlap. The one added first is the one with the lowest slot indexes - it is the one to receive items first.
The one added last, however, is the one you can actually see.
You do not need to use multiple different inventory abilities to apply a secret inventory, but it can be useful if you want to dynamically add/remove the inventories.
How to use?
Make sure your hero has the Inventory(hero) ability.
Then create an ability based on spellbook. Add the Inventory(hero) ability into the spellbook and add the spellbook to the hero.
You're now done with the object editor part.
The harder part is triggers. I won't give instructions on how to make a full item management system. I will, however, give you the tools to make it.
Q/A explains.
*When adding/removing secret inventories they sometimes break, thus not dropping the items they contain. This can only be fixed by NOT removing them at all.
*The second inventory can be applied in any way, this includes items(an interesting idea, since items can then add slots for more items).
Test map:
Every item that gets put into a secret inventory is dropped 20 seconds later. The hero has 18 secret and 6 normal slots.
If you pick up all items, then wait for something to drop and then try to pick up more, then it will say that you have full slots.
This can be fixed by dropping one item(or not filling the visible inventory completely).
Story
I have a map, where each hero has a spellbook. At some point I got tired of adding the Inventory(hero) ability to each hero, so I put it in their spellbook.
On one of the heroes I forgot to remove the ability from hero itself.
The result? First 6 items I picked up simply disappeared, but they did add stats.
Back then I simply removed the ability from the hero and was done with it.
However, recently I started to test what this little glitch can do. The results blew me away.
What?
In the game there are 5 inventory abilities. They do stack, but in a strange way. If you combine 2 inventory abilities that both have 4 slots, then you can still only see 4 items.
That's because inventories overlap. The one added first is the one with the lowest slot indexes - it is the one to receive items first.
The one added last, however, is the one you can actually see.
You do not need to use multiple different inventory abilities to apply a secret inventory, but it can be useful if you want to dynamically add/remove the inventories.
How to use?
Make sure your hero has the Inventory(hero) ability.
Then create an ability based on spellbook. Add the Inventory(hero) ability into the spellbook and add the spellbook to the hero.
You're now done with the object editor part.
The harder part is triggers. I won't give instructions on how to make a full item management system. I will, however, give you the tools to make it.
Q/A explains.
Q: How do I know if an item was put into the hidden inventory?
A: When the item is picked up you check if it is in the hero's inventory. Sounds dumb, but the native that checks if a hero has some item only checks the visible inventory.
Thus, if an item was picked up and it isn't on the hero, then it was put into hidden inventory.
Q: How do I drop items if I can't even see them?
A: There is no direct way that I know. However, it can be simulated.
First you create an item of the exact same type
You could also try to just move the item to ground, and it would work, but the item would become impossible to pick up and hero would still have it in the secret inventory, thus still gaining stats.
Q: How do I drop an when it has already been picked up earlier?
A: When the item is picked up you store it into a variable, thus you can access it later too.
Q: How to put an item into the visible inventory when the secret one isn't filled?
A: The best way I know is filling all secret slots with a dummy item and then giving the actual item. After that you can remove the dummy items. For this you'll need to keep track of how many items the hero has at all times though.
A: When the item is picked up you check if it is in the hero's inventory. Sounds dumb, but the native that checks if a hero has some item only checks the visible inventory.
Thus, if an item was picked up and it isn't on the hero, then it was put into hidden inventory.
Q: How do I drop items if I can't even see them?
A: There is no direct way that I know. However, it can be simulated.
First you create an item of the exact same type
- Item - Create (Item-type of (Item being manipulated)) at (Position of (Triggering unit))
You could also try to just move the item to ground, and it would work, but the item would become impossible to pick up and hero would still have it in the secret inventory, thus still gaining stats.
Make a boss that can be weakened by destroying his items when they are on the ground, thus reducing his stats.
Q: How do I drop an when it has already been picked up earlier?
A: When the item is picked up you store it into a variable, thus you can access it later too.
Q: How to put an item into the visible inventory when the secret one isn't filled?
A: The best way I know is filling all secret slots with a dummy item and then giving the actual item. After that you can remove the dummy items. For this you'll need to keep track of how many items the hero has at all times though.
*When adding/removing secret inventories they sometimes break, thus not dropping the items they contain. This can only be fixed by NOT removing them at all.
*The second inventory can be applied in any way, this includes items(an interesting idea, since items can then add slots for more items).
Test map:
Every item that gets put into a secret inventory is dropped 20 seconds later. The hero has 18 secret and 6 normal slots.
If you pick up all items, then wait for something to drop and then try to pick up more, then it will say that you have full slots.
This can be fixed by dropping one item(or not filling the visible inventory completely).
Attachments
Last edited by a moderator: